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 inside a container to track the amount of io performed via overlayfs. Opt-in for generic io stats via /proc/pid/mountstats to provide that functionality. This feature depends on CONFIG_FS_IOSTATS. Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- fs/overlayfs/super.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 7bb0a47cb615..94ab6adebe07 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -6,6 +6,7 @@ #include <uapi/linux/magic.h> #include <linux/fs.h> +#include <linux/fs_iostats.h> #include <linux/namei.h> #include <linux/xattr.h> #include <linux/mount.h> @@ -1979,6 +1980,10 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) sb->s_d_op = &ovl_dentry_operations; + err = sb_iostats_init(sb); + if (err && err != -EOPNOTSUPP) + goto out; + err = -ENOMEM; ofs = kzalloc(sizeof(struct ovl_fs), GFP_KERNEL); if (!ofs) -- 2.25.1