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()

+57 -106
+4
block/ll_rw_blk.c
··· 3047 3048 bio->bi_sector += p->start_sect; 3049 bio->bi_bdev = bdev->bd_contains; 3050 } 3051 } 3052
··· 3047 3048 bio->bi_sector += p->start_sect; 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); 3054 } 3055 } 3056
+8 -8
drivers/block/cciss.c
··· 1977 { 1978 ReadCapdata_struct *buf; 1979 int return_code; 1980 - buf = kmalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); 1981 - if (buf == NULL) { 1982 printk(KERN_WARNING "cciss: out of memory\n"); 1983 return; 1984 } 1985 - memset(buf, 0, sizeof(ReadCapdata_struct)); 1986 if (withirq) 1987 return_code = sendcmd_withirq(CCISS_READ_CAPACITY, 1988 ctlr, buf, sizeof(ReadCapdata_struct), ··· 2004 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2005 (unsigned long long)*total_size+1, *block_size); 2006 kfree(buf); 2007 - return; 2008 } 2009 2010 static void ··· 2011 { 2012 ReadCapdata_struct_16 *buf; 2013 int return_code; 2014 - buf = kmalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); 2015 - if (buf == NULL) { 2016 printk(KERN_WARNING "cciss: out of memory\n"); 2017 return; 2018 } 2019 - memset(buf, 0, sizeof(ReadCapdata_struct_16)); 2020 if (withirq) { 2021 return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, 2022 ctlr, buf, sizeof(ReadCapdata_struct_16), ··· 2039 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2040 (unsigned long long)*total_size+1, *block_size); 2041 kfree(buf); 2042 - return; 2043 } 2044 2045 static int cciss_revalidate(struct gendisk *disk)
··· 1977 { 1978 ReadCapdata_struct *buf; 1979 int return_code; 1980 + 1981 + buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); 1982 + if (!buf) { 1983 printk(KERN_WARNING "cciss: out of memory\n"); 1984 return; 1985 } 1986 + 1987 if (withirq) 1988 return_code = sendcmd_withirq(CCISS_READ_CAPACITY, 1989 ctlr, buf, sizeof(ReadCapdata_struct), ··· 2003 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2004 (unsigned long long)*total_size+1, *block_size); 2005 kfree(buf); 2006 } 2007 2008 static void ··· 2011 { 2012 ReadCapdata_struct_16 *buf; 2013 int return_code; 2014 + 2015 + buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); 2016 + if (!buf) { 2017 printk(KERN_WARNING "cciss: out of memory\n"); 2018 return; 2019 } 2020 + 2021 if (withirq) { 2022 return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, 2023 ctlr, buf, sizeof(ReadCapdata_struct_16), ··· 2038 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2039 (unsigned long long)*total_size+1, *block_size); 2040 kfree(buf); 2041 } 2042 2043 static int cciss_revalidate(struct gendisk *disk)
+29 -55
drivers/block/cpqarray.c
··· 420 goto Enomem2; 421 } 422 423 - hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent( 424 hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), 425 &(hba[i]->cmd_pool_dhandle)); 426 - hba[i]->cmd_pool_bits = kmalloc( 427 - ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long), 428 GFP_KERNEL); 429 430 if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) 431 goto Enomem1; 432 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", 436 hba[i]->devname); 437 ··· 1659 1660 info_p->log_drv_map = 0; 1661 1662 - id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); 1663 - if(id_ldrive == NULL) 1664 - { 1665 printk( KERN_ERR "cpqarray: out of memory.\n"); 1666 - return; 1667 } 1668 1669 - id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); 1670 - if(id_ctlr_buf == NULL) 1671 - { 1672 - kfree(id_ldrive); 1673 printk( KERN_ERR "cpqarray: out of memory.\n"); 1674 - return; 1675 } 1676 1677 - id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); 1678 - if(id_lstatus_buf == NULL) 1679 - { 1680 - kfree(id_ctlr_buf); 1681 - kfree(id_ldrive); 1682 printk( KERN_ERR "cpqarray: out of memory.\n"); 1683 - return; 1684 } 1685 1686 - sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL); 1687 - if(sense_config_buf == NULL) 1688 - { 1689 - kfree(id_lstatus_buf); 1690 - kfree(id_ctlr_buf); 1691 - kfree(id_ldrive); 1692 printk( KERN_ERR "cpqarray: out of memory.\n"); 1693 - return; 1694 } 1695 - 1696 - memset(id_ldrive, 0, sizeof(id_log_drv_t)); 1697 - memset(id_ctlr_buf, 0, sizeof(id_ctlr_t)); 1698 - memset(id_lstatus_buf, 0, sizeof(sense_log_drv_stat_t)); 1699 - memset(sense_config_buf, 0, sizeof(config_t)); 1700 1701 info_p->phys_drives = 0; 1702 info_p->log_drv_map = 0; ··· 1696 * so the idastubopen will fail on all logical drives 1697 * on the controller. 1698 */ 1699 - /* Free all the buffers and return */ 1700 printk(KERN_ERR "cpqarray: error sending ID controller\n"); 1701 - kfree(sense_config_buf); 1702 - kfree(id_lstatus_buf); 1703 - kfree(id_ctlr_buf); 1704 - kfree(id_ldrive); 1705 - return; 1706 } 1707 1708 info_p->log_drives = id_ctlr_buf->nr_drvs; ··· 1743 " failed to report status of logical drive %d\n" 1744 "Access to this controller has been disabled\n", 1745 ctlr, log_unit); 1746 - /* Free all the buffers and return */ 1747 - kfree(sense_config_buf); 1748 - kfree(id_lstatus_buf); 1749 - kfree(id_ctlr_buf); 1750 - kfree(id_ldrive); 1751 - return; 1752 } 1753 /* 1754 Make sure the logical drive is configured ··· 1772 sizeof(config_t), 0, 0, log_unit); 1773 if (ret_code == IO_ERROR) { 1774 info_p->log_drv_map = 0; 1775 - /* Free all the buffers and return */ 1776 printk(KERN_ERR "cpqarray: error sending sense config\n"); 1777 - kfree(sense_config_buf); 1778 - kfree(id_lstatus_buf); 1779 - kfree(id_ctlr_buf); 1780 - kfree(id_ldrive); 1781 - return; 1782 - 1783 } 1784 1785 info_p->phys_drives = ··· 1788 log_index = log_index + 1; 1789 } /* end of if logical drive configured */ 1790 } /* end of for log_unit */ 1791 - kfree(sense_config_buf); 1792 - kfree(id_ldrive); 1793 - kfree(id_lstatus_buf); 1794 - kfree(id_ctlr_buf); 1795 - return; 1796 1797 } 1798 1799 static void __exit cpqarray_exit(void)
··· 420 goto Enomem2; 421 } 422 423 + hba[i]->cmd_pool = pci_alloc_consistent( 424 hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), 425 &(hba[i]->cmd_pool_dhandle)); 426 + hba[i]->cmd_pool_bits = kcalloc( 427 + (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long), 428 GFP_KERNEL); 429 430 if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) 431 goto Enomem1; 432 433 memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t)); 434 printk(KERN_INFO "cpqarray: Finding drives on %s", 435 hba[i]->devname); 436 ··· 1660 1661 info_p->log_drv_map = 0; 1662 1663 + id_ldrive = kzalloc(sizeof(id_log_drv_t), GFP_KERNEL); 1664 + if (!id_ldrive) { 1665 printk( KERN_ERR "cpqarray: out of memory.\n"); 1666 + goto err_0; 1667 } 1668 1669 + id_ctlr_buf = kzalloc(sizeof(id_ctlr_t), GFP_KERNEL); 1670 + if (!id_ctlr_buf) { 1671 printk( KERN_ERR "cpqarray: out of memory.\n"); 1672 + goto err_1; 1673 } 1674 1675 + id_lstatus_buf = kzalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); 1676 + if (!id_lstatus_buf) { 1677 printk( KERN_ERR "cpqarray: out of memory.\n"); 1678 + goto err_2; 1679 } 1680 1681 + sense_config_buf = kzalloc(sizeof(config_t), GFP_KERNEL); 1682 + if (!sense_config_buf) { 1683 printk( KERN_ERR "cpqarray: out of memory.\n"); 1684 + goto err_3; 1685 } 1686 1687 info_p->phys_drives = 0; 1688 info_p->log_drv_map = 0; ··· 1712 * so the idastubopen will fail on all logical drives 1713 * on the controller. 1714 */ 1715 printk(KERN_ERR "cpqarray: error sending ID controller\n"); 1716 + goto err_4; 1717 } 1718 1719 info_p->log_drives = id_ctlr_buf->nr_drvs; ··· 1764 " failed to report status of logical drive %d\n" 1765 "Access to this controller has been disabled\n", 1766 ctlr, log_unit); 1767 + goto err_4; 1768 } 1769 /* 1770 Make sure the logical drive is configured ··· 1798 sizeof(config_t), 0, 0, log_unit); 1799 if (ret_code == IO_ERROR) { 1800 info_p->log_drv_map = 0; 1801 printk(KERN_ERR "cpqarray: error sending sense config\n"); 1802 + goto err_4; 1803 } 1804 1805 info_p->phys_drives = ··· 1820 log_index = log_index + 1; 1821 } /* end of if logical drive configured */ 1822 } /* end of for log_unit */ 1823 1824 + /* Free all the buffers and return */ 1825 + err_4: 1826 + kfree(sense_config_buf); 1827 + err_3: 1828 + kfree(id_lstatus_buf); 1829 + err_2: 1830 + kfree(id_ctlr_buf); 1831 + err_1: 1832 + kfree(id_ldrive); 1833 + err_0: 1834 + return; 1835 } 1836 1837 static void __exit cpqarray_exit(void)
-1
drivers/block/viodasd.c
··· 41 #include <linux/dma-mapping.h> 42 #include <linux/completion.h> 43 #include <linux/device.h> 44 - #include <linux/kernel.h> 45 46 #include <asm/uaccess.h> 47 #include <asm/vio.h>
··· 41 #include <linux/dma-mapping.h> 42 #include <linux/completion.h> 43 #include <linux/device.h> 44 45 #include <asm/uaccess.h> 46 #include <asm/vio.h>
+9 -18
drivers/block/xsysace.c
··· 902 return 0; 903 } 904 905 - static int ace_ioctl(struct inode *inode, struct file *filp, 906 - unsigned int cmd, unsigned long arg) 907 { 908 - struct ace_device *ace = inode->i_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 921 - default: 922 - return -ENOTTY; 923 - } 924 - return -ENOTTY; 925 } 926 927 static struct block_device_operations ace_fops = { ··· 921 .release = ace_release, 922 .media_changed = ace_media_changed, 923 .revalidate_disk = ace_revalidate_disk, 924 - .ioctl = ace_ioctl, 925 }; 926 927 /* --------------------------------------------------------------------
··· 902 return 0; 903 } 904 905 + static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) 906 { 907 + struct ace_device *ace = bdev->bd_disk->private_data; 908 909 + dev_dbg(ace->dev, "ace_getgeo()\n"); 910 911 + geo->heads = ace->cf_id.heads; 912 + geo->sectors = ace->cf_id.sectors; 913 + geo->cylinders = ace->cf_id.cyls; 914 + 915 + return 0; 916 } 917 918 static struct block_device_operations ace_fops = { ··· 930 .release = ace_release, 931 .media_changed = ace_media_changed, 932 .revalidate_disk = ace_revalidate_disk, 933 + .getgeo = ace_getgeo, 934 }; 935 936 /* --------------------------------------------------------------------
+2 -2
drivers/md/dm.c
··· 580 /* the bio has been remapped so dispatch it */ 581 582 blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, 583 - tio->io->bio->bi_bdev->bd_dev, sector, 584 - clone->bi_sector); 585 586 generic_make_request(clone); 587 } else if (r < 0 || r == DM_MAPIO_REQUEUE) {
··· 580 /* the bio has been remapped so dispatch it */ 581 582 blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, 583 + tio->io->bio->bi_bdev->bd_dev, 584 + clone->bi_sector, sector); 585 586 generic_make_request(clone); 587 } else if (r < 0 || r == DM_MAPIO_REQUEUE) {
+3
include/linux/bio.h
··· 24 #include <linux/mempool.h> 25 #include <linux/ioprio.h> 26 27 /* Platforms may set this to teach the BIO layer about IOMMU hardware. */ 28 #include <asm/io.h> 29 ··· 363 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 364 #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 365 366 #endif /* __LINUX_BIO_H */
··· 24 #include <linux/mempool.h> 25 #include <linux/ioprio.h> 26 27 + #ifdef CONFIG_BLOCK 28 + 29 /* Platforms may set this to teach the BIO layer about IOMMU hardware. */ 30 #include <asm/io.h> 31 ··· 361 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 362 #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 363 364 + #endif /* CONFIG_BLOCK */ 365 #endif /* __LINUX_BIO_H */
+2 -1
include/linux/blktrace_api.h
··· 105 */ 106 struct blk_io_trace_remap { 107 __be32 device; 108 - u32 __pad; 109 __be64 sector; 110 }; 111 ··· 272 return; 273 274 r.device = cpu_to_be32(dev); 275 r.sector = cpu_to_be64(to); 276 277 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
··· 105 */ 106 struct blk_io_trace_remap { 107 __be32 device; 108 + __be32 device_from; 109 __be64 sector; 110 }; 111 ··· 272 return; 273 274 r.device = cpu_to_be32(dev); 275 + r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev); 276 r.sector = cpu_to_be64(to); 277 278 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
-1
include/linux/fs.h
··· 1659 extern int generic_file_mmap(struct file *, struct vm_area_struct *); 1660 extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 1661 extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1662 - extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1663 int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 1664 extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1665 extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
··· 1659 extern int generic_file_mmap(struct file *, struct vm_area_struct *); 1660 extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 1661 extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1662 int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 1663 extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1664 extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
-20
mm/filemap.c
··· 1218 } 1219 EXPORT_SYMBOL(generic_file_aio_read); 1220 1221 - int 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 - 1241 static ssize_t 1242 do_readahead(struct address_space *mapping, struct file *filp, 1243 unsigned long index, unsigned long nr)
··· 1218 } 1219 EXPORT_SYMBOL(generic_file_aio_read); 1220 1221 static ssize_t 1222 do_readahead(struct address_space *mapping, struct file *filp, 1223 unsigned long index, unsigned long nr)