Commit dc8a7b11 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  BLOCK: Hide the contents of linux/bio.h if CONFIG_BLOCK=n
  sysace: HDIO_GETGEO has it's own method for ages
  drivers/block/cpqarray.c: better error handling and kmalloc + memset conversion to k[cz]alloc
  drivers/block/cciss.c: kmalloc + memset conversion to kzalloc
  Clean up duplicate includes in drivers/block/
  Fix remap handling by blktrace
  [PATCH] remove mm/filemap.c:file_send_actor()
parents d291676c 02a5e0ac
...@@ -3047,6 +3047,10 @@ static inline void blk_partition_remap(struct bio *bio) ...@@ -3047,6 +3047,10 @@ static inline void blk_partition_remap(struct bio *bio)
bio->bi_sector += p->start_sect; bio->bi_sector += p->start_sect;
bio->bi_bdev = bdev->bd_contains; bio->bi_bdev = bdev->bd_contains;
blk_add_trace_remap(bdev_get_queue(bio->bi_bdev), bio,
bdev->bd_dev, bio->bi_sector,
bio->bi_sector - p->start_sect);
} }
} }
......
...@@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size, ...@@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
{ {
ReadCapdata_struct *buf; ReadCapdata_struct *buf;
int return_code; int return_code;
buf = kmalloc(sizeof(ReadCapdata_struct), GFP_KERNEL);
if (buf == NULL) { buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL);
if (!buf) {
printk(KERN_WARNING "cciss: out of memory\n"); printk(KERN_WARNING "cciss: out of memory\n");
return; return;
} }
memset(buf, 0, sizeof(ReadCapdata_struct));
if (withirq) if (withirq)
return_code = sendcmd_withirq(CCISS_READ_CAPACITY, return_code = sendcmd_withirq(CCISS_READ_CAPACITY,
ctlr, buf, sizeof(ReadCapdata_struct), ctlr, buf, sizeof(ReadCapdata_struct),
...@@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size, ...@@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
printk(KERN_INFO " blocks= %llu block_size= %d\n", printk(KERN_INFO " blocks= %llu block_size= %d\n",
(unsigned long long)*total_size+1, *block_size); (unsigned long long)*total_size+1, *block_size);
kfree(buf); kfree(buf);
return;
} }
static void static void
...@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size, ...@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
{ {
ReadCapdata_struct_16 *buf; ReadCapdata_struct_16 *buf;
int return_code; int return_code;
buf = kmalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL);
if (buf == NULL) { buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL);
if (!buf) {
printk(KERN_WARNING "cciss: out of memory\n"); printk(KERN_WARNING "cciss: out of memory\n");
return; return;
} }
memset(buf, 0, sizeof(ReadCapdata_struct_16));
if (withirq) { if (withirq) {
return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16,
ctlr, buf, sizeof(ReadCapdata_struct_16), ctlr, buf, sizeof(ReadCapdata_struct_16),
...@@ -2038,7 +2039,6 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size, ...@@ -2038,7 +2039,6 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
printk(KERN_INFO " blocks= %llu block_size= %d\n", printk(KERN_INFO " blocks= %llu block_size= %d\n",
(unsigned long long)*total_size+1, *block_size); (unsigned long long)*total_size+1, *block_size);
kfree(buf); kfree(buf);
return;
} }
static int cciss_revalidate(struct gendisk *disk) static int cciss_revalidate(struct gendisk *disk)
......
...@@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev) ...@@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev)
goto Enomem2; goto Enomem2;
} }
hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent( hba[i]->cmd_pool = pci_alloc_consistent(
hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t),
&(hba[i]->cmd_pool_dhandle)); &(hba[i]->cmd_pool_dhandle));
hba[i]->cmd_pool_bits = kmalloc( hba[i]->cmd_pool_bits = kcalloc(
((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long), (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long),
GFP_KERNEL); GFP_KERNEL);
if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool)
goto Enomem1; goto Enomem1;
memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t)); memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t));
memset(hba[i]->cmd_pool_bits, 0, ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long));
printk(KERN_INFO "cpqarray: Finding drives on %s", printk(KERN_INFO "cpqarray: Finding drives on %s",
hba[i]->devname); hba[i]->devname);
...@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr) ...@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr)
info_p->log_drv_map = 0; info_p->log_drv_map = 0;
id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); id_ldrive = kzalloc(sizeof(id_log_drv_t), GFP_KERNEL);
if(id_ldrive == NULL) if (!id_ldrive) {
{
printk( KERN_ERR "cpqarray: out of memory.\n"); printk( KERN_ERR "cpqarray: out of memory.\n");
return; goto err_0;
} }
id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); id_ctlr_buf = kzalloc(sizeof(id_ctlr_t), GFP_KERNEL);
if(id_ctlr_buf == NULL) if (!id_ctlr_buf) {
{
kfree(id_ldrive);
printk( KERN_ERR "cpqarray: out of memory.\n"); printk( KERN_ERR "cpqarray: out of memory.\n");
return; goto err_1;
} }
id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); id_lstatus_buf = kzalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL);
if(id_lstatus_buf == NULL) if (!id_lstatus_buf) {
{
kfree(id_ctlr_buf);
kfree(id_ldrive);
printk( KERN_ERR "cpqarray: out of memory.\n"); printk( KERN_ERR "cpqarray: out of memory.\n");
return; goto err_2;
} }
sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL); sense_config_buf = kzalloc(sizeof(config_t), GFP_KERNEL);
if(sense_config_buf == NULL) if (!sense_config_buf) {
{
kfree(id_lstatus_buf);
kfree(id_ctlr_buf);
kfree(id_ldrive);
printk( KERN_ERR "cpqarray: out of memory.\n"); printk( KERN_ERR "cpqarray: out of memory.\n");
return; goto err_3;
} }
memset(id_ldrive, 0, sizeof(id_log_drv_t));
memset(id_ctlr_buf, 0, sizeof(id_ctlr_t));
memset(id_lstatus_buf, 0, sizeof(sense_log_drv_stat_t));
memset(sense_config_buf, 0, sizeof(config_t));
info_p->phys_drives = 0; info_p->phys_drives = 0;
info_p->log_drv_map = 0; info_p->log_drv_map = 0;
info_p->drv_assign_map = 0; info_p->drv_assign_map = 0;
...@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr) ...@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr)
* so the idastubopen will fail on all logical drives * so the idastubopen will fail on all logical drives
* on the controller. * on the controller.
*/ */
/* Free all the buffers and return */
printk(KERN_ERR "cpqarray: error sending ID controller\n"); printk(KERN_ERR "cpqarray: error sending ID controller\n");
kfree(sense_config_buf); goto err_4;
kfree(id_lstatus_buf);
kfree(id_ctlr_buf);
kfree(id_ldrive);
return;
} }
info_p->log_drives = id_ctlr_buf->nr_drvs; info_p->log_drives = id_ctlr_buf->nr_drvs;
...@@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr) ...@@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr)
" failed to report status of logical drive %d\n" " failed to report status of logical drive %d\n"
"Access to this controller has been disabled\n", "Access to this controller has been disabled\n",
ctlr, log_unit); ctlr, log_unit);
/* Free all the buffers and return */ goto err_4;
kfree(sense_config_buf);
kfree(id_lstatus_buf);
kfree(id_ctlr_buf);
kfree(id_ldrive);
return;
} }
/* /*
Make sure the logical drive is configured Make sure the logical drive is configured
...@@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr) ...@@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr)
sizeof(config_t), 0, 0, log_unit); sizeof(config_t), 0, 0, log_unit);
if (ret_code == IO_ERROR) { if (ret_code == IO_ERROR) {
info_p->log_drv_map = 0; info_p->log_drv_map = 0;
/* Free all the buffers and return */
printk(KERN_ERR "cpqarray: error sending sense config\n"); printk(KERN_ERR "cpqarray: error sending sense config\n");
kfree(sense_config_buf); goto err_4;
kfree(id_lstatus_buf);
kfree(id_ctlr_buf);
kfree(id_ldrive);
return;
} }
info_p->phys_drives = info_p->phys_drives =
...@@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr) ...@@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr)
log_index = log_index + 1; log_index = log_index + 1;
} /* end of if logical drive configured */ } /* end of if logical drive configured */
} /* end of for log_unit */ } /* end of for log_unit */
/* Free all the buffers and return */
err_4:
kfree(sense_config_buf); kfree(sense_config_buf);
kfree(id_ldrive); err_3:
kfree(id_lstatus_buf); kfree(id_lstatus_buf);
err_2:
kfree(id_ctlr_buf); kfree(id_ctlr_buf);
err_1:
kfree(id_ldrive);
err_0:
return; return;
} }
static void __exit cpqarray_exit(void) static void __exit cpqarray_exit(void)
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/kernel.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/vio.h> #include <asm/vio.h>
......
...@@ -902,26 +902,17 @@ static int ace_release(struct inode *inode, struct file *filp) ...@@ -902,26 +902,17 @@ static int ace_release(struct inode *inode, struct file *filp)
return 0; return 0;
} }
static int ace_ioctl(struct inode *inode, struct file *filp, static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
unsigned int cmd, unsigned long arg)
{ {
struct ace_device *ace = inode->i_bdev->bd_disk->private_data; struct ace_device *ace = bdev->bd_disk->private_data;
struct hd_geometry __user *geo = (struct hd_geometry __user *)arg;
struct hd_geometry g;
dev_dbg(ace->dev, "ace_ioctl()\n");
switch (cmd) {
case HDIO_GETGEO:
g.heads = ace->cf_id.heads;
g.sectors = ace->cf_id.sectors;
g.cylinders = ace->cf_id.cyls;
g.start = 0;
return copy_to_user(geo, &g, sizeof(g)) ? -EFAULT : 0;
default: dev_dbg(ace->dev, "ace_getgeo()\n");
return -ENOTTY;
} geo->heads = ace->cf_id.heads;
return -ENOTTY; geo->sectors = ace->cf_id.sectors;
geo->cylinders = ace->cf_id.cyls;
return 0;
} }
static struct block_device_operations ace_fops = { static struct block_device_operations ace_fops = {
...@@ -930,7 +921,7 @@ static struct block_device_operations ace_fops = { ...@@ -930,7 +921,7 @@ static struct block_device_operations ace_fops = {
.release = ace_release, .release = ace_release,
.media_changed = ace_media_changed, .media_changed = ace_media_changed,
.revalidate_disk = ace_revalidate_disk, .revalidate_disk = ace_revalidate_disk,
.ioctl = ace_ioctl, .getgeo = ace_getgeo,
}; };
/* -------------------------------------------------------------------- /* --------------------------------------------------------------------
......
...@@ -580,8 +580,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone, ...@@ -580,8 +580,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone,
/* the bio has been remapped so dispatch it */ /* the bio has been remapped so dispatch it */
blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone,
tio->io->bio->bi_bdev->bd_dev, sector, tio->io->bio->bi_bdev->bd_dev,
clone->bi_sector); clone->bi_sector, sector);
generic_make_request(clone); generic_make_request(clone);
} else if (r < 0 || r == DM_MAPIO_REQUEUE) { } else if (r < 0 || r == DM_MAPIO_REQUEUE) {
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <linux/mempool.h> #include <linux/mempool.h>
#include <linux/ioprio.h> #include <linux/ioprio.h>
#ifdef CONFIG_BLOCK
/* Platforms may set this to teach the BIO layer about IOMMU hardware. */ /* Platforms may set this to teach the BIO layer about IOMMU hardware. */
#include <asm/io.h> #include <asm/io.h>
...@@ -361,4 +363,5 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, ...@@ -361,4 +363,5 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
__bio_kmap_irq((bio), (bio)->bi_idx, (flags)) __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
#endif /* CONFIG_BLOCK */
#endif /* __LINUX_BIO_H */ #endif /* __LINUX_BIO_H */
...@@ -105,7 +105,7 @@ struct blk_io_trace { ...@@ -105,7 +105,7 @@ struct blk_io_trace {
*/ */
struct blk_io_trace_remap { struct blk_io_trace_remap {
__be32 device; __be32 device;
u32 __pad; __be32 device_from;
__be64 sector; __be64 sector;
}; };
...@@ -272,6 +272,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio, ...@@ -272,6 +272,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
return; return;
r.device = cpu_to_be32(dev); r.device = cpu_to_be32(dev);
r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
r.sector = cpu_to_be64(to); r.sector = cpu_to_be64(to);
__blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
......
...@@ -1659,7 +1659,6 @@ extern int sb_min_blocksize(struct super_block *, int); ...@@ -1659,7 +1659,6 @@ extern int sb_min_blocksize(struct super_block *, int);
extern int generic_file_mmap(struct file *, struct vm_area_struct *); extern int generic_file_mmap(struct file *, struct vm_area_struct *);
extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
......
...@@ -1218,26 +1218,6 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, ...@@ -1218,26 +1218,6 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
} }
EXPORT_SYMBOL(generic_file_aio_read); EXPORT_SYMBOL(generic_file_aio_read);
int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
{
ssize_t written;
unsigned long count = desc->count;
struct file *file = desc->arg.data;
if (size > count)
size = count;
written = file->f_op->sendpage(file, page, offset,
size, &file->f_pos, size<count);
if (written < 0) {
desc->error = written;
written = 0;
}
desc->count = count - written;
desc->written += written;
return written;
}
static ssize_t static ssize_t
do_readahead(struct address_space *mapping, struct file *filp, do_readahead(struct address_space *mapping, struct file *filp,
unsigned long index, unsigned long nr) unsigned long index, unsigned long nr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment