diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-11 19:01:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-11 19:01:06 -0400 |
commit | dc8a7b11aa68d6795a46e0a42ce92220d1a6f0cd (patch) | |
tree | 7b353684090d23b1e2e3f85bf83df491f04dcc8a /drivers | |
parent | d291676ce8bc1d8ef93488023d04027010596de3 (diff) | |
parent | 02a5e0acb3cb85d80d0fe834e366d38a92bbaa22 (diff) |
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()
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/cciss.c | 16 | ||||
-rw-r--r-- | drivers/block/cpqarray.c | 78 | ||||
-rw-r--r-- | drivers/block/viodasd.c | 1 | ||||
-rw-r--r-- | drivers/block/xsysace.c | 29 | ||||
-rw-r--r-- | drivers/md/dm.c | 4 |
5 files changed, 46 insertions, 82 deletions
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, | |||
1977 | { | 1977 | { |
1978 | ReadCapdata_struct *buf; | 1978 | ReadCapdata_struct *buf; |
1979 | int return_code; | 1979 | int return_code; |
1980 | buf = kmalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); | 1980 | |
1981 | if (buf == NULL) { | 1981 | buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); |
1982 | if (!buf) { | ||
1982 | printk(KERN_WARNING "cciss: out of memory\n"); | 1983 | printk(KERN_WARNING "cciss: out of memory\n"); |
1983 | return; | 1984 | return; |
1984 | } | 1985 | } |
1985 | memset(buf, 0, sizeof(ReadCapdata_struct)); | 1986 | |
1986 | if (withirq) | 1987 | if (withirq) |
1987 | return_code = sendcmd_withirq(CCISS_READ_CAPACITY, | 1988 | return_code = sendcmd_withirq(CCISS_READ_CAPACITY, |
1988 | ctlr, buf, sizeof(ReadCapdata_struct), | 1989 | ctlr, buf, sizeof(ReadCapdata_struct), |
@@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size, | |||
2003 | printk(KERN_INFO " blocks= %llu block_size= %d\n", | 2004 | printk(KERN_INFO " blocks= %llu block_size= %d\n", |
2004 | (unsigned long long)*total_size+1, *block_size); | 2005 | (unsigned long long)*total_size+1, *block_size); |
2005 | kfree(buf); | 2006 | kfree(buf); |
2006 | return; | ||
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | static void | 2009 | static void |
@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size, | |||
2011 | { | 2011 | { |
2012 | ReadCapdata_struct_16 *buf; | 2012 | ReadCapdata_struct_16 *buf; |
2013 | int return_code; | 2013 | int return_code; |
2014 | buf = kmalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); | 2014 | |
2015 | if (buf == NULL) { | 2015 | buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); |
2016 | if (!buf) { | ||
2016 | printk(KERN_WARNING "cciss: out of memory\n"); | 2017 | printk(KERN_WARNING "cciss: out of memory\n"); |
2017 | return; | 2018 | return; |
2018 | } | 2019 | } |
2019 | memset(buf, 0, sizeof(ReadCapdata_struct_16)); | 2020 | |
2020 | if (withirq) { | 2021 | if (withirq) { |
2021 | return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, | 2022 | return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, |
2022 | ctlr, buf, sizeof(ReadCapdata_struct_16), | 2023 | 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 | printk(KERN_INFO " blocks= %llu block_size= %d\n", | 2039 | printk(KERN_INFO " blocks= %llu block_size= %d\n", |
2039 | (unsigned long long)*total_size+1, *block_size); | 2040 | (unsigned long long)*total_size+1, *block_size); |
2040 | kfree(buf); | 2041 | kfree(buf); |
2041 | return; | ||
2042 | } | 2042 | } |
2043 | 2043 | ||
2044 | static int cciss_revalidate(struct gendisk *disk) | 2044 | static int cciss_revalidate(struct gendisk *disk) |
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) | |||
420 | goto Enomem2; | 420 | goto Enomem2; |
421 | } | 421 | } |
422 | 422 | ||
423 | hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent( | 423 | hba[i]->cmd_pool = pci_alloc_consistent( |
424 | hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), | 424 | hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), |
425 | &(hba[i]->cmd_pool_dhandle)); | 425 | &(hba[i]->cmd_pool_dhandle)); |
426 | hba[i]->cmd_pool_bits = kmalloc( | 426 | hba[i]->cmd_pool_bits = kcalloc( |
427 | ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long), | 427 | (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long), |
428 | GFP_KERNEL); | 428 | GFP_KERNEL); |
429 | 429 | ||
430 | if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) | 430 | if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) |
431 | goto Enomem1; | 431 | goto Enomem1; |
432 | 432 | ||
433 | memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t)); | 433 | memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t)); |
434 | memset(hba[i]->cmd_pool_bits, 0, ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long)); | ||
435 | printk(KERN_INFO "cpqarray: Finding drives on %s", | 434 | printk(KERN_INFO "cpqarray: Finding drives on %s", |
436 | hba[i]->devname); | 435 | hba[i]->devname); |
437 | 436 | ||
@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr) | |||
1660 | 1659 | ||
1661 | info_p->log_drv_map = 0; | 1660 | info_p->log_drv_map = 0; |
1662 | 1661 | ||
1663 | id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); | 1662 | id_ldrive = kzalloc(sizeof(id_log_drv_t), GFP_KERNEL); |
1664 | if(id_ldrive == NULL) | 1663 | if (!id_ldrive) { |
1665 | { | ||
1666 | printk( KERN_ERR "cpqarray: out of memory.\n"); | 1664 | printk( KERN_ERR "cpqarray: out of memory.\n"); |
1667 | return; | 1665 | goto err_0; |
1668 | } | 1666 | } |
1669 | 1667 | ||
1670 | id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); | 1668 | id_ctlr_buf = kzalloc(sizeof(id_ctlr_t), GFP_KERNEL); |
1671 | if(id_ctlr_buf == NULL) | 1669 | if (!id_ctlr_buf) { |
1672 | { | ||
1673 | kfree(id_ldrive); | ||
1674 | printk( KERN_ERR "cpqarray: out of memory.\n"); | 1670 | printk( KERN_ERR "cpqarray: out of memory.\n"); |
1675 | return; | 1671 | goto err_1; |
1676 | } | 1672 | } |
1677 | 1673 | ||
1678 | id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); | 1674 | id_lstatus_buf = kzalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); |
1679 | if(id_lstatus_buf == NULL) | 1675 | if (!id_lstatus_buf) { |
1680 | { | ||
1681 | kfree(id_ctlr_buf); | ||
1682 | kfree(id_ldrive); | ||
1683 | printk( KERN_ERR "cpqarray: out of memory.\n"); | 1676 | printk( KERN_ERR "cpqarray: out of memory.\n"); |
1684 | return; | 1677 | goto err_2; |
1685 | } | 1678 | } |
1686 | 1679 | ||
1687 | sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL); | 1680 | sense_config_buf = kzalloc(sizeof(config_t), GFP_KERNEL); |
1688 | if(sense_config_buf == NULL) | 1681 | if (!sense_config_buf) { |
1689 | { | ||
1690 | kfree(id_lstatus_buf); | ||
1691 | kfree(id_ctlr_buf); | ||
1692 | kfree(id_ldrive); | ||
1693 | printk( KERN_ERR "cpqarray: out of memory.\n"); | 1682 | printk( KERN_ERR "cpqarray: out of memory.\n"); |
1694 | return; | 1683 | goto err_3; |
1695 | } | 1684 | } |
1696 | 1685 | ||
1697 | memset(id_ldrive, 0, sizeof(id_log_drv_t)); | ||
1698 | memset(id_ctlr_buf, 0, sizeof(id_ctlr_t)); | ||
1699 | memset(id_lstatus_buf, 0, sizeof(sense_log_drv_stat_t)); | ||
1700 | memset(sense_config_buf, 0, sizeof(config_t)); | ||
1701 | |||
1702 | info_p->phys_drives = 0; | 1686 | info_p->phys_drives = 0; |
1703 | info_p->log_drv_map = 0; | 1687 | info_p->log_drv_map = 0; |
1704 | info_p->drv_assign_map = 0; | 1688 | info_p->drv_assign_map = 0; |
@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr) | |||
1712 | * so the idastubopen will fail on all logical drives | 1696 | * so the idastubopen will fail on all logical drives |
1713 | * on the controller. | 1697 | * on the controller. |
1714 | */ | 1698 | */ |
1715 | /* Free all the buffers and return */ | ||
1716 | printk(KERN_ERR "cpqarray: error sending ID controller\n"); | 1699 | printk(KERN_ERR "cpqarray: error sending ID controller\n"); |
1717 | kfree(sense_config_buf); | 1700 | goto err_4; |
1718 | kfree(id_lstatus_buf); | ||
1719 | kfree(id_ctlr_buf); | ||
1720 | kfree(id_ldrive); | ||
1721 | return; | ||
1722 | } | 1701 | } |
1723 | 1702 | ||
1724 | info_p->log_drives = id_ctlr_buf->nr_drvs; | 1703 | info_p->log_drives = id_ctlr_buf->nr_drvs; |
@@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr) | |||
1764 | " failed to report status of logical drive %d\n" | 1743 | " failed to report status of logical drive %d\n" |
1765 | "Access to this controller has been disabled\n", | 1744 | "Access to this controller has been disabled\n", |
1766 | ctlr, log_unit); | 1745 | ctlr, log_unit); |
1767 | /* Free all the buffers and return */ | 1746 | goto err_4; |
1768 | kfree(sense_config_buf); | ||
1769 | kfree(id_lstatus_buf); | ||
1770 | kfree(id_ctlr_buf); | ||
1771 | kfree(id_ldrive); | ||
1772 | return; | ||
1773 | } | 1747 | } |
1774 | /* | 1748 | /* |
1775 | Make sure the logical drive is configured | 1749 | Make sure the logical drive is configured |
@@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr) | |||
1798 | sizeof(config_t), 0, 0, log_unit); | 1772 | sizeof(config_t), 0, 0, log_unit); |
1799 | if (ret_code == IO_ERROR) { | 1773 | if (ret_code == IO_ERROR) { |
1800 | info_p->log_drv_map = 0; | 1774 | info_p->log_drv_map = 0; |
1801 | /* Free all the buffers and return */ | ||
1802 | printk(KERN_ERR "cpqarray: error sending sense config\n"); | 1775 | printk(KERN_ERR "cpqarray: error sending sense config\n"); |
1803 | kfree(sense_config_buf); | 1776 | goto err_4; |
1804 | kfree(id_lstatus_buf); | ||
1805 | kfree(id_ctlr_buf); | ||
1806 | kfree(id_ldrive); | ||
1807 | return; | ||
1808 | |||
1809 | } | 1777 | } |
1810 | 1778 | ||
1811 | info_p->phys_drives = | 1779 | info_p->phys_drives = |
@@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr) | |||
1820 | log_index = log_index + 1; | 1788 | log_index = log_index + 1; |
1821 | } /* end of if logical drive configured */ | 1789 | } /* end of if logical drive configured */ |
1822 | } /* end of for log_unit */ | 1790 | } /* end of for log_unit */ |
1791 | |||
1792 | /* Free all the buffers and return */ | ||
1793 | err_4: | ||
1823 | kfree(sense_config_buf); | 1794 | kfree(sense_config_buf); |
1824 | kfree(id_ldrive); | 1795 | err_3: |
1825 | kfree(id_lstatus_buf); | 1796 | kfree(id_lstatus_buf); |
1797 | err_2: | ||
1826 | kfree(id_ctlr_buf); | 1798 | kfree(id_ctlr_buf); |
1799 | err_1: | ||
1800 | kfree(id_ldrive); | ||
1801 | err_0: | ||
1827 | return; | 1802 | return; |
1828 | |||
1829 | } | 1803 | } |
1830 | 1804 | ||
1831 | static void __exit cpqarray_exit(void) | 1805 | static void __exit cpqarray_exit(void) |
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 @@ | |||
41 | #include <linux/dma-mapping.h> | 41 | #include <linux/dma-mapping.h> |
42 | #include <linux/completion.h> | 42 | #include <linux/completion.h> |
43 | #include <linux/device.h> | 43 | #include <linux/device.h> |
44 | #include <linux/kernel.h> | ||
45 | 44 | ||
46 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
47 | #include <asm/vio.h> | 46 | #include <asm/vio.h> |
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) | |||
902 | return 0; | 902 | return 0; |
903 | } | 903 | } |
904 | 904 | ||
905 | static int ace_ioctl(struct inode *inode, struct file *filp, | 905 | static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
906 | unsigned int cmd, unsigned long arg) | ||
907 | { | 906 | { |
908 | struct ace_device *ace = inode->i_bdev->bd_disk->private_data; | 907 | struct ace_device *ace = bdev->bd_disk->private_data; |
909 | struct hd_geometry __user *geo = (struct hd_geometry __user *)arg; | ||
910 | struct hd_geometry g; | ||
911 | dev_dbg(ace->dev, "ace_ioctl()\n"); | ||
912 | |||
913 | switch (cmd) { | ||
914 | case HDIO_GETGEO: | ||
915 | g.heads = ace->cf_id.heads; | ||
916 | g.sectors = ace->cf_id.sectors; | ||
917 | g.cylinders = ace->cf_id.cyls; | ||
918 | g.start = 0; | ||
919 | return copy_to_user(geo, &g, sizeof(g)) ? -EFAULT : 0; | ||
920 | 908 | ||
921 | default: | 909 | dev_dbg(ace->dev, "ace_getgeo()\n"); |
922 | return -ENOTTY; | 910 | |
923 | } | 911 | geo->heads = ace->cf_id.heads; |
924 | return -ENOTTY; | 912 | geo->sectors = ace->cf_id.sectors; |
913 | geo->cylinders = ace->cf_id.cyls; | ||
914 | |||
915 | return 0; | ||
925 | } | 916 | } |
926 | 917 | ||
927 | static struct block_device_operations ace_fops = { | 918 | static struct block_device_operations ace_fops = { |
@@ -930,7 +921,7 @@ static struct block_device_operations ace_fops = { | |||
930 | .release = ace_release, | 921 | .release = ace_release, |
931 | .media_changed = ace_media_changed, | 922 | .media_changed = ace_media_changed, |
932 | .revalidate_disk = ace_revalidate_disk, | 923 | .revalidate_disk = ace_revalidate_disk, |
933 | .ioctl = ace_ioctl, | 924 | .getgeo = ace_getgeo, |
934 | }; | 925 | }; |
935 | 926 | ||
936 | /* -------------------------------------------------------------------- | 927 | /* -------------------------------------------------------------------- |
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, | |||
580 | /* the bio has been remapped so dispatch it */ | 580 | /* the bio has been remapped so dispatch it */ |
581 | 581 | ||
582 | blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, | 582 | blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, |
583 | tio->io->bio->bi_bdev->bd_dev, sector, | 583 | tio->io->bio->bi_bdev->bd_dev, |
584 | clone->bi_sector); | 584 | clone->bi_sector, sector); |
585 | 585 | ||
586 | generic_make_request(clone); | 586 | generic_make_request(clone); |
587 | } else if (r < 0 || r == DM_MAPIO_REQUEUE) { | 587 | } else if (r < 0 || r == DM_MAPIO_REQUEUE) { |