[PATCH v4 9/9] fs: enable per-sb io stats for all blockdev filesystems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux