diff options
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r-- | fs/direct-io.c | 33 |
1 files changed, 16 insertions, 17 deletions
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 | */ |
1108 | static inline ssize_t | 1108 | static inline ssize_t |
1109 | do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | 1109 | do_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 | ||
1366 | ssize_t | 1366 | ssize_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 | ||
1389 | EXPORT_SYMBOL(__blockdev_direct_IO); | 1388 | EXPORT_SYMBOL(__blockdev_direct_IO); |