]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_io: support scrubbing rtgroup metadata paths
authorDarrick J. Wong <djwong@kernel.org>
Fri, 18 Aug 2023 19:02:16 +0000 (12:02 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 22 Nov 2023 23:03:38 +0000 (15:03 -0800)
Support scrubbing the metadata directory path of an rtgroup metadata
file.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
io/scrub.c
man/man8/xfs_io.8

index 9290b3977e162c7e38cd6bb58aeb7948e45d4939..d3a47a97884a3469369d759ea34e8a4e229037d9 100644 (file)
@@ -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;
index 2fc73935e4be253420c7a9f9ece204415f0af4c2..93e7a0f3603c91efeff0c5fdde99cd66ca1cb299 100644 (file)
@@ -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