fs: simplify the blockdev_direct_IO prototype
authorChristoph Hellwig <hch@infradead.org>
Fri, 24 Jun 2011 18:29:47 +0000 (14:29 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 21 Jul 2011 00:47:49 +0000 (20:47 -0400)
Simple filesystems always pass inode->i_sb_bdev as the block device
argument, and never need a end_io handler.  Let's simply things for
them and for my grepping activity by dropping these arguments.  The
only thing not falling into that scheme is ext4, which passes and
end_io handler without needing special flags (yet), but given how
messy the direct I/O code there is use of __blockdev_direct_IO
in one instead of two out of three cases isn't going to make a large
difference anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ext2/inode.c
fs/ext3/inode.c
fs/ext4/inode.c
fs/fat/inode.c
fs/hfs/inode.c
fs/hfsplus/inode.c
fs/jfs/inode.c
fs/nilfs2/inode.c
fs/reiserfs/inode.c
include/linux/fs.h

index 06e7c767ab35e5c70cd91757f9453654ec5496d8..a8a58f63f07caa70cb1cf92cc3531aa350945800 100644 (file)
@@ -843,8 +843,8 @@ ext2_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
        struct inode *inode = mapping->host;
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
-                               iov, offset, nr_segs, ext2_get_block, NULL);
+       ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
+                                ext2_get_block);
        if (ret < 0 && (rw & WRITE))
                ext2_write_failed(mapping, offset + iov_length(iov, nr_segs));
        return ret;
index 99c28b246b89b70ad72bcb68ffb07d59b9195fd6..2978a2a17a59b8c0e34a381f3bba4ab1b059d396 100644 (file)
@@ -1816,9 +1816,8 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
        }
 
 retry:
-       ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                                offset, nr_segs,
-                                ext3_get_block, NULL);
+       ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
+                                ext3_get_block);
        /*
         * In case of error extending write may have instantiated a few
         * blocks outside i_size. Trim these off again.
index 9ec0a2ba2502edbb76c517a147081eb0e5d643d6..1f35573a34e1de4de8c4a4a7373bead8064799ec 100644 (file)
@@ -3501,10 +3501,8 @@ retry:
                                 offset, nr_segs,
                                 ext4_get_block, NULL, NULL, 0);
        else {
-               ret = blockdev_direct_IO(rw, iocb, inode,
-                                inode->i_sb->s_bdev, iov,
-                                offset, nr_segs,
-                                ext4_get_block, NULL);
+               ret = blockdev_direct_IO(rw, iocb, inode, iov,
+                                offset, nr_segs, ext4_get_block);
 
                if (unlikely((rw & WRITE) && ret < 0)) {
                        loff_t isize = i_size_read(inode);
@@ -3748,11 +3746,13 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
                        EXT4_I(inode)->cur_aio_dio = iocb->private;
                }
 
-               ret = blockdev_direct_IO(rw, iocb, inode,
+               ret = __blockdev_direct_IO(rw, iocb, inode,
                                         inode->i_sb->s_bdev, iov,
                                         offset, nr_segs,
                                         ext4_get_block_write,
-                                        ext4_end_io_dio);
+                                        ext4_end_io_dio,
+                                        NULL,
+                                        DIO_LOCKING | DIO_SKIP_HOLES);
                if (iocb->private)
                        EXT4_I(inode)->cur_aio_dio = NULL;
                /*
index 3decce46c38f867b46ea77c0bba4d547711aba07..5942fec22c65ddacec9efd25467ae039784884c6 100644 (file)
@@ -211,8 +211,8 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
         * FAT need to use the DIO_LOCKING for avoiding the race
         * condition of fat_get_block() and ->truncate().
         */
-       ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
-                                iov, offset, nr_segs, fat_get_block, NULL);
+       ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
+                                fat_get_block);
        if (ret < 0 && (rw & WRITE))
                fat_write_failed(mapping, offset + iov_length(iov, nr_segs));
 
index 48d567cc203e54c4ff81d5ce32236a2304293ea1..5e7c3f3096170c97f0c8d648fc139c9867dae445 100644 (file)
@@ -123,8 +123,8 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb,
        struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                                 offset, nr_segs, hfs_get_block, NULL);
+       ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
+                                hfs_get_block);
 
        /*
         * In case of error extending write may have instantiated a few
index b0a0a4b621eb465a1ea5a03bc48c97fae70c51d7..5b1cb98741cc5e7d6e003ca1db989300d5cc8fd3 100644 (file)
@@ -119,8 +119,8 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
        struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                                 offset, nr_segs, hfsplus_get_block, NULL);
+       ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
+                                hfsplus_get_block);
 
        /*
         * In case of error extending write may have instantiated a few
index 109655904bbcde5ecb62513c5a8712da7486bce6..77b69b27f825e877f45bb3a97f9f21887d92d764 100644 (file)
@@ -329,8 +329,8 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
        struct inode *inode = file->f_mapping->host;
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                               offset, nr_segs, jfs_get_block, NULL);
+       ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
+                                jfs_get_block);
 
        /*
         * In case of error extending write may have instantiated a few
index 13f113154a9fcfea1063a6e413abebb57b6f5493..666628b395f136447f5d27482234f69e0190a90c 100644 (file)
@@ -259,8 +259,8 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
                return 0;
 
        /* Needs synchronization with the cleaner */
-       size = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                                 offset, nr_segs, nilfs_get_block, NULL);
+       size = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
+                                 nilfs_get_block);
 
        /*
         * In case of error extending write may have instantiated a few
index dcf543d8caf14cf19df050889bdd17035ea446f0..2922b90ceac1a799daa881dfbc3ed991ed2664c2 100644 (file)
@@ -3068,9 +3068,8 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
        struct inode *inode = file->f_mapping->host;
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                                 offset, nr_segs,
-                                 reiserfs_get_blocks_direct_io, NULL);
+       ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
+                                 reiserfs_get_blocks_direct_io);
 
        /*
         * In case of error extending write may have instantiated a few
index 2fe920774abfb12c04edd96cb9a02ab4041e92a5..824453be9feeb2653cabd7abd02e597fb2500d3e 100644 (file)
@@ -2418,12 +2418,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
        dio_submit_t submit_io, int flags);
 
 static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
-       struct inode *inode, struct block_device *bdev, const struct iovec *iov,
-       loff_t offset, unsigned long nr_segs, get_block_t get_block,
-       dio_iodone_t end_io)
+               struct inode *inode, const struct iovec *iov, loff_t offset,
+               unsigned long nr_segs, get_block_t get_block)
 {
-       return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
-                                   nr_segs, get_block, end_io, NULL,
+       return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
+                                   offset, nr_segs, get_block, NULL, NULL,
                                    DIO_LOCKING | DIO_SKIP_HOLES);
 }
 #endif