summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-22 06:51:37 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:32:54 -0400
commit0c949334a9e2581646c6ff0d1470a805b1e5be99 (patch)
tree60a4d6bc2260d648915baa9b78626cd4b6915431 /fs/ocfs2
parent28060d5d9b261da110afe48aae7a2aa6555f798f (diff)
downloadlinux-0c949334a9e2581646c6ff0d1470a805b1e5be99.tar.bz2
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.c10
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,
int ret, direct_io, appending, rw_level, have_alloc_sem = 0;
int can_do_direct, has_refcount = 0;
ssize_t written = 0;
- size_t ocount; /* original count */
size_t count; /* after file limit checks */
loff_t old_size, *ppos = &iocb->ki_pos;
u32 old_clusters;
@@ -2253,6 +2252,9 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
int unaligned_dio = 0;
struct iov_iter from;
+ count = iov_length(iov, nr_segs);
+ iov_iter_init(&from, WRITE, iov, nr_segs, count);
+
trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry,
(unsigned long long)OCFS2_I(inode)->ip_blkno,
file->f_path.dentry->d_name.len,
@@ -2355,16 +2357,14 @@ relock:
/* communicate with ocfs2_dio_end_io */
ocfs2_iocb_set_rw_locked(iocb, rw_level);
- count = ocount = iov_length(iov, nr_segs);
ret = generic_write_checks(file, ppos, &count,
S_ISBLK(inode->i_mode));
if (ret)
goto out_dio;
- iov_iter_init(&from, WRITE, iov, nr_segs, count);
+ iov_iter_truncate(&from, count);
if (direct_io) {
- written = generic_file_direct_write(iocb, &from, *ppos,
- count, ocount);
+ written = generic_file_direct_write(iocb, &from, *ppos);
if (written < 0) {
ret = written;
goto out_dio;