Traditionally, system administrators have used the iostat utility to track the amount of io performed to a local disk filesystem. Similar functionality is provided for NFS mounts via the nfsstat utility that reads the NFS client's stats from /proc/pid/mountstats. There is currently no good way for a system administrator or a monitoring application to track the amount of io performed via fuse filesystems. Opt-in for generic io stats via /proc/pid/mountstats to provide that functionality. It is possible to collect io stats on the server side inside libfuse, but those io stats will not cover cached writes and reads. Therefore, implementing the server side io stats would be complementary to these client side io stats. Also, this feature provides the io stats for existing fuse filesystem/lib release binaries. This feature depends on CONFIG_FS_IOSTATS. Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- fs/fuse/inode.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 9ee36aa73251..f19c666b9ac3 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -16,6 +16,7 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/fs_context.h> +#include <linux/fs_iostats.h> #include <linux/fs_parser.h> #include <linux/statfs.h> #include <linux/random.h> @@ -1517,6 +1518,10 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx) if (sb->s_flags & SB_MANDLOCK) goto err; + err = sb_iostats_init(sb); + if (err && err != -EOPNOTSUPP) + goto err; + rcu_assign_pointer(fc->curr_bucket, fuse_sync_bucket_alloc()); fuse_sb_defaults(sb); -- 2.25.1