aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-11 19:01:06 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-11 19:01:06 -0400
commitdc8a7b11aa68d6795a46e0a42ce92220d1a6f0cd (patch)
tree7b353684090d23b1e2e3f85bf83df491f04dcc8a
parentd291676ce8bc1d8ef93488023d04027010596de3 (diff)
parent02a5e0acb3cb85d80d0fe834e366d38a92bbaa22 (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()
-rw-r--r--block/ll_rw_blk.c4
-rw-r--r--drivers/block/cciss.c16
-rw-r--r--drivers/block/cpqarray.c78
-rw-r--r--drivers/block/viodasd.c1
-rw-r--r--drivers/block/xsysace.c29
-rw-r--r--drivers/md/dm.c4
-rw-r--r--include/linux/bio.h3
-rw-r--r--include/linux/blktrace_api.h3
-rw-r--r--include/linux/fs.h1
-rw-r--r--mm/filemap.c20
10 files changed, 55 insertions, 104 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 8c2caff87cc3..a15845c164f2 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3047,6 +3047,10 @@ static inline void blk_partition_remap(struct bio *bio)
3047 3047
3048 bio->bi_sector += p->start_sect; 3048 bio->bi_sector += p->start_sect;
3049 bio->bi_bdev = bdev->bd_contains; 3049 bio->bi_bdev = bdev->bd_contains;
3050
3051 blk_add_trace_remap(bdev_get_queue(bio->bi_bdev), bio,
3052 bdev->bd_dev, bio->bi_sector,
3053 bio->bi_sector - p->start_sect);
3050 } 3054 }
3051} 3055}
3052 3056
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
2009static void 2009static 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
2044static int cciss_revalidate(struct gendisk *disk) 2044static 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 */
1793err_4:
1823 kfree(sense_config_buf); 1794 kfree(sense_config_buf);
1824 kfree(id_ldrive); 1795err_3:
1825 kfree(id_lstatus_buf); 1796 kfree(id_lstatus_buf);
1797err_2:
1826 kfree(id_ctlr_buf); 1798 kfree(id_ctlr_buf);
1799err_1:
1800 kfree(id_ldrive);
1801err_0:
1827 return; 1802 return;
1828
1829} 1803}
1830 1804
1831static void __exit cpqarray_exit(void) 1805static 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
905static int ace_ioctl(struct inode *inode, struct file *filp, 905static 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
927static struct block_device_operations ace_fops = { 918static 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) {
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4d85262b4fa4..1ddef34f43c3 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -24,6 +24,8 @@
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/ioprio.h> 25#include <linux/ioprio.h>
26 26
27#ifdef CONFIG_BLOCK
28
27/* Platforms may set this to teach the BIO layer about IOMMU hardware. */ 29/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
28#include <asm/io.h> 30#include <asm/io.h>
29 31
@@ -361,4 +363,5 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
361 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 363 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
362#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 364#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
363 365
366#endif /* CONFIG_BLOCK */
364#endif /* __LINUX_BIO_H */ 367#endif /* __LINUX_BIO_H */
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 90874a5d7d78..7b5d56b82b59 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -105,7 +105,7 @@ struct blk_io_trace {
105 */ 105 */
106struct blk_io_trace_remap { 106struct blk_io_trace_remap {
107 __be32 device; 107 __be32 device;
108 u32 __pad; 108 __be32 device_from;
109 __be64 sector; 109 __be64 sector;
110}; 110};
111 111
@@ -272,6 +272,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
272 return; 272 return;
273 273
274 r.device = cpu_to_be32(dev); 274 r.device = cpu_to_be32(dev);
275 r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
275 r.sector = cpu_to_be64(to); 276 r.sector = cpu_to_be64(to);
276 277
277 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); 278 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6bf139562947..16421f662a7a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1659,7 +1659,6 @@ extern int sb_min_blocksize(struct super_block *, int);
1659extern int generic_file_mmap(struct file *, struct vm_area_struct *); 1659extern int generic_file_mmap(struct file *, struct vm_area_struct *);
1660extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 1660extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
1661extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1661extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1662extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1663int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 1662int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
1664extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1663extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
1665extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1664extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
diff --git a/mm/filemap.c b/mm/filemap.c
index 49a6fe375d01..90b657b50f81 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1218,26 +1218,6 @@ out:
1218} 1218}
1219EXPORT_SYMBOL(generic_file_aio_read); 1219EXPORT_SYMBOL(generic_file_aio_read);
1220 1220
1221int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
1222{
1223 ssize_t written;
1224 unsigned long count = desc->count;
1225 struct file *file = desc->arg.data;
1226
1227 if (size > count)
1228 size = count;
1229
1230 written = file->f_op->sendpage(file, page, offset,
1231 size, &file->f_pos, size<count);
1232 if (written < 0) {
1233 desc->error = written;
1234 written = 0;
1235 }
1236 desc->count = count - written;
1237 desc->written += written;
1238 return written;
1239}
1240
1241static ssize_t 1221static ssize_t
1242do_readahead(struct address_space *mapping, struct file *filp, 1222do_readahead(struct address_space *mapping, struct file *filp,
1243 unsigned long index, unsigned long nr) 1223 unsigned long index, unsigned long nr)