]> git.ipfire.org Git - people/ms/linux.git/commitdiff
fuse: don't bump attr_version in cached write
authorMiklos Szeredi <mszeredi@redhat.com>
Fri, 22 Oct 2021 15:03:02 +0000 (17:03 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 28 Oct 2021 07:45:32 +0000 (09:45 +0200)
The attribute version in fuse_inode should be updated whenever the
attributes might have changed on the server.  In case of cached writes this
is not the case, so updating the attr_version is unnecessary and could
possibly affect performance.

Open code the remaining part of fuse_write_update_size().

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/file.c

index 06967d8e274283e3c62c3dd1ac293a695b91eb7a..c09ab835821a2f07cb13b20205be54a9744c4c85 100644 (file)
@@ -2309,15 +2309,18 @@ static int fuse_write_end(struct file *file, struct address_space *mapping,
        if (!copied)
                goto unlock;
 
+       pos += copied;
        if (!PageUptodate(page)) {
                /* Zero any unwritten bytes at the end of the page */
-               size_t endoff = (pos + copied) & ~PAGE_MASK;
+               size_t endoff = pos & ~PAGE_MASK;
                if (endoff)
                        zero_user_segment(page, endoff, PAGE_SIZE);
                SetPageUptodate(page);
        }
 
-       fuse_write_update_size(inode, pos + copied);
+       if (pos > inode->i_size)
+               i_size_write(inode, pos);
+
        set_page_dirty(page);
 
 unlock: