diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-04 22:38:00 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-06 17:32:45 -0400 |
commit | a6cbcd4a4a85e2fdb0b3344b88df2e8b3d526b9e (patch) | |
tree | c0f054759a0b9c26881109968ad018fe759af458 | |
parent | 16b1f05d7f5ab4ce570963aca5f3b2b5d21822fa (diff) |
get rid of pointless iov_length() in ->direct_IO()
all callers have iov_length(iter->iov, iter->nr_segs) == iov_iter_count(iter)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/staging/lustre/lustre/llite/rw26.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 2 | ||||
-rw-r--r-- | fs/ext2/inode.c | 4 | ||||
-rw-r--r-- | fs/ext3/inode.c | 2 | ||||
-rw-r--r-- | fs/ext4/indirect.c | 2 | ||||
-rw-r--r-- | fs/ext4/inode.c | 8 | ||||
-rw-r--r-- | fs/fat/inode.c | 6 | ||||
-rw-r--r-- | fs/fuse/file.c | 2 | ||||
-rw-r--r-- | fs/gfs2/aops.c | 2 | ||||
-rw-r--r-- | fs/hfs/inode.c | 3 | ||||
-rw-r--r-- | fs/hfsplus/inode.c | 3 | ||||
-rw-r--r-- | fs/jfs/inode.c | 3 | ||||
-rw-r--r-- | fs/nfs/direct.c | 10 | ||||
-rw-r--r-- | fs/nilfs2/inode.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 3 | ||||
-rw-r--r-- | fs/udf/inode.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_aops.c | 2 | ||||
-rw-r--r-- | mm/filemap.c | 2 |
18 files changed, 32 insertions, 30 deletions
diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 66e05c6f4d27..38a5b580e7f0 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c | |||
@@ -370,7 +370,7 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb, | |||
370 | struct file *file = iocb->ki_filp; | 370 | struct file *file = iocb->ki_filp; |
371 | struct inode *inode = file->f_mapping->host; | 371 | struct inode *inode = file->f_mapping->host; |
372 | struct ccc_object *obj = cl_inode2ccc(inode); | 372 | struct ccc_object *obj = cl_inode2ccc(inode); |
373 | long count = iov_length(iter->iov, iter->nr_segs); | 373 | long count = iov_iter_count(iter); |
374 | long tot_bytes = 0, result = 0; | 374 | long tot_bytes = 0, result = 0; |
375 | struct ll_inode_info *lli = ll_i2info(inode); | 375 | struct ll_inode_info *lli = ll_i2info(inode); |
376 | unsigned long seg = 0; | 376 | unsigned long seg = 0; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 30a6cc51f32c..c46a025d0c4b 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -7456,7 +7456,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
7456 | * we need to flush the dirty pages again to make absolutely sure | 7456 | * we need to flush the dirty pages again to make absolutely sure |
7457 | * that any outstanding dirty pages are on disk. | 7457 | * that any outstanding dirty pages are on disk. |
7458 | */ | 7458 | */ |
7459 | count = iov_length(iter->iov, iter->nr_segs); | 7459 | count = iov_iter_count(iter); |
7460 | if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, | 7460 | if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, |
7461 | &BTRFS_I(inode)->runtime_flags)) | 7461 | &BTRFS_I(inode)->runtime_flags)) |
7462 | filemap_fdatawrite_range(inode->i_mapping, offset, count); | 7462 | filemap_fdatawrite_range(inode->i_mapping, offset, count); |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 47fbe760a7f8..116e809aa7cb 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -856,13 +856,13 @@ ext2_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
856 | struct file *file = iocb->ki_filp; | 856 | struct file *file = iocb->ki_filp; |
857 | struct address_space *mapping = file->f_mapping; | 857 | struct address_space *mapping = file->f_mapping; |
858 | struct inode *inode = mapping->host; | 858 | struct inode *inode = mapping->host; |
859 | size_t count = iov_iter_count(iter); | ||
859 | ssize_t ret; | 860 | ssize_t ret; |
860 | 861 | ||
861 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, | 862 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, |
862 | iter->nr_segs, ext2_get_block); | 863 | iter->nr_segs, ext2_get_block); |
863 | if (ret < 0 && (rw & WRITE)) | 864 | if (ret < 0 && (rw & WRITE)) |
864 | ext2_write_failed(mapping, offset + | 865 | ext2_write_failed(mapping, offset + count); |
865 | iov_length(iter->iov, iter->nr_segs)); | ||
866 | return ret; | 866 | return ret; |
867 | } | 867 | } |
868 | 868 | ||
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 7a5c501dc31b..8582ae2c80b0 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1828,7 +1828,7 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb, | |||
1828 | handle_t *handle; | 1828 | handle_t *handle; |
1829 | ssize_t ret; | 1829 | ssize_t ret; |
1830 | int orphan = 0; | 1830 | int orphan = 0; |
1831 | size_t count = iov_length(iter->iov, iter->nr_segs); | 1831 | size_t count = iov_iter_count(iter); |
1832 | int retries = 0; | 1832 | int retries = 0; |
1833 | 1833 | ||
1834 | trace_ext3_direct_IO_enter(inode, offset, count, rw); | 1834 | trace_ext3_direct_IO_enter(inode, offset, count, rw); |
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index eb5ae16902d0..123898a6af05 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
@@ -647,7 +647,7 @@ ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb, | |||
647 | handle_t *handle; | 647 | handle_t *handle; |
648 | ssize_t ret; | 648 | ssize_t ret; |
649 | int orphan = 0; | 649 | int orphan = 0; |
650 | size_t count = iov_length(iter->iov, iter->nr_segs); | 650 | size_t count = iov_iter_count(iter); |
651 | int retries = 0; | 651 | int retries = 0; |
652 | 652 | ||
653 | if (rw == WRITE) { | 653 | if (rw == WRITE) { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 29996c1b673e..2b993579a968 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -3090,7 +3090,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, | |||
3090 | struct file *file = iocb->ki_filp; | 3090 | struct file *file = iocb->ki_filp; |
3091 | struct inode *inode = file->f_mapping->host; | 3091 | struct inode *inode = file->f_mapping->host; |
3092 | ssize_t ret; | 3092 | ssize_t ret; |
3093 | size_t count = iov_length(iter->iov, iter->nr_segs); | 3093 | size_t count = iov_iter_count(iter); |
3094 | int overwrite = 0; | 3094 | int overwrite = 0; |
3095 | get_block_t *get_block_func = NULL; | 3095 | get_block_t *get_block_func = NULL; |
3096 | int dio_flags = 0; | 3096 | int dio_flags = 0; |
@@ -3225,6 +3225,7 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, | |||
3225 | { | 3225 | { |
3226 | struct file *file = iocb->ki_filp; | 3226 | struct file *file = iocb->ki_filp; |
3227 | struct inode *inode = file->f_mapping->host; | 3227 | struct inode *inode = file->f_mapping->host; |
3228 | size_t count = iov_iter_count(iter); | ||
3228 | ssize_t ret; | 3229 | ssize_t ret; |
3229 | 3230 | ||
3230 | /* | 3231 | /* |
@@ -3237,13 +3238,12 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, | |||
3237 | if (ext4_has_inline_data(inode)) | 3238 | if (ext4_has_inline_data(inode)) |
3238 | return 0; | 3239 | return 0; |
3239 | 3240 | ||
3240 | trace_ext4_direct_IO_enter(inode, offset, iov_length(iter->iov, iter->nr_segs), rw); | 3241 | trace_ext4_direct_IO_enter(inode, offset, count, rw); |
3241 | if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) | 3242 | if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) |
3242 | ret = ext4_ext_direct_IO(rw, iocb, iter, offset); | 3243 | ret = ext4_ext_direct_IO(rw, iocb, iter, offset); |
3243 | else | 3244 | else |
3244 | ret = ext4_ind_direct_IO(rw, iocb, iter, offset); | 3245 | ret = ext4_ind_direct_IO(rw, iocb, iter, offset); |
3245 | trace_ext4_direct_IO_exit(inode, offset, | 3246 | trace_ext4_direct_IO_exit(inode, offset, count, rw, ret); |
3246 | iov_length(iter->iov, iter->nr_segs), rw, ret); | ||
3247 | return ret; | 3247 | return ret; |
3248 | } | 3248 | } |
3249 | 3249 | ||
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index d5237a199055..154a6f9d3189 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -191,6 +191,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, | |||
191 | struct file *file = iocb->ki_filp; | 191 | struct file *file = iocb->ki_filp; |
192 | struct address_space *mapping = file->f_mapping; | 192 | struct address_space *mapping = file->f_mapping; |
193 | struct inode *inode = mapping->host; | 193 | struct inode *inode = mapping->host; |
194 | size_t count = iov_iter_count(iter); | ||
194 | ssize_t ret; | 195 | ssize_t ret; |
195 | 196 | ||
196 | if (rw == WRITE) { | 197 | if (rw == WRITE) { |
@@ -203,7 +204,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, | |||
203 | * | 204 | * |
204 | * Return 0, and fallback to normal buffered write. | 205 | * Return 0, and fallback to normal buffered write. |
205 | */ | 206 | */ |
206 | loff_t size = offset + iov_length(iter->iov, iter->nr_segs); | 207 | loff_t size = offset + count; |
207 | if (MSDOS_I(inode)->mmu_private < size) | 208 | if (MSDOS_I(inode)->mmu_private < size) |
208 | return 0; | 209 | return 0; |
209 | } | 210 | } |
@@ -215,8 +216,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, | |||
215 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, | 216 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, |
216 | iter->nr_segs, fat_get_block); | 217 | iter->nr_segs, fat_get_block); |
217 | if (ret < 0 && (rw & WRITE)) | 218 | if (ret < 0 && (rw & WRITE)) |
218 | fat_write_failed(mapping, offset + | 219 | fat_write_failed(mapping, offset + count); |
219 | iov_length(iter->iov, iter->nr_segs)); | ||
220 | 220 | ||
221 | return ret; | 221 | return ret; |
222 | } | 222 | } |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 17d96f36df15..36f15f9c1de2 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -2900,7 +2900,7 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
2900 | loff_t pos = 0; | 2900 | loff_t pos = 0; |
2901 | struct inode *inode; | 2901 | struct inode *inode; |
2902 | loff_t i_size; | 2902 | loff_t i_size; |
2903 | size_t count = iov_length(iter->iov, iter->nr_segs); | 2903 | size_t count = iov_iter_count(iter); |
2904 | struct fuse_io_priv *io; | 2904 | struct fuse_io_priv *io; |
2905 | 2905 | ||
2906 | pos = offset; | 2906 | pos = offset; |
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index e84ddaa42104..228a12d2afa9 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -1081,7 +1081,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb, | |||
1081 | */ | 1081 | */ |
1082 | if (mapping->nrpages) { | 1082 | if (mapping->nrpages) { |
1083 | loff_t lstart = offset & (PAGE_CACHE_SIZE - 1); | 1083 | loff_t lstart = offset & (PAGE_CACHE_SIZE - 1); |
1084 | loff_t len = iov_length(iter->iov, iter->nr_segs); | 1084 | loff_t len = iov_iter_count(iter); |
1085 | loff_t end = PAGE_ALIGN(offset + len) - 1; | 1085 | loff_t end = PAGE_ALIGN(offset + len) - 1; |
1086 | 1086 | ||
1087 | rv = 0; | 1087 | rv = 0; |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 09cff13528c5..dc69e8f31581 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -130,6 +130,7 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb, | |||
130 | struct file *file = iocb->ki_filp; | 130 | struct file *file = iocb->ki_filp; |
131 | struct address_space *mapping = file->f_mapping; | 131 | struct address_space *mapping = file->f_mapping; |
132 | struct inode *inode = file_inode(file)->i_mapping->host; | 132 | struct inode *inode = file_inode(file)->i_mapping->host; |
133 | size_t count = iov_iter_count(iter); | ||
133 | ssize_t ret; | 134 | ssize_t ret; |
134 | 135 | ||
135 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, | 136 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, |
@@ -141,7 +142,7 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb, | |||
141 | */ | 142 | */ |
142 | if (unlikely((rw & WRITE) && ret < 0)) { | 143 | if (unlikely((rw & WRITE) && ret < 0)) { |
143 | loff_t isize = i_size_read(inode); | 144 | loff_t isize = i_size_read(inode); |
144 | loff_t end = offset + iov_length(iter->iov, iter->nr_segs); | 145 | loff_t end = offset + count; |
145 | 146 | ||
146 | if (end > isize) | 147 | if (end > isize) |
147 | hfs_write_failed(mapping, end); | 148 | hfs_write_failed(mapping, end); |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 7f894a5b5eaf..e6b1251af47a 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -128,6 +128,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb, | |||
128 | struct file *file = iocb->ki_filp; | 128 | struct file *file = iocb->ki_filp; |
129 | struct address_space *mapping = file->f_mapping; | 129 | struct address_space *mapping = file->f_mapping; |
130 | struct inode *inode = file_inode(file)->i_mapping->host; | 130 | struct inode *inode = file_inode(file)->i_mapping->host; |
131 | size_t count = iov_iter_count(iter); | ||
131 | ssize_t ret; | 132 | ssize_t ret; |
132 | 133 | ||
133 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, iter->nr_segs, | 134 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, iter->nr_segs, |
@@ -139,7 +140,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb, | |||
139 | */ | 140 | */ |
140 | if (unlikely((rw & WRITE) && ret < 0)) { | 141 | if (unlikely((rw & WRITE) && ret < 0)) { |
141 | loff_t isize = i_size_read(inode); | 142 | loff_t isize = i_size_read(inode); |
142 | loff_t end = offset + iov_length(iter->iov, iter->nr_segs); | 143 | loff_t end = offset + count; |
143 | 144 | ||
144 | if (end > isize) | 145 | if (end > isize) |
145 | hfsplus_write_failed(mapping, end); | 146 | hfsplus_write_failed(mapping, end); |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 7052744d5107..6cde5928693b 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -336,6 +336,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb, | |||
336 | struct file *file = iocb->ki_filp; | 336 | struct file *file = iocb->ki_filp; |
337 | struct address_space *mapping = file->f_mapping; | 337 | struct address_space *mapping = file->f_mapping; |
338 | struct inode *inode = file->f_mapping->host; | 338 | struct inode *inode = file->f_mapping->host; |
339 | size_t count = iov_iter_count(iter); | ||
339 | ssize_t ret; | 340 | ssize_t ret; |
340 | 341 | ||
341 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, | 342 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, |
@@ -347,7 +348,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb, | |||
347 | */ | 348 | */ |
348 | if (unlikely((rw & WRITE) && ret < 0)) { | 349 | if (unlikely((rw & WRITE) && ret < 0)) { |
349 | loff_t isize = i_size_read(inode); | 350 | loff_t isize = i_size_read(inode); |
350 | loff_t end = offset + iov_length(iter->iov, iter->nr_segs); | 351 | loff_t end = offset + count; |
351 | 352 | ||
352 | if (end > isize) | 353 | if (end > isize) |
353 | jfs_write_failed(mapping, end); | 354 | jfs_write_failed(mapping, end); |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 21723149668b..1d34f454989e 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -486,9 +486,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, | |||
486 | struct nfs_direct_req *dreq; | 486 | struct nfs_direct_req *dreq; |
487 | struct nfs_lock_context *l_ctx; | 487 | struct nfs_lock_context *l_ctx; |
488 | ssize_t result = -EINVAL; | 488 | ssize_t result = -EINVAL; |
489 | size_t count; | 489 | size_t count = iov_iter_count(iter); |
490 | |||
491 | count = iov_length(iter->iov, iter->nr_segs); | ||
492 | nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count); | 490 | nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count); |
493 | 491 | ||
494 | dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n", | 492 | dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n", |
@@ -877,7 +875,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | |||
877 | get_dreq(dreq); | 875 | get_dreq(dreq); |
878 | atomic_inc(&inode->i_dio_count); | 876 | atomic_inc(&inode->i_dio_count); |
879 | 877 | ||
880 | NFS_I(dreq->inode)->write_io += iov_length(iter->iov, iter->nr_segs); | 878 | NFS_I(dreq->inode)->write_io += iov_iter_count(iter); |
881 | for (seg = 0; seg < iter->nr_segs; seg++) { | 879 | for (seg = 0; seg < iter->nr_segs; seg++) { |
882 | const struct iovec *vec = &iter->iov[seg]; | 880 | const struct iovec *vec = &iter->iov[seg]; |
883 | result = nfs_direct_write_schedule_segment(&desc, vec, pos, uio); | 881 | result = nfs_direct_write_schedule_segment(&desc, vec, pos, uio); |
@@ -936,9 +934,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter, | |||
936 | struct nfs_direct_req *dreq; | 934 | struct nfs_direct_req *dreq; |
937 | struct nfs_lock_context *l_ctx; | 935 | struct nfs_lock_context *l_ctx; |
938 | loff_t end; | 936 | loff_t end; |
939 | size_t count; | 937 | size_t count = iov_iter_count(iter); |
940 | |||
941 | count = iov_length(iter->iov, iter->nr_segs); | ||
942 | end = (pos + count - 1) >> PAGE_CACHE_SHIFT; | 938 | end = (pos + count - 1) >> PAGE_CACHE_SHIFT; |
943 | 939 | ||
944 | nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count); | 940 | nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count); |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 1c0e8fedc095..7aaf913e8709 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -304,6 +304,7 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
304 | struct file *file = iocb->ki_filp; | 304 | struct file *file = iocb->ki_filp; |
305 | struct address_space *mapping = file->f_mapping; | 305 | struct address_space *mapping = file->f_mapping; |
306 | struct inode *inode = file->f_mapping->host; | 306 | struct inode *inode = file->f_mapping->host; |
307 | size_t count = iov_iter_count(iter); | ||
307 | ssize_t size; | 308 | ssize_t size; |
308 | 309 | ||
309 | if (rw == WRITE) | 310 | if (rw == WRITE) |
@@ -319,7 +320,7 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
319 | */ | 320 | */ |
320 | if (unlikely((rw & WRITE) && size < 0)) { | 321 | if (unlikely((rw & WRITE) && size < 0)) { |
321 | loff_t isize = i_size_read(inode); | 322 | loff_t isize = i_size_read(inode); |
322 | loff_t end = offset + iov_length(iter->iov, iter->nr_segs); | 323 | loff_t end = offset + count; |
323 | 324 | ||
324 | if (end > isize) | 325 | if (end > isize) |
325 | nilfs_write_failed(mapping, end); | 326 | nilfs_write_failed(mapping, end); |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 17bf4c41a509..723affe921f1 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -3087,6 +3087,7 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, | |||
3087 | { | 3087 | { |
3088 | struct file *file = iocb->ki_filp; | 3088 | struct file *file = iocb->ki_filp; |
3089 | struct inode *inode = file->f_mapping->host; | 3089 | struct inode *inode = file->f_mapping->host; |
3090 | size_t count = iov_iter_count(iter); | ||
3090 | ssize_t ret; | 3091 | ssize_t ret; |
3091 | 3092 | ||
3092 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, | 3093 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, |
@@ -3098,7 +3099,7 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, | |||
3098 | */ | 3099 | */ |
3099 | if (unlikely((rw & WRITE) && ret < 0)) { | 3100 | if (unlikely((rw & WRITE) && ret < 0)) { |
3100 | loff_t isize = i_size_read(inode); | 3101 | loff_t isize = i_size_read(inode); |
3101 | loff_t end = offset + iov_length(iter->iov, iter->nr_segs); | 3102 | loff_t end = offset + count; |
3102 | 3103 | ||
3103 | if ((end > isize) && inode_newsize_ok(inode, isize) == 0) { | 3104 | if ((end > isize) && inode_newsize_ok(inode, isize) == 0) { |
3104 | truncate_setsize(inode, isize); | 3105 | truncate_setsize(inode, isize); |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 5b184c7f7dcb..28984baf6194 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -223,12 +223,13 @@ static ssize_t udf_direct_IO(int rw, struct kiocb *iocb, | |||
223 | struct file *file = iocb->ki_filp; | 223 | struct file *file = iocb->ki_filp; |
224 | struct address_space *mapping = file->f_mapping; | 224 | struct address_space *mapping = file->f_mapping; |
225 | struct inode *inode = mapping->host; | 225 | struct inode *inode = mapping->host; |
226 | size_t count = iov_iter_count(iter); | ||
226 | ssize_t ret; | 227 | ssize_t ret; |
227 | 228 | ||
228 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, iter->nr_segs, | 229 | ret = blockdev_direct_IO(rw, iocb, inode, iter->iov, offset, iter->nr_segs, |
229 | udf_get_block); | 230 | udf_get_block); |
230 | if (unlikely(ret < 0 && (rw & WRITE))) | 231 | if (unlikely(ret < 0 && (rw & WRITE))) |
231 | udf_write_failed(mapping, offset + iov_length(iter->iov, iter->nr_segs)); | 232 | udf_write_failed(mapping, offset + count); |
232 | return ret; | 233 | return ret; |
233 | } | 234 | } |
234 | 235 | ||
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 330d7b1c4be3..6462b3186784 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -1458,7 +1458,7 @@ xfs_vm_direct_IO( | |||
1458 | ssize_t ret; | 1458 | ssize_t ret; |
1459 | 1459 | ||
1460 | if (rw & WRITE) { | 1460 | if (rw & WRITE) { |
1461 | size_t size = iov_length(iter->iov, iter->nr_segs); | 1461 | size_t size = iov_iter_count(iter); |
1462 | 1462 | ||
1463 | /* | 1463 | /* |
1464 | * We cannot preallocate a size update transaction here as we | 1464 | * We cannot preallocate a size update transaction here as we |
diff --git a/mm/filemap.c b/mm/filemap.c index 139641274f1e..70c048ea36e0 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1698,7 +1698,7 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
1698 | goto out; /* skip atime */ | 1698 | goto out; /* skip atime */ |
1699 | size = i_size_read(inode); | 1699 | size = i_size_read(inode); |
1700 | retval = filemap_write_and_wait_range(mapping, pos, | 1700 | retval = filemap_write_and_wait_range(mapping, pos, |
1701 | pos + iov_length(iov, nr_segs) - 1); | 1701 | pos + count - 1); |
1702 | if (!retval) | 1702 | if (!retval) |
1703 | retval = mapping->a_ops->direct_IO(READ, iocb, &i, pos); | 1703 | retval = mapping->a_ops->direct_IO(READ, iocb, &i, pos); |
1704 | 1704 | ||