Commit 5dc3161c authored by Al Viro's avatar Al Viro

ocfs2_file_write_iter: stop messing with ppos

it's &iocb->ki_pos; no need to obfuscate.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent dfea9345
...@@ -2264,7 +2264,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, ...@@ -2264,7 +2264,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
int can_do_direct, has_refcount = 0; int can_do_direct, has_refcount = 0;
ssize_t written = 0; ssize_t written = 0;
size_t count = iov_iter_count(from); size_t count = iov_iter_count(from);
loff_t old_size, *ppos = &iocb->ki_pos; loff_t old_size;
u32 old_clusters; u32 old_clusters;
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
...@@ -2330,7 +2330,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, ...@@ -2330,7 +2330,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
} }
can_do_direct = direct_io; can_do_direct = direct_io;
ret = ocfs2_prepare_inode_for_write(file, ppos, count, appending, ret = ocfs2_prepare_inode_for_write(file, &iocb->ki_pos, count, appending,
&can_do_direct, &has_refcount); &can_do_direct, &has_refcount);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
...@@ -2338,7 +2338,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, ...@@ -2338,7 +2338,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
} }
if (direct_io && !is_sync_kiocb(iocb)) if (direct_io && !is_sync_kiocb(iocb))
unaligned_dio = ocfs2_is_io_unaligned(inode, count, *ppos); unaligned_dio = ocfs2_is_io_unaligned(inode, count, iocb->ki_pos);
/* /*
* We can't complete the direct I/O as requested, fall back to * We can't complete the direct I/O as requested, fall back to
...@@ -2374,7 +2374,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, ...@@ -2374,7 +2374,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
/* communicate with ocfs2_dio_end_io */ /* communicate with ocfs2_dio_end_io */
ocfs2_iocb_set_rw_locked(iocb, rw_level); ocfs2_iocb_set_rw_locked(iocb, rw_level);
ret = generic_write_checks(file, ppos, &count); ret = generic_write_checks(file, &iocb->ki_pos, &count);
if (ret) if (ret)
goto out_dio; goto out_dio;
...@@ -2382,7 +2382,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, ...@@ -2382,7 +2382,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
if (direct_io) { if (direct_io) {
loff_t endbyte; loff_t endbyte;
ssize_t written_buffered; ssize_t written_buffered;
written = generic_file_direct_write(iocb, from, *ppos); written = generic_file_direct_write(iocb, from, iocb->ki_pos);
if (written < 0 || written == count) { if (written < 0 || written == count) {
ret = written; ret = written;
goto out_dio; goto out_dio;
...@@ -2392,7 +2392,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, ...@@ -2392,7 +2392,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
* for completing the rest of the request. * for completing the rest of the request.
*/ */
count -= written; count -= written;
written_buffered = generic_perform_write(file, from, *ppos); written_buffered = generic_perform_write(file, from, iocb->ki_pos);
/* /*
* If generic_file_buffered_write() returned a synchronous error * If generic_file_buffered_write() returned a synchronous error
* then we want to return the number of bytes which were * then we want to return the number of bytes which were
...@@ -2409,14 +2409,14 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, ...@@ -2409,14 +2409,14 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
* disk and invalidated to preserve the expected O_DIRECT * disk and invalidated to preserve the expected O_DIRECT
* semantics. * semantics.
*/ */
endbyte = *ppos + written_buffered - 1; endbyte = iocb->ki_pos + written_buffered - 1;
ret = filemap_write_and_wait_range(file->f_mapping, *ppos, ret = filemap_write_and_wait_range(file->f_mapping, iocb->ki_pos,
endbyte); endbyte);
if (ret == 0) { if (ret == 0) {
iocb->ki_pos = *ppos + written_buffered; iocb->ki_pos += written_buffered;
written += written_buffered; written += written_buffered;
invalidate_mapping_pages(mapping, invalidate_mapping_pages(mapping,
*ppos >> PAGE_CACHE_SHIFT, iocb->ki_pos >> PAGE_CACHE_SHIFT,
endbyte >> PAGE_CACHE_SHIFT); endbyte >> PAGE_CACHE_SHIFT);
} else { } else {
/* /*
...@@ -2426,9 +2426,9 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, ...@@ -2426,9 +2426,9 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
} }
} else { } else {
current->backing_dev_info = inode_to_bdi(inode); current->backing_dev_info = inode_to_bdi(inode);
written = generic_perform_write(file, from, *ppos); written = generic_perform_write(file, from, iocb->ki_pos);
if (likely(written >= 0)) if (likely(written >= 0))
iocb->ki_pos = *ppos + written; iocb->ki_pos = iocb->ki_pos + written;
current->backing_dev_info = NULL; current->backing_dev_info = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment