aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-05 01:33:16 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:32:46 -0400
commit31b140398ce56ab41646eda7f02bcb78d6a4c916 (patch)
tree1cc4be44c5f94f9fe1829e5c53267f3ce9bad309 /fs
parenta6cbcd4a4a85e2fdb0b3344b88df2e8b3d526b9e (diff)
switch {__,}blockdev_direct_IO() to iov_iter
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c4
-rw-r--r--fs/btrfs/inode.c3
-rw-r--r--fs/direct-io.c33
-rw-r--r--fs/ext2/inode.c3
-rw-r--r--fs/ext3/inode.c3
-rw-r--r--fs/ext4/indirect.c7
-rw-r--r--fs/ext4/inode.c4
-rw-r--r--fs/f2fs/data.c4
-rw-r--r--fs/fat/inode.c3
-rw-r--r--fs/gfs2/aops.c2
-rw-r--r--fs/hfs/inode.c3
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/jfs/inode.c3
-rw-r--r--fs/nilfs2/inode.c4
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/reiserfs/inode.c4
-rw-r--r--fs/udf/inode.c3
-rw-r--r--fs/xfs/xfs_aops.c10
18 files changed, 43 insertions, 54 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 938fc707d769..937e3011ed58 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -171,8 +171,8 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
171 struct file *file = iocb->ki_filp; 171 struct file *file = iocb->ki_filp;
172 struct inode *inode = file->f_mapping->host; 172 struct inode *inode = file->f_mapping->host;
173 173
174 return __blockdev_direct_IO(rw, iocb, inode, I_BDEV(inode), iter->iov, 174 return __blockdev_direct_IO(rw, iocb, inode, I_BDEV(inode), iter,
175 offset, iter->nr_segs, blkdev_get_block, 175 offset, blkdev_get_block,
176 NULL, NULL, 0); 176 NULL, NULL, 0);
177} 177}
178 178
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c46a025d0c4b..b0b8fa0efba3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7483,8 +7483,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
7483 7483
7484 ret = __blockdev_direct_IO(rw, iocb, inode, 7484 ret = __blockdev_direct_IO(rw, iocb, inode,
7485 BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev, 7485 BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev,
7486 iter->iov, offset, iter->nr_segs, 7486 iter, offset, btrfs_get_blocks_direct, NULL,
7487 btrfs_get_blocks_direct, NULL,
7488 btrfs_submit_direct, flags); 7487 btrfs_submit_direct, flags);
7489 if (rw & WRITE) { 7488 if (rw & WRITE) {
7490 if (ret < 0 && ret != -EIOCBQUEUED) 7489 if (ret < 0 && ret != -EIOCBQUEUED)
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 31ba0935e32e..1c677899b989 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1107,8 +1107,8 @@ static inline int drop_refcount(struct dio *dio)
1107 */ 1107 */
1108static inline ssize_t 1108static inline ssize_t
1109do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 1109do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1110 struct block_device *bdev, const struct iovec *iov, loff_t offset, 1110 struct block_device *bdev, struct iov_iter *iter, loff_t offset,
1111 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, 1111 get_block_t get_block, dio_iodone_t end_io,
1112 dio_submit_t submit_io, int flags) 1112 dio_submit_t submit_io, int flags)
1113{ 1113{
1114 int seg; 1114 int seg;
@@ -1143,9 +1143,9 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1143 } 1143 }
1144 1144
1145 /* Check the memory alignment. Blocks cannot straddle pages */ 1145 /* Check the memory alignment. Blocks cannot straddle pages */
1146 for (seg = 0; seg < nr_segs; seg++) { 1146 for (seg = 0; seg < iter->nr_segs; seg++) {
1147 addr = (unsigned long)iov[seg].iov_base; 1147 addr = (unsigned long)iter->iov[seg].iov_base;
1148 size = iov[seg].iov_len; 1148 size = iter->iov[seg].iov_len;
1149 end += size; 1149 end += size;
1150 if (unlikely((addr & blocksize_mask) || 1150 if (unlikely((addr & blocksize_mask) ||
1151 (size & blocksize_mask))) { 1151 (size & blocksize_mask))) {
@@ -1256,18 +1256,18 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1256 if (unlikely(sdio.blkfactor)) 1256 if (unlikely(sdio.blkfactor))
1257 sdio.pages_in_io = 2; 1257 sdio.pages_in_io = 2;
1258 1258
1259 for (seg = 0; seg < nr_segs; seg++) { 1259 for (seg = 0; seg < iter->nr_segs; seg++) {
1260 user_addr = (unsigned long)iov[seg].iov_base; 1260 user_addr = (unsigned long)iter->iov[seg].iov_base;
1261 sdio.pages_in_io += 1261 sdio.pages_in_io +=
1262 ((user_addr + iov[seg].iov_len + PAGE_SIZE-1) / 1262 ((user_addr + iter->iov[seg].iov_len + PAGE_SIZE-1) /
1263 PAGE_SIZE - user_addr / PAGE_SIZE); 1263 PAGE_SIZE - user_addr / PAGE_SIZE);
1264 } 1264 }
1265 1265
1266 blk_start_plug(&plug); 1266 blk_start_plug(&plug);
1267 1267
1268 for (seg = 0; seg < nr_segs; seg++) { 1268 for (seg = 0; seg < iter->nr_segs; seg++) {
1269 user_addr = (unsigned long)iov[seg].iov_base; 1269 user_addr = (unsigned long)iter->iov[seg].iov_base;
1270 sdio.size += bytes = iov[seg].iov_len; 1270 sdio.size += bytes = iter->iov[seg].iov_len;
1271 1271
1272 /* Index into the first page of the first block */ 1272 /* Index into the first page of the first block */
1273 sdio.first_block_in_page = (user_addr & ~PAGE_MASK) >> blkbits; 1273 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,
1288 1288
1289 retval = do_direct_IO(dio, &sdio, &map_bh); 1289 retval = do_direct_IO(dio, &sdio, &map_bh);
1290 1290
1291 dio->result += iov[seg].iov_len - 1291 dio->result += iter->iov[seg].iov_len -
1292 ((sdio.final_block_in_request - sdio.block_in_file) << 1292 ((sdio.final_block_in_request - sdio.block_in_file) <<
1293 blkbits); 1293 blkbits);
1294 1294
@@ -1365,8 +1365,8 @@ out:
1365 1365
1366ssize_t 1366ssize_t
1367__blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 1367__blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1368 struct block_device *bdev, const struct iovec *iov, loff_t offset, 1368 struct block_device *bdev, struct iov_iter *iter, loff_t offset,
1369 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, 1369 get_block_t get_block, dio_iodone_t end_io,
1370 dio_submit_t submit_io, int flags) 1370 dio_submit_t submit_io, int flags)
1371{ 1371{
1372 /* 1372 /*
@@ -1381,9 +1381,8 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1381 prefetch(bdev->bd_queue); 1381 prefetch(bdev->bd_queue);
1382 prefetch((char *)bdev->bd_queue + SMP_CACHE_BYTES); 1382 prefetch((char *)bdev->bd_queue + SMP_CACHE_BYTES);
1383 1383
1384 return do_blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1384 return do_blockdev_direct_IO(rw, iocb, inode, bdev, iter, offset,
1385 nr_segs, get_block, end_io, 1385 get_block, end_io, submit_io, flags);
1386 submit_io, flags);
1387} 1386}
1388 1387
1389EXPORT_SYMBOL(__blockdev_direct_IO); 1388EXPORT_SYMBOL(__blockdev_direct_IO);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 116e809aa7cb..36d35c36311d 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -859,8 +859,7 @@ ext2_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
859 size_t count = iov_iter_count(iter); 859 size_t count = iov_iter_count(iter);
860 ssize_t ret; 860 ssize_t ret;
861 861
862 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 862 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, ext2_get_block);
863 iter->nr_segs, ext2_get_block);
864 if (ret < 0 && (rw & WRITE)) 863 if (ret < 0 && (rw & WRITE))
865 ext2_write_failed(mapping, offset + count); 864 ext2_write_failed(mapping, offset + count);
866 return ret; 865 return ret;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 8582ae2c80b0..4d32133a76c4 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1855,8 +1855,7 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
1855 } 1855 }
1856 1856
1857retry: 1857retry:
1858 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 1858 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, ext3_get_block);
1859 iter->nr_segs, ext3_get_block);
1860 /* 1859 /*
1861 * In case of error extending write may have instantiated a few 1860 * In case of error extending write may have instantiated a few
1862 * blocks outside i_size. Trim these off again. 1861 * blocks outside i_size. Trim these off again.
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index 123898a6af05..8a57e9fcd1b9 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -686,14 +686,13 @@ retry:
686 goto locked; 686 goto locked;
687 } 687 }
688 ret = __blockdev_direct_IO(rw, iocb, inode, 688 ret = __blockdev_direct_IO(rw, iocb, inode,
689 inode->i_sb->s_bdev, iter->iov, 689 inode->i_sb->s_bdev, iter, offset,
690 offset, iter->nr_segs,
691 ext4_get_block, NULL, NULL, 0); 690 ext4_get_block, NULL, NULL, 0);
692 inode_dio_done(inode); 691 inode_dio_done(inode);
693 } else { 692 } else {
694locked: 693locked:
695 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, 694 ret = blockdev_direct_IO(rw, iocb, inode, iter,
696 offset, iter->nr_segs, ext4_get_block); 695 offset, ext4_get_block);
697 696
698 if (unlikely((rw & WRITE) && ret < 0)) { 697 if (unlikely((rw & WRITE) && ret < 0)) {
699 loff_t isize = i_size_read(inode); 698 loff_t isize = i_size_read(inode);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 2b993579a968..e5718385a037 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3166,8 +3166,8 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
3166 dio_flags = DIO_LOCKING; 3166 dio_flags = DIO_LOCKING;
3167 } 3167 }
3168 ret = __blockdev_direct_IO(rw, iocb, inode, 3168 ret = __blockdev_direct_IO(rw, iocb, inode,
3169 inode->i_sb->s_bdev, iter->iov, 3169 inode->i_sb->s_bdev, iter,
3170 offset, iter->nr_segs, 3170 offset,
3171 get_block_func, 3171 get_block_func,
3172 ext4_end_io_dio, 3172 ext4_end_io_dio,
3173 NULL, 3173 NULL,
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 3a6ef121c095..151488f27755 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1022,8 +1022,8 @@ static ssize_t f2fs_direct_IO(int rw, struct kiocb *iocb,
1022 if (check_direct_IO(inode, rw, iter->iov, offset, iter->nr_segs)) 1022 if (check_direct_IO(inode, rw, iter->iov, offset, iter->nr_segs))
1023 return 0; 1023 return 0;
1024 1024
1025 return blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 1025 return blockdev_direct_IO(rw, iocb, inode, iter, offset,
1026 iter->nr_segs, get_data_block); 1026 get_data_block);
1027} 1027}
1028 1028
1029static void f2fs_invalidate_data_page(struct page *page, unsigned int offset, 1029static void f2fs_invalidate_data_page(struct page *page, unsigned int offset,
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 154a6f9d3189..385cce464e82 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -213,8 +213,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
213 * FAT need to use the DIO_LOCKING for avoiding the race 213 * FAT need to use the DIO_LOCKING for avoiding the race
214 * condition of fat_get_block() and ->truncate(). 214 * condition of fat_get_block() and ->truncate().
215 */ 215 */
216 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 216 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, fat_get_block);
217 iter->nr_segs, fat_get_block);
218 if (ret < 0 && (rw & WRITE)) 217 if (ret < 0 && (rw & WRITE))
219 fat_write_failed(mapping, offset + count); 218 fat_write_failed(mapping, offset + count);
220 219
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 228a12d2afa9..910838951d66 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -1097,7 +1097,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
1097 } 1097 }
1098 1098
1099 rv = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, 1099 rv = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
1100 iter->iov, offset, iter->nr_segs, 1100 iter, offset,
1101 gfs2_get_block_direct, NULL, NULL, 0); 1101 gfs2_get_block_direct, NULL, NULL, 0);
1102out: 1102out:
1103 gfs2_glock_dq(&gh); 1103 gfs2_glock_dq(&gh);
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index dc69e8f31581..f5fb09ebc850 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -133,8 +133,7 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb,
133 size_t count = iov_iter_count(iter); 133 size_t count = iov_iter_count(iter);
134 ssize_t ret; 134 ssize_t ret;
135 135
136 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 136 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, hfs_get_block);
137 iter->nr_segs, hfs_get_block);
138 137
139 /* 138 /*
140 * In case of error extending write may have instantiated a few 139 * In case of error extending write may have instantiated a few
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index e6b1251af47a..76b930ff58ae 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -131,7 +131,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
131 size_t count = iov_iter_count(iter); 131 size_t count = iov_iter_count(iter);
132 ssize_t ret; 132 ssize_t ret;
133 133
134 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, iter->nr_segs, 134 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset,
135 hfsplus_get_block); 135 hfsplus_get_block);
136 136
137 /* 137 /*
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 6cde5928693b..bd3df1ca3c9b 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -339,8 +339,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
339 size_t count = iov_iter_count(iter); 339 size_t count = iov_iter_count(iter);
340 ssize_t ret; 340 ssize_t ret;
341 341
342 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 342 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, jfs_get_block);
343 iter->nr_segs, jfs_get_block);
344 343
345 /* 344 /*
346 * In case of error extending write may have instantiated a few 345 * In case of error extending write may have instantiated a few
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 7aaf913e8709..6252b173a465 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -311,8 +311,8 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
311 return 0; 311 return 0;
312 312
313 /* Needs synchronization with the cleaner */ 313 /* Needs synchronization with the cleaner */
314 size = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 314 size = blockdev_direct_IO(rw, iocb, inode, iter, offset,
315 iter->nr_segs, nilfs_get_block); 315 nilfs_get_block);
316 316
317 /* 317 /*
318 * In case of error extending write may have instantiated a few 318 * In case of error extending write may have instantiated a few
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 799fd0afcb35..4a231a166cf8 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -617,7 +617,7 @@ static ssize_t ocfs2_direct_IO(int rw,
617 return 0; 617 return 0;
618 618
619 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, 619 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
620 iter->iov, offset, iter->nr_segs, 620 iter, offset,
621 ocfs2_direct_IO_get_blocks, 621 ocfs2_direct_IO_get_blocks,
622 ocfs2_dio_end_io, NULL, 0); 622 ocfs2_dio_end_io, NULL, 0);
623} 623}
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 723affe921f1..b8003e8dd1f4 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -3090,8 +3090,8 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
3090 size_t count = iov_iter_count(iter); 3090 size_t count = iov_iter_count(iter);
3091 ssize_t ret; 3091 ssize_t ret;
3092 3092
3093 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, 3093 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset,
3094 iter->nr_segs, reiserfs_get_blocks_direct_io); 3094 reiserfs_get_blocks_direct_io);
3095 3095
3096 /* 3096 /*
3097 * In case of error extending write may have instantiated a few 3097 * In case of error extending write may have instantiated a few
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 28984baf6194..236cd48184c2 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -226,8 +226,7 @@ static ssize_t udf_direct_IO(int rw, struct kiocb *iocb,
226 size_t count = iov_iter_count(iter); 226 size_t count = iov_iter_count(iter);
227 ssize_t ret; 227 ssize_t ret;
228 228
229 ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, iter->nr_segs, 229 ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, udf_get_block);
230 udf_get_block);
231 if (unlikely(ret < 0 && (rw & WRITE))) 230 if (unlikely(ret < 0 && (rw & WRITE)))
232 udf_write_failed(mapping, offset + count); 231 udf_write_failed(mapping, offset + count);
233 return ret; 232 return ret;
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 6462b3186784..08d13e395252 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1470,17 +1470,15 @@ xfs_vm_direct_IO(
1470 if (offset + size > XFS_I(inode)->i_d.di_size) 1470 if (offset + size > XFS_I(inode)->i_d.di_size)
1471 ioend->io_isdirect = 1; 1471 ioend->io_isdirect = 1;
1472 1472
1473 ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iter->iov, 1473 ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iter,
1474 offset, iter->nr_segs, 1474 offset, xfs_get_blocks_direct,
1475 xfs_get_blocks_direct,
1476 xfs_end_io_direct_write, NULL, 1475 xfs_end_io_direct_write, NULL,
1477 DIO_ASYNC_EXTEND); 1476 DIO_ASYNC_EXTEND);
1478 if (ret != -EIOCBQUEUED && iocb->private) 1477 if (ret != -EIOCBQUEUED && iocb->private)
1479 goto out_destroy_ioend; 1478 goto out_destroy_ioend;
1480 } else { 1479 } else {
1481 ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iter->iov, 1480 ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iter,
1482 offset, iter->nr_segs, 1481 offset, xfs_get_blocks_direct,
1483 xfs_get_blocks_direct,
1484 NULL, NULL, 0); 1482 NULL, NULL, 0);
1485 } 1483 }
1486 1484