switch {__,}blockdev_direct_IO() to iov_iter
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 5 Mar 2014 06:33:16 +0000 (01:33 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 6 May 2014 21:32:46 +0000 (17:32 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
19 files changed:
fs/block_dev.c
fs/btrfs/inode.c
fs/direct-io.c
fs/ext2/inode.c
fs/ext3/inode.c
fs/ext4/indirect.c
fs/ext4/inode.c
fs/f2fs/data.c
fs/fat/inode.c
fs/gfs2/aops.c
fs/hfs/inode.c
fs/hfsplus/inode.c
fs/jfs/inode.c
fs/nilfs2/inode.c
fs/ocfs2/aops.c
fs/reiserfs/inode.c
fs/udf/inode.c
fs/xfs/xfs_aops.c
include/linux/fs.h

index 938fc707d769fd06a13d96265714ebb053587605..937e3011ed58d80c04312915f61b664435dd5427 100644 (file)
@@ -171,8 +171,8 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
        struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_mapping->host;
 
-       return __blockdev_direct_IO(rw, iocb, inode, I_BDEV(inode), iter->iov,
-                                   offset, iter->nr_segs, blkdev_get_block,
+       return __blockdev_direct_IO(rw, iocb, inode, I_BDEV(inode), iter,
+                                   offset, blkdev_get_block,
                                    NULL, NULL, 0);
 }
 
index c46a025d0c4b0482d028ee48c63f2bb21df95152..b0b8fa0efba3f32c8b90d129ef3be884b3eb46d0 100644 (file)
@@ -7483,8 +7483,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
 
        ret = __blockdev_direct_IO(rw, iocb, inode,
                        BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev,
-                       iter->iov, offset, iter->nr_segs,
-                       btrfs_get_blocks_direct, NULL,
+                       iter, offset, btrfs_get_blocks_direct, NULL,
                        btrfs_submit_direct, flags);
        if (rw & WRITE) {
                if (ret < 0 && ret != -EIOCBQUEUED)
index 31ba0935e32ed2f271253a1d828778a91193b211..1c677899b9894e84c4fb96247fc02e96d0630351 100644 (file)
@@ -1107,8 +1107,8 @@ static inline int drop_refcount(struct dio *dio)
  */
 static inline ssize_t
 do_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 block_device *bdev, struct iov_iter *iter, loff_t offset, 
+       get_block_t get_block, dio_iodone_t end_io,
        dio_submit_t submit_io, int flags)
 {
        int seg;
@@ -1143,9 +1143,9 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
        }
 
        /* Check the memory alignment.  Blocks cannot straddle pages */
-       for (seg = 0; seg < nr_segs; seg++) {
-               addr = (unsigned long)iov[seg].iov_base;
-               size = iov[seg].iov_len;
+       for (seg = 0; seg < iter->nr_segs; seg++) {
+               addr = (unsigned long)iter->iov[seg].iov_base;
+               size = iter->iov[seg].iov_len;
                end += size;
                if (unlikely((addr & blocksize_mask) ||
                             (size & blocksize_mask))) {
@@ -1256,18 +1256,18 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
        if (unlikely(sdio.blkfactor))
                sdio.pages_in_io = 2;
 
-       for (seg = 0; seg < nr_segs; seg++) {
-               user_addr = (unsigned long)iov[seg].iov_base;
+       for (seg = 0; seg < iter->nr_segs; seg++) {
+               user_addr = (unsigned long)iter->iov[seg].iov_base;
                sdio.pages_in_io +=
-                       ((user_addr + iov[seg].iov_len + PAGE_SIZE-1) /
+                       ((user_addr + iter->iov[seg].iov_len + PAGE_SIZE-1) /
                                PAGE_SIZE - user_addr / PAGE_SIZE);
        }
 
        blk_start_plug(&plug);
 
-       for (seg = 0; seg < nr_segs; seg++) {
-               user_addr = (unsigned long)iov[seg].iov_base;
-               sdio.size += bytes = iov[seg].iov_len;
+       for (seg = 0; seg < iter->nr_segs; seg++) {
+               user_addr = (unsigned long)iter->iov[seg].iov_base;
+               sdio.size += bytes = iter->iov[seg].iov_len;
 
                /* Index into the first page of the first block */
                sdio.first_block_in_page = (user_addr & ~PAGE_MASK) >> blkbits;
@@ -1288,7 +1288,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
 
                retval = do_direct_IO(dio, &sdio, &map_bh);
 
-               dio->result += iov[seg].iov_len -
+               dio->result += iter->iov[seg].iov_len -
                        ((sdio.final_block_in_request - sdio.block_in_file) <<
                                        blkbits);
 
@@ -1365,8 +1365,8 @@ out:
 
 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 block_device *bdev, struct iov_iter *iter, loff_t offset,
+       get_block_t get_block, dio_iodone_t end_io,
        dio_submit_t submit_io, int flags)
 {
        /*
@@ -1381,9 +1381,8 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
        prefetch(bdev->bd_queue);
        prefetch((char *)bdev->bd_queue + SMP_CACHE_BYTES);
 
-       return do_blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
-                                    nr_segs, get_block, end_io,
-                                    submit_io, flags);
+       return do_blockdev_direct_IO(rw, iocb, inode, bdev, iter, offset,
+                                    get_block, end_io, submit_io, flags);
 }
 
 EXPORT_SYMBOL(__blockdev_direct_IO);
index 116e809aa7cbbf2b4cfa53420958cd50f1a0718e..36d35c36311d69a025c5b804e8d8597cbd9cb2b2 100644 (file)
@@ -859,8 +859,7 @@ ext2_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
        size_t count = iov_iter_count(iter);
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset,
-                                iter->nr_segs, ext2_get_block);
+       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, ext2_get_block);
        if (ret < 0 && (rw & WRITE))
                ext2_write_failed(mapping, offset + count);
        return ret;
index 8582ae2c80b06912c11f24f424766fb41da1a54c..4d32133a76c4bbfd0393528f8ad463bf239bf354 100644 (file)
@@ -1855,8 +1855,7 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
        }
 
 retry:
-       ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset,
-                                iter->nr_segs, ext3_get_block);
+       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, ext3_get_block);
        /*
         * In case of error extending write may have instantiated a few
         * blocks outside i_size. Trim these off again.
index 123898a6af05ecaa60de6cee658595d6db75beae..8a57e9fcd1b987bdab029e7658ae100d10949d5a 100644 (file)
@@ -686,14 +686,13 @@ retry:
                        goto locked;
                }
                ret = __blockdev_direct_IO(rw, iocb, inode,
-                                inode->i_sb->s_bdev, iter->iov,
-                                offset, iter->nr_segs,
+                                inode->i_sb->s_bdev, iter, offset,
                                 ext4_get_block, NULL, NULL, 0);
                inode_dio_done(inode);
        } else {
 locked:
-               ret = blockdev_direct_IO(rw, iocb, inode, iter->iov,
-                                offset, iter->nr_segs, ext4_get_block);
+               ret = blockdev_direct_IO(rw, iocb, inode, iter,
+                                offset, ext4_get_block);
 
                if (unlikely((rw & WRITE) && ret < 0)) {
                        loff_t isize = i_size_read(inode);
index 2b993579a96819b117fd9d9a37cf51b2aae585d9..e5718385a037c7254fa5e2735acc50e5ea5575b8 100644 (file)
@@ -3166,8 +3166,8 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
                dio_flags = DIO_LOCKING;
        }
        ret = __blockdev_direct_IO(rw, iocb, inode,
-                                  inode->i_sb->s_bdev, iter->iov,
-                                  offset, iter->nr_segs,
+                                  inode->i_sb->s_bdev, iter,
+                                  offset,
                                   get_block_func,
                                   ext4_end_io_dio,
                                   NULL,
index 3a6ef121c09511c0f90ea10a2201f9b7140e2cd4..151488f27755282d24ee149d8df753aacf677c89 100644 (file)
@@ -1022,8 +1022,8 @@ static ssize_t f2fs_direct_IO(int rw, struct kiocb *iocb,
        if (check_direct_IO(inode, rw, iter->iov, offset, iter->nr_segs))
                return 0;
 
-       return blockdev_direct_IO(rw, iocb, inode, iter->iov, offset,
-                                 iter->nr_segs, get_data_block);
+       return blockdev_direct_IO(rw, iocb, inode, iter, offset,
+                                 get_data_block);
 }
 
 static void f2fs_invalidate_data_page(struct page *page, unsigned int offset,
index 154a6f9d3189c4bd7c5008cf742d3a34ebb762a0..385cce464e822a3a9de91113d1b314482670965f 100644 (file)
@@ -213,8 +213,7 @@ 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, iter->iov, offset,
-                                iter->nr_segs, fat_get_block);
+       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, fat_get_block);
        if (ret < 0 && (rw & WRITE))
                fat_write_failed(mapping, offset + count);
 
index 228a12d2afa9aedf3bc4a60e653d54e881f93bf2..910838951d66c375d9c7a2b38fd4a225c45245b0 100644 (file)
@@ -1097,7 +1097,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
        }
 
        rv = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
-                                 iter->iov, offset, iter->nr_segs,
+                                 iter, offset,
                                  gfs2_get_block_direct, NULL, NULL, 0);
 out:
        gfs2_glock_dq(&gh);
index dc69e8f315818bd6e05a40200240637399391c27..f5fb09ebc8501fd5f0f1c4eda48e6d55fc2a4c7f 100644 (file)
@@ -133,8 +133,7 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb,
        size_t count = iov_iter_count(iter);
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset,
-                                iter->nr_segs, hfs_get_block);
+       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, hfs_get_block);
 
        /*
         * In case of error extending write may have instantiated a few
index e6b1251af47aece2f704bf3ece196709f91083eb..76b930ff58aeb415624de0b20a76785036c2f0a1 100644 (file)
@@ -131,7 +131,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
        size_t count = iov_iter_count(iter);
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, iter->nr_segs,
+       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, 
                                 hfsplus_get_block);
 
        /*
index 6cde5928693bb48dde5520361a716dee8bdc6cba..bd3df1ca3c9b7f955571c056f86f98e97beda7b9 100644 (file)
@@ -339,8 +339,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
        size_t count = iov_iter_count(iter);
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset,
-                                iter->nr_segs, jfs_get_block);
+       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, jfs_get_block);
 
        /*
         * In case of error extending write may have instantiated a few
index 7aaf913e8709a0145c44754234b3635b7b5b8a5c..6252b173a46590225e2ba29f7e07cf13aa62eeac 100644 (file)
@@ -311,8 +311,8 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
                return 0;
 
        /* Needs synchronization with the cleaner */
-       size = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset,
-                                 iter->nr_segs, nilfs_get_block);
+       size = blockdev_direct_IO(rw, iocb, inode, iter, offset,
+                                 nilfs_get_block);
 
        /*
         * In case of error extending write may have instantiated a few
index 799fd0afcb356d0b6cc25ec7cc9fb21e411de29b..4a231a166cf88d6f76495ab9420e7406ba10307a 100644 (file)
@@ -617,7 +617,7 @@ static ssize_t ocfs2_direct_IO(int rw,
                return 0;
 
        return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
-                                   iter->iov, offset, iter->nr_segs,
+                                   iter, offset,
                                    ocfs2_direct_IO_get_blocks,
                                    ocfs2_dio_end_io, NULL, 0);
 }
index 723affe921f1bdfc6104000c62535fbc10b29403..b8003e8dd1f47bf726d78a1f1a40aba7a56ecc30 100644 (file)
@@ -3090,8 +3090,8 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
        size_t count = iov_iter_count(iter);
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset,
-                                iter->nr_segs, reiserfs_get_blocks_direct_io);
+       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset,
+                                reiserfs_get_blocks_direct_io);
 
        /*
         * In case of error extending write may have instantiated a few
index 28984baf61949d15adf355035da0df2d21e526d9..236cd48184c2df20e75bc9fee098ded782f2560f 100644 (file)
@@ -226,8 +226,7 @@ static ssize_t udf_direct_IO(int rw, struct kiocb *iocb,
        size_t count = iov_iter_count(iter);
        ssize_t ret;
 
-       ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, iter->nr_segs,
-                                 udf_get_block);
+       ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, udf_get_block);
        if (unlikely(ret < 0 && (rw & WRITE)))
                udf_write_failed(mapping, offset + count);
        return ret;
index 6462b3186784bb7af25759e3aa2223deeb2ea612..08d13e3952524fdfef6fea570955e51eec3824e4 100644 (file)
@@ -1470,17 +1470,15 @@ xfs_vm_direct_IO(
                if (offset + size > XFS_I(inode)->i_d.di_size)
                        ioend->io_isdirect = 1;
 
-               ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iter->iov,
-                                           offset, iter->nr_segs,
-                                           xfs_get_blocks_direct,
+               ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iter,
+                                           offset, xfs_get_blocks_direct,
                                            xfs_end_io_direct_write, NULL,
                                            DIO_ASYNC_EXTEND);
                if (ret != -EIOCBQUEUED && iocb->private)
                        goto out_destroy_ioend;
        } else {
-               ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iter->iov,
-                                           offset, iter->nr_segs,
-                                           xfs_get_blocks_direct,
+               ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iter,
+                                           offset, xfs_get_blocks_direct,
                                            NULL, NULL, 0);
        }
 
index 399a338c92b5b3c73911c878531062f2134c085f..946a9484844ffcbca689669cb847d703a59a966a 100644 (file)
@@ -2474,16 +2474,16 @@ enum {
 void dio_end_io(struct bio *bio, int error);
 
 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 block_device *bdev, struct iov_iter *iter, loff_t offset,
+       get_block_t get_block, dio_iodone_t end_io,
        dio_submit_t submit_io, int flags);
 
 static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
-               struct inode *inode, const struct iovec *iov, loff_t offset,
-               unsigned long nr_segs, get_block_t get_block)
+               struct inode *inode, struct iov_iter *iter, loff_t offset,
+               get_block_t get_block)
 {
-       return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-                                   offset, nr_segs, get_block, NULL, NULL,
+       return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iter,
+                                   offset, get_block, NULL, NULL,
                                    DIO_LOCKING | DIO_SKIP_HOLES);
 }
 #endif