You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the fio to test the 4k read performance, I found the getattr was called in every block read, it seems the fuse filesystem with c++ libfuse do not have this question.
it's called by kfuse kernel module.
Thanks for your reply, I have checked the source code of Linux-4.19 kernel fs/fuse and found these codes:
fs/fuse/file.c
static ssize_t __fuse_direct_read(struct fuse_io_priv *io,
struct iov_iter *iter,
loff_t *ppos)
{
ssize_t res;
struct inode *inode = file_inode(io->iocb->ki_filp);
if (is_bad_inode(inode))
return -EIO;
res = fuse_direct_io(io, iter, ppos, 0);
fuse_invalidate_attr(inode);
return res;
}
fs/fuse/dir.c
/*
* Mark the attributes as stale, so that at the next call to
* ->getattr() they will be fetched from userspace
*/
void fuse_invalidate_attr(struct inode *inode)
{
get_fuse_inode(inode)->i_time = 0;
}
is the fuse_invalidate_attr function cause the GetAttr called after every 4k block read ?
When I use the fio to test the 4k read performance, I found the getattr was called in every block read, it seems the fuse filesystem with c++ libfuse do not have this question.
The fio command:
fio -numjobs=1 -iodepth=1 -ioengine=libaio -direct=1 -rw=read -size=4M -bs=4K -time_based -runtime=20 -name=Fio-1 -directory=/mnt
and the dd command got the same result
dd if=/mnt/testfile of=/dev/null bs=4K count=10 iflag=direct
cat /mnt/.accesslog
2024.09.11 09:25:42.345608 [uid:0,gid:0,pid:874844] read (1026,4096,1122304): (4096) - OK <0.000028>
2024.09.11 09:25:42.350034 [uid:0,gid:0,pid:874844] getattr (1026): (1026,[-rw-r--r--:0100644,1,0,0,1726017921,1726017922,1726017922,4194304]) - OK <0.004051>
2024.09.11 09:25:42.354292 [uid:0,gid:0,pid:874844] read (1026,4096,1126400): (4096) - OK <0.000031>
2024.09.11 09:25:42.362388 [uid:0,gid:0,pid:874844] getattr (1026): (1026,[-rw-r--r--:0100644,1,0,0,1726017921,1726017922,1726017922,4194304]) - OK <0.005230>
2024.09.11 09:25:42.363005 [uid:0,gid:0,pid:874844] read (1026,4096,1130496): (4096) - OK <0.000017>
2024.09.11 09:25:42.373989 [uid:0,gid:0,pid:874844] getattr (1026): (1026,[-rw-r--r--:0100644,1,0,0,1726017921,1726017922,1726017922,4194304]) - OK <0.010789>
2024.09.11 09:25:42.375317 [uid:0,gid:0,pid:874844] read (1026,4096,1134592): (4096) - OK <0.000024>
2024.09.11 09:25:42.394042 [uid:0,gid:0,pid:874844] getattr (1026): (1026,[-rw-r--r--:0100644,1,0,0,1726017921,1726017922,1726017922,4194304]) - OK <0.016077>
2024.09.11 09:25:42.394414 [uid:0,gid:0,pid:874844] read (1026,4096,1138688): (4096) - OK <0.000048>
2024.09.11 09:25:42.400903 [uid:0,gid:0,pid:874844] getattr (1026): (1026,[-rw-r--r--:0100644,1,0,0,1726017921,1726017922,1726017922,4194304]) - OK <0.005750>
2024.09.11 09:25:42.401618 [uid:0,gid:0,pid:874844] read (1026,4096,1142784): (4096) - OK <0.000017>
2024.09.11 09:25:42.407509 [uid:0,gid:0,pid:874844] getattr (1026): (1026,[-rw-r--r--:0100644,1,0,0,1726017921,1726017922,1726017922,4194304]) - OK <0.005622>
2024.09.11 09:25:42.408256 [uid:0,gid:0,pid:874844] read (1026,4096,1146880): (4096) - OK <0.000024>
2024.09.11 09:25:42.409010 [uid:0,gid:0,pid:874844] flush (1026,9,CAE4DB8115C4BE94) - OK <0.000004>
I want to known which component called the getattr, go-fuse, vfs, or someone else, and why the getattr before block read is necessary.
The text was updated successfully, but these errors were encountered: