From 03c3f473664fa40fba2f2273f70ca0eb8399af9d Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Fri, 18 Aug 2023 12:02:16 -0700 Subject: [PATCH] xfs_io: support scrubbing rtgroup metadata paths Support scrubbing the metadata directory path of an rtgroup metadata file. Signed-off-by: Darrick J. Wong --- io/scrub.c | 27 ++++++++++++++++++++++++++- man/man8/xfs_io.8 | 3 ++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/io/scrub.c b/io/scrub.c index 9290b3977..d3a47a978 100644 --- a/io/scrub.c +++ b/io/scrub.c @@ -89,6 +89,7 @@ scrub_ioctl( break; case XFROG_SCRUB_GROUP_METAPATH: meta.sm_ino = control; + meta.sm_agno = control2; break; case XFROG_SCRUB_GROUP_INODE: meta.sm_ino = control; @@ -150,7 +151,7 @@ parse_args( switch (d->group) { case XFROG_SCRUB_GROUP_METAPATH: - if (optind == argc - 1) { + if (optind == argc - 1 || optind == argc - 2) { bool set = false; for (i = 0; i < XFS_SCRUB_METAPATH_NR; i++) { @@ -171,6 +172,29 @@ parse_args( return 0; } } + + if (xfrog_metapaths[control].group == XFROG_SCRUB_GROUP_RTGROUP) { + if (optind == argc - 1) { + fprintf(stderr, + _("%s: Metapath requires an rtgroup number.\n"), + xfrog_metapaths[control].name); + return 0; + } + control2 = strtoul(argv[optind + 1], &p, 0); + if (*p != '\0') { + fprintf(stderr, + _("Bad rtgroup number '%s'.\n"), + argv[optind + 1]); + return 0; + } + } else { + if (optind == argc - 2) { + fprintf(stderr, + _("%s: Metapath does not take a second argument.\n"), + xfrog_metapaths[control].name); + return 0; + } + } } else { fprintf(stderr, _("Must specify metapath number.\n")); return 0; @@ -345,6 +369,7 @@ repair_ioctl( break; case XFROG_SCRUB_GROUP_METAPATH: meta.sm_ino = control; + meta.sm_agno = control2; break; case XFROG_SCRUB_GROUP_INODE: meta.sm_ino = control; diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8 index 2fc73935e..93e7a0f36 100644 --- a/man/man8/xfs_io.8 +++ b/man/man8/xfs_io.8 @@ -1444,7 +1444,7 @@ Currently supported versions are 1 and 5. .RE .PD .TP -.BI "scrub " type " [ " agnumber " | " rgnumber " | " "ino" " " "gen" " | " metapath " ]" +.BI "scrub " type " [ " agnumber " | " rgnumber " | " "ino" " " "gen" " | " metapath " [ " rgnumber " ] ]" Scrub internal XFS filesystem metadata. The .BI type parameter specifies which type of metadata to scrub. @@ -1453,6 +1453,7 @@ For realtime group metadata, one rtgroup number must be specified. For file metadata, the scrub is applied to the open file unless the inode number and generation number are specified. For metapath, the name of a file or a raw number must be specified. +If the metapath file is a per-rtgroup file, the group number must be specified. .RE .PD .TP -- 2.50.1