ocfs2_file_write_iter: stop messing with ppos
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 9 Apr 2015 11:25:03 +0000 (07:25 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Apr 2015 02:30:21 +0000 (22:30 -0400)
it's &iocb->ki_pos; no need to obfuscate.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ocfs2/file.c

index 8096fb6c081b9328ff20e95f4655d1c096f73fd8..78e245df5e32602859cec0b94aae8c971a8c7e58 100644 (file)
@@ -2264,7 +2264,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb,
        int can_do_direct, has_refcount = 0;
        ssize_t written = 0;
        size_t count = iov_iter_count(from);
-       loff_t old_size, *ppos = &iocb->ki_pos;
+       loff_t old_size;
        u32 old_clusters;
        struct file *file = iocb->ki_filp;
        struct inode *inode = file_inode(file);
@@ -2330,7 +2330,7 @@ relock:
        }
 
        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);
        if (ret < 0) {
                mlog_errno(ret);
@@ -2338,7 +2338,7 @@ relock:
        }
 
        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
@@ -2374,7 +2374,7 @@ relock:
        /* communicate with ocfs2_dio_end_io */
        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)
                goto out_dio;
 
@@ -2382,7 +2382,7 @@ relock:
        if (direct_io) {
                loff_t endbyte;
                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) {
                        ret = written;
                        goto out_dio;
@@ -2392,7 +2392,7 @@ relock:
                 * for completing the rest of the request.
                 */
                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
                 * then we want to return the number of bytes which were
@@ -2409,14 +2409,14 @@ relock:
                 * disk and invalidated to preserve the expected O_DIRECT
                 * semantics.
                 */
-               endbyte = *ppos + written_buffered - 1;
-               ret = filemap_write_and_wait_range(file->f_mapping, *ppos,
+               endbyte = iocb->ki_pos + written_buffered - 1;
+               ret = filemap_write_and_wait_range(file->f_mapping, iocb->ki_pos,
                                endbyte);
                if (ret == 0) {
-                       iocb->ki_pos = *ppos + written_buffered;
+                       iocb->ki_pos += written_buffered;
                        written += written_buffered;
                        invalidate_mapping_pages(mapping,
-                                       *ppos >> PAGE_CACHE_SHIFT,
+                                       iocb->ki_pos >> PAGE_CACHE_SHIFT,
                                        endbyte >> PAGE_CACHE_SHIFT);
                } else {
                        /*
@@ -2426,9 +2426,9 @@ relock:
                }
        } else {
                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))
-                       iocb->ki_pos = *ppos + written;
+                       iocb->ki_pos = iocb->ki_pos + written;
                current->backing_dev_info = NULL;
        }