diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-22 06:51:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-06 17:32:54 -0400 |
commit | 0c949334a9e2581646c6ff0d1470a805b1e5be99 (patch) | |
tree | 60a4d6bc2260d648915baa9b78626cd4b6915431 /fs/ocfs2 | |
parent | 28060d5d9b261da110afe48aae7a2aa6555f798f (diff) |
iov_iter_truncate()
Now It Can Be Done(tm) - we don't need to do iov_shorten() in
generic_file_direct_write() anymore, now that all ->direct_IO()
instances are converted to proper iov_iter methods and honour
iter->count and iter->iov_offset properly.
Get rid of count/ocount arguments of generic_file_direct_write(),
while we are at it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/file.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 9ce9ed7615c1..06b6a16d9776 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2241,7 +2241,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2241 | int ret, direct_io, appending, rw_level, have_alloc_sem = 0; | 2241 | int ret, direct_io, appending, rw_level, have_alloc_sem = 0; |
2242 | int can_do_direct, has_refcount = 0; | 2242 | int can_do_direct, has_refcount = 0; |
2243 | ssize_t written = 0; | 2243 | ssize_t written = 0; |
2244 | size_t ocount; /* original count */ | ||
2245 | size_t count; /* after file limit checks */ | 2244 | size_t count; /* after file limit checks */ |
2246 | loff_t old_size, *ppos = &iocb->ki_pos; | 2245 | loff_t old_size, *ppos = &iocb->ki_pos; |
2247 | u32 old_clusters; | 2246 | u32 old_clusters; |
@@ -2253,6 +2252,9 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2253 | int unaligned_dio = 0; | 2252 | int unaligned_dio = 0; |
2254 | struct iov_iter from; | 2253 | struct iov_iter from; |
2255 | 2254 | ||
2255 | count = iov_length(iov, nr_segs); | ||
2256 | iov_iter_init(&from, WRITE, iov, nr_segs, count); | ||
2257 | |||
2256 | trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry, | 2258 | trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry, |
2257 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 2259 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2258 | file->f_path.dentry->d_name.len, | 2260 | file->f_path.dentry->d_name.len, |
@@ -2355,16 +2357,14 @@ relock: | |||
2355 | /* communicate with ocfs2_dio_end_io */ | 2357 | /* communicate with ocfs2_dio_end_io */ |
2356 | ocfs2_iocb_set_rw_locked(iocb, rw_level); | 2358 | ocfs2_iocb_set_rw_locked(iocb, rw_level); |
2357 | 2359 | ||
2358 | count = ocount = iov_length(iov, nr_segs); | ||
2359 | ret = generic_write_checks(file, ppos, &count, | 2360 | ret = generic_write_checks(file, ppos, &count, |
2360 | S_ISBLK(inode->i_mode)); | 2361 | S_ISBLK(inode->i_mode)); |
2361 | if (ret) | 2362 | if (ret) |
2362 | goto out_dio; | 2363 | goto out_dio; |
2363 | 2364 | ||
2364 | iov_iter_init(&from, WRITE, iov, nr_segs, count); | 2365 | iov_iter_truncate(&from, count); |
2365 | if (direct_io) { | 2366 | if (direct_io) { |
2366 | written = generic_file_direct_write(iocb, &from, *ppos, | 2367 | written = generic_file_direct_write(iocb, &from, *ppos); |
2367 | count, ocount); | ||
2368 | if (written < 0) { | 2368 | if (written < 0) { |
2369 | ret = written; | 2369 | ret = written; |
2370 | goto out_dio; | 2370 | goto out_dio; |