diff options
author | Omar Sandoval <osandov@osandov.com> | 2015-03-16 07:33:50 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:29:44 -0400 |
commit | 17f8c842d24ac054e4212c82b5bd6ae455a334f3 (patch) | |
tree | db8e5831159db867f34280200f81d4eadbec74a4 | |
parent | bd8e0ff956456ad9071dbb6c2ed7d33bd22fc216 (diff) |
Remove rw from {,__,do_}blockdev_direct_IO()
Most filesystems call through to these at some point, so we'll start
here.
Signed-off-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/affs/file.c | 2 | ||||
-rw-r--r-- | fs/block_dev.c | 5 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 8 | ||||
-rw-r--r-- | fs/direct-io.c | 39 | ||||
-rw-r--r-- | fs/ext2/inode.c | 2 | ||||
-rw-r--r-- | fs/ext3/inode.c | 2 | ||||
-rw-r--r-- | fs/ext4/indirect.c | 11 | ||||
-rw-r--r-- | fs/ext4/inode.c | 2 | ||||
-rw-r--r-- | fs/f2fs/data.c | 2 | ||||
-rw-r--r-- | fs/fat/inode.c | 2 | ||||
-rw-r--r-- | fs/gfs2/aops.c | 5 | ||||
-rw-r--r-- | fs/hfs/inode.c | 2 | ||||
-rw-r--r-- | fs/hfsplus/inode.c | 3 | ||||
-rw-r--r-- | fs/jfs/inode.c | 2 | ||||
-rw-r--r-- | fs/nilfs2/inode.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/aops.c | 16 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 2 | ||||
-rw-r--r-- | fs/udf/inode.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_aops.c | 9 | ||||
-rw-r--r-- | include/linux/fs.h | 22 |
20 files changed, 67 insertions, 74 deletions
diff --git a/fs/affs/file.c b/fs/affs/file.c index 7c1a3d4c19c2..1edc0d4b40db 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -405,7 +405,7 @@ affs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
405 | return 0; | 405 | return 0; |
406 | } | 406 | } |
407 | 407 | ||
408 | ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block); | 408 | ret = blockdev_direct_IO(iocb, inode, iter, offset, affs_get_block); |
409 | if (ret < 0 && (rw & WRITE)) | 409 | if (ret < 0 && (rw & WRITE)) |
410 | affs_write_failed(mapping, offset + count); | 410 | affs_write_failed(mapping, offset + count); |
411 | return ret; | 411 | return ret; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index b5e87896f517..bc23afd35fdb 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -152,9 +152,8 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
152 | struct file *file = iocb->ki_filp; | 152 | struct file *file = iocb->ki_filp; |
153 | struct inode *inode = file->f_mapping->host; | 153 | struct inode *inode = file->f_mapping->host; |
154 | 154 | ||
155 | return __blockdev_direct_IO(rw, iocb, inode, I_BDEV(inode), iter, | 155 | return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset, |
156 | offset, blkdev_get_block, | 156 | blkdev_get_block, NULL, NULL, 0); |
157 | NULL, NULL, 0); | ||
158 | } | 157 | } |
159 | 158 | ||
160 | int __sync_blockdev(struct block_device *bdev, int wait) | 159 | int __sync_blockdev(struct block_device *bdev, int wait) |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 686331f22b15..e9a3ff8a85fd 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -8174,10 +8174,10 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
8174 | wakeup = false; | 8174 | wakeup = false; |
8175 | } | 8175 | } |
8176 | 8176 | ||
8177 | ret = __blockdev_direct_IO(rw, iocb, inode, | 8177 | ret = __blockdev_direct_IO(iocb, inode, |
8178 | BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev, | 8178 | BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev, |
8179 | iter, offset, btrfs_get_blocks_direct, NULL, | 8179 | iter, offset, btrfs_get_blocks_direct, NULL, |
8180 | btrfs_submit_direct, flags); | 8180 | btrfs_submit_direct, flags); |
8181 | if (rw & WRITE) { | 8181 | if (rw & WRITE) { |
8182 | current->journal_info = NULL; | 8182 | current->journal_info = NULL; |
8183 | if (ret < 0 && ret != -EIOCBQUEUED) | 8183 | if (ret < 0 && ret != -EIOCBQUEUED) |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 6fb00e3f1059..c3b560b24a46 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -1093,10 +1093,10 @@ static inline int drop_refcount(struct dio *dio) | |||
1093 | * for the whole file. | 1093 | * for the whole file. |
1094 | */ | 1094 | */ |
1095 | static inline ssize_t | 1095 | static inline ssize_t |
1096 | do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | 1096 | do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, |
1097 | struct block_device *bdev, struct iov_iter *iter, loff_t offset, | 1097 | struct block_device *bdev, struct iov_iter *iter, |
1098 | get_block_t get_block, dio_iodone_t end_io, | 1098 | loff_t offset, get_block_t get_block, dio_iodone_t end_io, |
1099 | dio_submit_t submit_io, int flags) | 1099 | dio_submit_t submit_io, int flags) |
1100 | { | 1100 | { |
1101 | unsigned i_blkbits = ACCESS_ONCE(inode->i_blkbits); | 1101 | unsigned i_blkbits = ACCESS_ONCE(inode->i_blkbits); |
1102 | unsigned blkbits = i_blkbits; | 1102 | unsigned blkbits = i_blkbits; |
@@ -1110,9 +1110,6 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1110 | struct blk_plug plug; | 1110 | struct blk_plug plug; |
1111 | unsigned long align = offset | iov_iter_alignment(iter); | 1111 | unsigned long align = offset | iov_iter_alignment(iter); |
1112 | 1112 | ||
1113 | if (rw & WRITE) | ||
1114 | rw = WRITE_ODIRECT; | ||
1115 | |||
1116 | /* | 1113 | /* |
1117 | * Avoid references to bdev if not absolutely needed to give | 1114 | * Avoid references to bdev if not absolutely needed to give |
1118 | * the early prefetch in the caller enough time. | 1115 | * the early prefetch in the caller enough time. |
@@ -1127,7 +1124,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1127 | } | 1124 | } |
1128 | 1125 | ||
1129 | /* watch out for a 0 len io from a tricksy fs */ | 1126 | /* watch out for a 0 len io from a tricksy fs */ |
1130 | if (rw == READ && !iov_iter_count(iter)) | 1127 | if (iov_iter_rw(iter) == READ && !iov_iter_count(iter)) |
1131 | return 0; | 1128 | return 0; |
1132 | 1129 | ||
1133 | dio = kmem_cache_alloc(dio_cache, GFP_KERNEL); | 1130 | dio = kmem_cache_alloc(dio_cache, GFP_KERNEL); |
@@ -1143,7 +1140,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1143 | 1140 | ||
1144 | dio->flags = flags; | 1141 | dio->flags = flags; |
1145 | if (dio->flags & DIO_LOCKING) { | 1142 | if (dio->flags & DIO_LOCKING) { |
1146 | if (rw == READ) { | 1143 | if (iov_iter_rw(iter) == READ) { |
1147 | struct address_space *mapping = | 1144 | struct address_space *mapping = |
1148 | iocb->ki_filp->f_mapping; | 1145 | iocb->ki_filp->f_mapping; |
1149 | 1146 | ||
@@ -1169,19 +1166,19 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1169 | if (is_sync_kiocb(iocb)) | 1166 | if (is_sync_kiocb(iocb)) |
1170 | dio->is_async = false; | 1167 | dio->is_async = false; |
1171 | else if (!(dio->flags & DIO_ASYNC_EXTEND) && | 1168 | else if (!(dio->flags & DIO_ASYNC_EXTEND) && |
1172 | (rw & WRITE) && end > i_size_read(inode)) | 1169 | iov_iter_rw(iter) == WRITE && end > i_size_read(inode)) |
1173 | dio->is_async = false; | 1170 | dio->is_async = false; |
1174 | else | 1171 | else |
1175 | dio->is_async = true; | 1172 | dio->is_async = true; |
1176 | 1173 | ||
1177 | dio->inode = inode; | 1174 | dio->inode = inode; |
1178 | dio->rw = rw; | 1175 | dio->rw = iov_iter_rw(iter) == WRITE ? WRITE_ODIRECT : READ; |
1179 | 1176 | ||
1180 | /* | 1177 | /* |
1181 | * For AIO O_(D)SYNC writes we need to defer completions to a workqueue | 1178 | * For AIO O_(D)SYNC writes we need to defer completions to a workqueue |
1182 | * so that we can call ->fsync. | 1179 | * so that we can call ->fsync. |
1183 | */ | 1180 | */ |
1184 | if (dio->is_async && (rw & WRITE) && | 1181 | if (dio->is_async && iov_iter_rw(iter) == WRITE && |
1185 | ((iocb->ki_filp->f_flags & O_DSYNC) || | 1182 | ((iocb->ki_filp->f_flags & O_DSYNC) || |
1186 | IS_SYNC(iocb->ki_filp->f_mapping->host))) { | 1183 | IS_SYNC(iocb->ki_filp->f_mapping->host))) { |
1187 | retval = dio_set_defer_completion(dio); | 1184 | retval = dio_set_defer_completion(dio); |
@@ -1274,7 +1271,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1274 | * we can let i_mutex go now that its achieved its purpose | 1271 | * we can let i_mutex go now that its achieved its purpose |
1275 | * of protecting us from looking up uninitialized blocks. | 1272 | * of protecting us from looking up uninitialized blocks. |
1276 | */ | 1273 | */ |
1277 | if (rw == READ && (dio->flags & DIO_LOCKING)) | 1274 | if (iov_iter_rw(iter) == READ && (dio->flags & DIO_LOCKING)) |
1278 | mutex_unlock(&dio->inode->i_mutex); | 1275 | mutex_unlock(&dio->inode->i_mutex); |
1279 | 1276 | ||
1280 | /* | 1277 | /* |
@@ -1286,7 +1283,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1286 | */ | 1283 | */ |
1287 | BUG_ON(retval == -EIOCBQUEUED); | 1284 | BUG_ON(retval == -EIOCBQUEUED); |
1288 | if (dio->is_async && retval == 0 && dio->result && | 1285 | if (dio->is_async && retval == 0 && dio->result && |
1289 | (rw == READ || dio->result == count)) | 1286 | (iov_iter_rw(iter) == READ || dio->result == count)) |
1290 | retval = -EIOCBQUEUED; | 1287 | retval = -EIOCBQUEUED; |
1291 | else | 1288 | else |
1292 | dio_await_completion(dio); | 1289 | dio_await_completion(dio); |
@@ -1300,11 +1297,11 @@ out: | |||
1300 | return retval; | 1297 | return retval; |
1301 | } | 1298 | } |
1302 | 1299 | ||
1303 | ssize_t | 1300 | ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, |
1304 | __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | 1301 | struct block_device *bdev, struct iov_iter *iter, |
1305 | struct block_device *bdev, struct iov_iter *iter, loff_t offset, | 1302 | loff_t offset, get_block_t get_block, |
1306 | get_block_t get_block, dio_iodone_t end_io, | 1303 | dio_iodone_t end_io, dio_submit_t submit_io, |
1307 | dio_submit_t submit_io, int flags) | 1304 | int flags) |
1308 | { | 1305 | { |
1309 | /* | 1306 | /* |
1310 | * The block device state is needed in the end to finally | 1307 | * The block device state is needed in the end to finally |
@@ -1318,8 +1315,8 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1318 | prefetch(bdev->bd_queue); | 1315 | prefetch(bdev->bd_queue); |
1319 | prefetch((char *)bdev->bd_queue + SMP_CACHE_BYTES); | 1316 | prefetch((char *)bdev->bd_queue + SMP_CACHE_BYTES); |
1320 | 1317 | ||
1321 | return do_blockdev_direct_IO(rw, iocb, inode, bdev, iter, offset, | 1318 | return do_blockdev_direct_IO(iocb, inode, bdev, iter, offset, get_block, |
1322 | get_block, end_io, submit_io, flags); | 1319 | end_io, submit_io, flags); |
1323 | } | 1320 | } |
1324 | 1321 | ||
1325 | EXPORT_SYMBOL(__blockdev_direct_IO); | 1322 | EXPORT_SYMBOL(__blockdev_direct_IO); |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index df9d6afbc5d5..3cbeb1b63acf 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -864,7 +864,7 @@ ext2_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
864 | ret = dax_do_io(rw, iocb, inode, iter, offset, ext2_get_block, | 864 | ret = dax_do_io(rw, iocb, inode, iter, offset, ext2_get_block, |
865 | NULL, DIO_LOCKING); | 865 | NULL, DIO_LOCKING); |
866 | else | 866 | else |
867 | ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, | 867 | ret = blockdev_direct_IO(iocb, inode, iter, offset, |
868 | ext2_get_block); | 868 | ext2_get_block); |
869 | if (ret < 0 && (rw & WRITE)) | 869 | if (ret < 0 && (rw & WRITE)) |
870 | ext2_write_failed(mapping, offset + count); | 870 | ext2_write_failed(mapping, offset + count); |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index db07ffbe7c85..6fb376c8d938 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1856,7 +1856,7 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb, | |||
1856 | } | 1856 | } |
1857 | 1857 | ||
1858 | retry: | 1858 | retry: |
1859 | ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, ext3_get_block); | 1859 | ret = blockdev_direct_IO(iocb, inode, iter, offset, ext3_get_block); |
1860 | /* | 1860 | /* |
1861 | * In case of error extending write may have instantiated a few | 1861 | * In case of error extending write may have instantiated a few |
1862 | * blocks outside i_size. Trim these off again. | 1862 | * blocks outside i_size. Trim these off again. |
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 740c7871c117..ae4ffc27abc6 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
@@ -693,9 +693,10 @@ retry: | |||
693 | ret = dax_do_io(rw, iocb, inode, iter, offset, | 693 | ret = dax_do_io(rw, iocb, inode, iter, offset, |
694 | ext4_get_block, NULL, 0); | 694 | ext4_get_block, NULL, 0); |
695 | else | 695 | else |
696 | ret = __blockdev_direct_IO(rw, iocb, inode, | 696 | ret = __blockdev_direct_IO(iocb, inode, |
697 | inode->i_sb->s_bdev, iter, offset, | 697 | inode->i_sb->s_bdev, iter, |
698 | ext4_get_block, NULL, NULL, 0); | 698 | offset, ext4_get_block, NULL, |
699 | NULL, 0); | ||
699 | inode_dio_done(inode); | 700 | inode_dio_done(inode); |
700 | } else { | 701 | } else { |
701 | locked: | 702 | locked: |
@@ -703,8 +704,8 @@ locked: | |||
703 | ret = dax_do_io(rw, iocb, inode, iter, offset, | 704 | ret = dax_do_io(rw, iocb, inode, iter, offset, |
704 | ext4_get_block, NULL, DIO_LOCKING); | 705 | ext4_get_block, NULL, DIO_LOCKING); |
705 | else | 706 | else |
706 | ret = blockdev_direct_IO(rw, iocb, inode, iter, | 707 | ret = blockdev_direct_IO(iocb, inode, iter, offset, |
707 | offset, ext4_get_block); | 708 | ext4_get_block); |
708 | 709 | ||
709 | if (unlikely((rw & WRITE) && ret < 0)) { | 710 | if (unlikely((rw & WRITE) && ret < 0)) { |
710 | loff_t isize = i_size_read(inode); | 711 | loff_t isize = i_size_read(inode); |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a3f451370bef..ec049c04b197 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -3037,7 +3037,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, | |||
3037 | ret = dax_do_io(rw, iocb, inode, iter, offset, get_block_func, | 3037 | ret = dax_do_io(rw, iocb, inode, iter, offset, get_block_func, |
3038 | ext4_end_io_dio, dio_flags); | 3038 | ext4_end_io_dio, dio_flags); |
3039 | else | 3039 | else |
3040 | ret = __blockdev_direct_IO(rw, iocb, inode, | 3040 | ret = __blockdev_direct_IO(iocb, inode, |
3041 | inode->i_sb->s_bdev, iter, offset, | 3041 | inode->i_sb->s_bdev, iter, offset, |
3042 | get_block_func, | 3042 | get_block_func, |
3043 | ext4_end_io_dio, NULL, dio_flags); | 3043 | ext4_end_io_dio, NULL, dio_flags); |
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 497f8515d205..e16adebcb9b6 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -1159,7 +1159,7 @@ static ssize_t f2fs_direct_IO(int rw, struct kiocb *iocb, | |||
1159 | if (rw & WRITE) | 1159 | if (rw & WRITE) |
1160 | __allocate_data_blocks(inode, offset, count); | 1160 | __allocate_data_blocks(inode, offset, count); |
1161 | 1161 | ||
1162 | err = blockdev_direct_IO(rw, iocb, inode, iter, offset, get_data_block); | 1162 | err = blockdev_direct_IO(iocb, inode, iter, offset, get_data_block); |
1163 | if (err < 0 && (rw & WRITE)) | 1163 | if (err < 0 && (rw & WRITE)) |
1164 | f2fs_write_failed(mapping, offset + count); | 1164 | f2fs_write_failed(mapping, offset + count); |
1165 | 1165 | ||
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 8521207de229..a1a39f571e78 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -274,7 +274,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, | |||
274 | * FAT need to use the DIO_LOCKING for avoiding the race | 274 | * FAT need to use the DIO_LOCKING for avoiding the race |
275 | * condition of fat_get_block() and ->truncate(). | 275 | * condition of fat_get_block() and ->truncate(). |
276 | */ | 276 | */ |
277 | ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, fat_get_block); | 277 | ret = blockdev_direct_IO(iocb, inode, iter, offset, fat_get_block); |
278 | if (ret < 0 && (rw & WRITE)) | 278 | if (ret < 0 && (rw & WRITE)) |
279 | fat_write_failed(mapping, offset + count); | 279 | fat_write_failed(mapping, offset + count); |
280 | 280 | ||
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index fe6634d25d1d..59983a18cab4 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -1095,9 +1095,8 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb, | |||
1095 | truncate_inode_pages_range(mapping, lstart, end); | 1095 | truncate_inode_pages_range(mapping, lstart, end); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | rv = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, | 1098 | rv = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter, |
1099 | iter, offset, | 1099 | offset, gfs2_get_block_direct, NULL, NULL, 0); |
1100 | gfs2_get_block_direct, NULL, NULL, 0); | ||
1101 | out: | 1100 | out: |
1102 | gfs2_glock_dq(&gh); | 1101 | gfs2_glock_dq(&gh); |
1103 | gfs2_holder_uninit(&gh); | 1102 | gfs2_holder_uninit(&gh); |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 9337065bcc67..e92d175d1fd7 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -133,7 +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, offset, hfs_get_block); | 136 | ret = blockdev_direct_IO(iocb, inode, iter, offset, hfs_get_block); |
137 | 137 | ||
138 | /* | 138 | /* |
139 | * 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 5f86cadb0542..2a98dc07c22c 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -131,8 +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, offset, | 134 | ret = blockdev_direct_IO(iocb, inode, iter, offset, hfsplus_get_block); |
135 | hfsplus_get_block); | ||
136 | 135 | ||
137 | /* | 136 | /* |
138 | * In case of error extending write may have instantiated a few | 137 | * In case of error extending write may have instantiated a few |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 3197aed10614..c20f7883543f 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -339,7 +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, offset, jfs_get_block); | 342 | ret = blockdev_direct_IO(iocb, inode, iter, offset, jfs_get_block); |
343 | 343 | ||
344 | /* | 344 | /* |
345 | * 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 ab4987bc637f..3727b8caa46e 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -318,8 +318,7 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
318 | return 0; | 318 | return 0; |
319 | 319 | ||
320 | /* Needs synchronization with the cleaner */ | 320 | /* Needs synchronization with the cleaner */ |
321 | size = blockdev_direct_IO(rw, iocb, inode, iter, offset, | 321 | size = blockdev_direct_IO(iocb, inode, iter, offset, nilfs_get_block); |
322 | nilfs_get_block); | ||
323 | 322 | ||
324 | /* | 323 | /* |
325 | * In case of error extending write may have instantiated a few | 324 | * In case of error extending write may have instantiated a few |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index e1bf18c5d25e..68cb199fb2b6 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -738,10 +738,9 @@ static ssize_t ocfs2_direct_IO_write(struct kiocb *iocb, | |||
738 | di_bh = NULL; | 738 | di_bh = NULL; |
739 | } | 739 | } |
740 | 740 | ||
741 | written = __blockdev_direct_IO(WRITE, iocb, inode, inode->i_sb->s_bdev, | 741 | written = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter, |
742 | iter, offset, | 742 | offset, ocfs2_direct_IO_get_blocks, |
743 | ocfs2_direct_IO_get_blocks, | 743 | ocfs2_dio_end_io, NULL, 0); |
744 | ocfs2_dio_end_io, NULL, 0); | ||
745 | if (unlikely(written < 0)) { | 744 | if (unlikely(written < 0)) { |
746 | loff_t i_size = i_size_read(inode); | 745 | loff_t i_size = i_size_read(inode); |
747 | 746 | ||
@@ -844,11 +843,10 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
844 | return 0; | 843 | return 0; |
845 | 844 | ||
846 | if (rw == READ) | 845 | if (rw == READ) |
847 | return __blockdev_direct_IO(rw, iocb, inode, | 846 | return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, |
848 | inode->i_sb->s_bdev, | 847 | iter, offset, |
849 | iter, offset, | 848 | ocfs2_direct_IO_get_blocks, |
850 | ocfs2_direct_IO_get_blocks, | 849 | ocfs2_dio_end_io, NULL, 0); |
851 | ocfs2_dio_end_io, NULL, 0); | ||
852 | else | 850 | else |
853 | return ocfs2_direct_IO_write(iocb, iter, offset); | 851 | return ocfs2_direct_IO_write(iocb, iter, offset); |
854 | } | 852 | } |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 9312b7842e03..a51e9177b056 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -3286,7 +3286,7 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, | |||
3286 | size_t count = iov_iter_count(iter); | 3286 | size_t count = iov_iter_count(iter); |
3287 | ssize_t ret; | 3287 | ssize_t ret; |
3288 | 3288 | ||
3289 | ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, | 3289 | ret = blockdev_direct_IO(iocb, inode, iter, offset, |
3290 | reiserfs_get_blocks_direct_io); | 3290 | reiserfs_get_blocks_direct_io); |
3291 | 3291 | ||
3292 | /* | 3292 | /* |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 9c1fbd23913d..3adf49c01c19 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -225,7 +225,7 @@ static ssize_t udf_direct_IO(int rw, struct kiocb *iocb, | |||
225 | size_t count = iov_iter_count(iter); | 225 | size_t count = iov_iter_count(iter); |
226 | ssize_t ret; | 226 | ssize_t ret; |
227 | 227 | ||
228 | ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, udf_get_block); | 228 | ret = blockdev_direct_IO(iocb, inode, iter, offset, udf_get_block); |
229 | if (unlikely(ret < 0 && (rw & WRITE))) | 229 | if (unlikely(ret < 0 && (rw & WRITE))) |
230 | udf_write_failed(mapping, offset + count); | 230 | udf_write_failed(mapping, offset + count); |
231 | return ret; | 231 | return ret; |
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 4f8cdc59bc38..5ca504c66e85 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -1504,14 +1504,13 @@ xfs_vm_direct_IO( | |||
1504 | struct block_device *bdev = xfs_find_bdev_for_inode(inode); | 1504 | struct block_device *bdev = xfs_find_bdev_for_inode(inode); |
1505 | 1505 | ||
1506 | if (rw & WRITE) { | 1506 | if (rw & WRITE) { |
1507 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iter, | 1507 | return __blockdev_direct_IO(iocb, inode, bdev, iter, offset, |
1508 | offset, xfs_get_blocks_direct, | 1508 | xfs_get_blocks_direct, |
1509 | xfs_end_io_direct_write, NULL, | 1509 | xfs_end_io_direct_write, NULL, |
1510 | DIO_ASYNC_EXTEND); | 1510 | DIO_ASYNC_EXTEND); |
1511 | } | 1511 | } |
1512 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iter, | 1512 | return __blockdev_direct_IO(iocb, inode, bdev, iter, offset, |
1513 | offset, xfs_get_blocks_direct, | 1513 | xfs_get_blocks_direct, NULL, NULL, 0); |
1514 | NULL, NULL, 0); | ||
1515 | } | 1514 | } |
1516 | 1515 | ||
1517 | /* | 1516 | /* |
diff --git a/include/linux/fs.h b/include/linux/fs.h index f1e3f65255a8..c67b6de8be33 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2634,16 +2634,18 @@ enum { | |||
2634 | 2634 | ||
2635 | void dio_end_io(struct bio *bio, int error); | 2635 | void dio_end_io(struct bio *bio, int error); |
2636 | 2636 | ||
2637 | ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | 2637 | ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, |
2638 | struct block_device *bdev, struct iov_iter *iter, loff_t offset, | 2638 | struct block_device *bdev, struct iov_iter *iter, |
2639 | get_block_t get_block, dio_iodone_t end_io, | 2639 | loff_t offset, get_block_t get_block, |
2640 | dio_submit_t submit_io, int flags); | 2640 | dio_iodone_t end_io, dio_submit_t submit_io, |
2641 | 2641 | int flags); | |
2642 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | 2642 | |
2643 | struct inode *inode, struct iov_iter *iter, loff_t offset, | 2643 | static inline ssize_t blockdev_direct_IO(struct kiocb *iocb, |
2644 | get_block_t get_block) | 2644 | struct inode *inode, |
2645 | { | 2645 | struct iov_iter *iter, loff_t offset, |
2646 | return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iter, | 2646 | get_block_t get_block) |
2647 | { | ||
2648 | return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter, | ||
2647 | offset, get_block, NULL, NULL, | 2649 | offset, get_block, NULL, NULL, |
2648 | DIO_LOCKING | DIO_SKIP_HOLES); | 2650 | DIO_LOCKING | DIO_SKIP_HOLES); |
2649 | } | 2651 | } |