From c7149d6bce2561aeaa48caaa1700aa8b3b22008f Mon Sep 17 00:00:00 2001 From: "Alan D. Brunelle" Date: Tue, 7 Aug 2007 15:30:23 +0200 Subject: Fix remap handling by blktrace This patch provides more information concerning REMAP operations on block IOs. The additional information provides clearer details at the user level, and supports post-processing analysis in btt. o Adds in partition remaps on the same device. o Fixed up the remap information in DM to be in the right order o Sent up mapped-from and mapped-to device information Signed-off-by: Alan D. Brunelle Signed-off-by: Jens Axboe --- drivers/md/dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 141ff9fa296e..2120155929a6 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -580,8 +580,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone, /* the bio has been remapped so dispatch it */ blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, - tio->io->bio->bi_bdev->bd_dev, sector, - clone->bi_sector); + tio->io->bio->bi_bdev->bd_dev, + clone->bi_sector, sector); generic_make_request(clone); } else if (r < 0 || r == DM_MAPIO_REQUEUE) { -- cgit v1.2.3 From 9b99628f8e9e0b5f5ecacce558defe529a6e00c1 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sat, 11 Aug 2007 22:34:27 +0200 Subject: Clean up duplicate includes in drivers/block/ This patch cleans up duplicate includes in drivers/block/ Signed-off-by: Jesper Juhl Acked-by: Stephen Rothwell Cc: Satyam Sharma Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- drivers/block/viodasd.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers') diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index 85916e2665d4..af3969a9c963 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include -- cgit v1.2.3 From 1aebe18787ca2e915eb8204d365ba2484d53223b Mon Sep 17 00:00:00 2001 From: Mariusz Kozlowski Date: Sat, 11 Aug 2007 22:34:29 +0200 Subject: drivers/block/cciss.c: kmalloc + memset conversion to kzalloc drivers/block/cciss.c | 104285 -> 104168 (-117 bytes) drivers/block/cciss.o | 277400 -> 277124 (-276 bytes) Signed-off-by: Mariusz Kozlowski Acked-by: Mike Miller Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- drivers/block/cciss.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index a11b2bd54bbe..084358a828e9 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size, { ReadCapdata_struct *buf; 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"); return; } - memset(buf, 0, sizeof(ReadCapdata_struct)); + if (withirq) return_code = sendcmd_withirq(CCISS_READ_CAPACITY, ctlr, buf, sizeof(ReadCapdata_struct), @@ -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", (unsigned long long)*total_size+1, *block_size); kfree(buf); - return; } static void @@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size, { ReadCapdata_struct_16 *buf; 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"); return; } - memset(buf, 0, sizeof(ReadCapdata_struct_16)); + if (withirq) { return_code = sendcmd_withirq(CCISS_READ_CAPACITY_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, printk(KERN_INFO " blocks= %llu block_size= %d\n", (unsigned long long)*total_size+1, *block_size); kfree(buf); - return; } static int cciss_revalidate(struct gendisk *disk) -- cgit v1.2.3 From 2e4934aa4586832c35e077191849a06f93e4a9a0 Mon Sep 17 00:00:00 2001 From: Mariusz Kozlowski Date: Sat, 11 Aug 2007 22:34:30 +0200 Subject: drivers/block/cpqarray.c: better error handling and kmalloc + memset conversion to k[cz]alloc This patch removes some redundant casts, does the kmalloc + memset to k[cz]alloc conversion and it changes the error path to use goto (to avoid code duplication). drivers/block/cpqarray.c | 49567 -> 48623 (-944 bytes) drivers/block/cpqarray.o | 178820 -> 178288 (-532 bytes) Signed-off-by: Mariusz Kozlowski Acked-by: Mike Miller Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- drivers/block/cpqarray.c | 78 ++++++++++++++++-------------------------------- 1 file changed, 26 insertions(+), 52 deletions(-) (limited to 'drivers') diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index be4e3477d83b..eb9799acf65b 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c @@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev) 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]->cmd_pool_dhandle)); - hba[i]->cmd_pool_bits = kmalloc( - ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long), + hba[i]->cmd_pool_bits = kcalloc( + (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long), GFP_KERNEL); if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) goto Enomem1; 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", hba[i]->devname); @@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr) info_p->log_drv_map = 0; - id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); - if(id_ldrive == NULL) - { + id_ldrive = kzalloc(sizeof(id_log_drv_t), GFP_KERNEL); + if (!id_ldrive) { printk( KERN_ERR "cpqarray: out of memory.\n"); - return; + goto err_0; } - id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); - if(id_ctlr_buf == NULL) - { - kfree(id_ldrive); + id_ctlr_buf = kzalloc(sizeof(id_ctlr_t), GFP_KERNEL); + if (!id_ctlr_buf) { printk( KERN_ERR "cpqarray: out of memory.\n"); - return; + goto err_1; } - id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); - if(id_lstatus_buf == NULL) - { - kfree(id_ctlr_buf); - kfree(id_ldrive); + id_lstatus_buf = kzalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); + if (!id_lstatus_buf) { printk( KERN_ERR "cpqarray: out of memory.\n"); - return; + goto err_2; } - sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL); - if(sense_config_buf == NULL) - { - kfree(id_lstatus_buf); - kfree(id_ctlr_buf); - kfree(id_ldrive); + sense_config_buf = kzalloc(sizeof(config_t), GFP_KERNEL); + if (!sense_config_buf) { 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->log_drv_map = 0; info_p->drv_assign_map = 0; @@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr) * so the idastubopen will fail on all logical drives * on the controller. */ - /* Free all the buffers and return */ printk(KERN_ERR "cpqarray: error sending ID controller\n"); - kfree(sense_config_buf); - kfree(id_lstatus_buf); - kfree(id_ctlr_buf); - kfree(id_ldrive); - return; + goto err_4; } info_p->log_drives = id_ctlr_buf->nr_drvs; @@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr) " failed to report status of logical drive %d\n" "Access to this controller has been disabled\n", ctlr, log_unit); - /* Free all the buffers and return */ - kfree(sense_config_buf); - kfree(id_lstatus_buf); - kfree(id_ctlr_buf); - kfree(id_ldrive); - return; + goto err_4; } /* Make sure the logical drive is configured @@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr) sizeof(config_t), 0, 0, log_unit); if (ret_code == IO_ERROR) { info_p->log_drv_map = 0; - /* Free all the buffers and return */ printk(KERN_ERR "cpqarray: error sending sense config\n"); - kfree(sense_config_buf); - kfree(id_lstatus_buf); - kfree(id_ctlr_buf); - kfree(id_ldrive); - return; - + goto err_4; } info_p->phys_drives = @@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr) log_index = log_index + 1; } /* end of if logical drive configured */ } /* end of for log_unit */ + + /* Free all the buffers and return */ +err_4: kfree(sense_config_buf); - kfree(id_ldrive); +err_3: kfree(id_lstatus_buf); +err_2: kfree(id_ctlr_buf); +err_1: + kfree(id_ldrive); +err_0: return; - } static void __exit cpqarray_exit(void) -- cgit v1.2.3 From a6b3a93e15b2925a151e9ae13dcb93ad7b3e48aa Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Aug 2007 22:34:31 +0200 Subject: sysace: HDIO_GETGEO has it's own method for ages The way this driver tries to implement HDIO_GETGEO it'll never be called. Then again on ppc it probably will never be called anyway because it's utterly pointless. Signed-off-by: Christoph Hellwig Cc: Grant Likely Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe --- drivers/block/xsysace.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'drivers') diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index cb27e8863d7c..3ede0b63da13 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c @@ -902,26 +902,17 @@ static int ace_release(struct inode *inode, struct file *filp) return 0; } -static int ace_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) { - struct ace_device *ace = inode->i_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; + struct ace_device *ace = bdev->bd_disk->private_data; - default: - return -ENOTTY; - } - return -ENOTTY; + dev_dbg(ace->dev, "ace_getgeo()\n"); + + geo->heads = ace->cf_id.heads; + geo->sectors = ace->cf_id.sectors; + geo->cylinders = ace->cf_id.cyls; + + return 0; } static struct block_device_operations ace_fops = { @@ -930,7 +921,7 @@ static struct block_device_operations ace_fops = { .release = ace_release, .media_changed = ace_media_changed, .revalidate_disk = ace_revalidate_disk, - .ioctl = ace_ioctl, + .getgeo = ace_getgeo, }; /* -------------------------------------------------------------------- -- cgit v1.2.3