In addition to filesystems that opt-in with FS_SB_IOSTATS, auto-enable per-sb I/O stats for all blockdev filesystems. This can be used by tools like iotop to display the total I/O stats via sb along side the submitted I/O stats to block device to get a more complete view that also includes the cached I/O stats. Link: https://lore.kernel.org/linux-fsdevel/20220302211226.GG3927073@xxxxxxxxxxxxxxxxxxx/ Suggested-by: Dave Chinner <david@xxxxxxxxxxxxx> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- fs/super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/super.c b/fs/super.c index a18930693e54..e1bee46dfb5a 100644 --- a/fs/super.c +++ b/fs/super.c @@ -232,7 +232,12 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, if (security_sb_alloc(s)) goto fail; - if (type->fs_flags & FS_SB_IOSTATS && sb_iostats_init(s)) + /* + * Account per-sb I/O stats for all blockdev filesystems and for + * filesystems that opt-in with FS_SB_IOSTATS. + */ + if (type->fs_flags & (FS_SB_IOSTATS | FS_REQUIRES_DEV) && + sb_iostats_init(s)) goto fail; for (i = 0; i < SB_FREEZE_LEVELS; i++) { -- 2.25.1