diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2021-04-14 10:40:56 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2021-04-14 10:40:56 +0200 |
commit | a73d47f57792dc3140348cc07271500c610b5624 (patch) | |
tree | 93ed5376d78d006c2ff827e1336d204496274310 /fs/fuse/file.c | |
parent | 4b91459ad283a7b174c7a092e31c470f217d1a31 (diff) | |
download | linux-a73d47f57792dc3140348cc07271500c610b5624.tar.bz2 |
fuse: don't zero pages twice
All callers of fuse_short_read already set the .page_zeroing flag, so no
need to do the tail zeroing again.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index eff4abaa87da..51187777c39b 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -798,21 +798,12 @@ static void fuse_short_read(struct inode *inode, u64 attr_ver, size_t num_read, { struct fuse_conn *fc = get_fuse_conn(inode); - if (fc->writeback_cache) { - /* - * A hole in a file. Some data after the hole are in page cache, - * but have not reached the client fs yet. So, the hole is not - * present there. - */ - int i; - int start_idx = num_read >> PAGE_SHIFT; - size_t off = num_read & (PAGE_SIZE - 1); - - for (i = start_idx; i < ap->num_pages; i++) { - zero_user_segment(ap->pages[i], off, PAGE_SIZE); - off = 0; - } - } else { + /* + * If writeback_cache is enabled, a short read means there's a hole in + * the file. Some data after the hole is in page cache, but has not + * reached the client fs yet. So the hole is not present there. + */ + if (!fc->writeback_cache) { loff_t pos = page_offset(ap->pages[0]) + num_read; fuse_read_update_size(inode, pos, attr_ver); } |