Skip to content

Commit 802dc04

Browse files
author
Miklos Szeredi
committed
fuse: don't need GETATTR after every READ
If 'auto_inval_data' mode is active, then fuse_file_read_iter() will call fuse_update_attributes(), which will check the attribute validity and send a GETATTR request if some of the attributes are no longer valid. The page cache is then invalidated if the size or mtime have changed. Then, if a READ request was sent and reply received (which is the case if the data wasn't cached yet, or if the file is opened for O_DIRECT), the atime attribute is invalidated. This will result in the next read() also triggering a GETATTR, ... This can be fixed by only sending GETATTR if the mode or size are invalid, we don't need to do a refresh if only atime is invalid. More generally, none of the callers of fuse_update_attributes() need an up-to-date atime value, so for now just remove STATX_ATIME from the request mask when attributes are updated for internal use. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 2f1e819 commit 802dc04

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/fuse/dir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,9 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file,
952952

953953
int fuse_update_attributes(struct inode *inode, struct file *file)
954954
{
955-
return fuse_update_get_attr(inode, file, NULL, STATX_BASIC_STATS, 0);
955+
/* Do *not* need to get atime for internal purposes */
956+
return fuse_update_get_attr(inode, file, NULL,
957+
STATX_BASIC_STATS & ~STATX_ATIME, 0);
956958
}
957959

958960
int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,

0 commit comments

Comments
 (0)