Skip to content

Commit 8c56e03

Browse files
author
Miklos Szeredi
committed
fuse: don't bump attr_version in cached write
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 <[email protected]>
1 parent fa5eee5 commit 8c56e03

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/fuse/file.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,15 +2309,18 @@ static int fuse_write_end(struct file *file, struct address_space *mapping,
23092309
if (!copied)
23102310
goto unlock;
23112311

2312+
pos += copied;
23122313
if (!PageUptodate(page)) {
23132314
/* Zero any unwritten bytes at the end of the page */
2314-
size_t endoff = (pos + copied) & ~PAGE_MASK;
2315+
size_t endoff = pos & ~PAGE_MASK;
23152316
if (endoff)
23162317
zero_user_segment(page, endoff, PAGE_SIZE);
23172318
SetPageUptodate(page);
23182319
}
23192320

2320-
fuse_write_update_size(inode, pos + copied);
2321+
if (pos > inode->i_size)
2322+
i_size_write(inode, pos);
2323+
23212324
set_page_dirty(page);
23222325

23232326
unlock:

0 commit comments

Comments
 (0)