From: Darrick J. Wong <djwong@xxxxxxxxxx> Support scrubbing all rtgroup metadata with a scrubv call. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- io/scrub.c | 40 ++++++++++++++++++++++++++++++++++++++++ man/man8/xfs_io.8 | 3 ++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/io/scrub.c b/io/scrub.c index cb4e24503dc..e9254c7882a 100644 --- a/io/scrub.c +++ b/io/scrub.c @@ -165,6 +165,32 @@ parse_metapath( return true; } +static bool +parse_rtgroup( + int argc, + char **argv, + int optind, + __u32 *rgno) +{ + char *p; + unsigned long control; + + if (optind != argc - 1) { + fprintf(stderr, _("Must specify one rtgroup number.\n")); + return false; + } + + control = strtoul(argv[optind], &p, 0); + if (*p != '\0') { + fprintf(stderr, _("Bad rtgroup number '%s'.\n"), + argv[optind]); + return false; + } + + *rgno = control; + return true; +} + static int parse_args( int argc, @@ -230,6 +256,12 @@ parse_args( return command_usage(cmdinfo); } break; + case XFROG_SCRUB_GROUP_RTGROUP: + if (!parse_rtgroup(argc, argv, optind, &meta->sm_agno)) { + exitcode = 1; + return command_usage(cmdinfo); + } + break; case XFROG_SCRUB_GROUP_FS: case XFROG_SCRUB_GROUP_NONE: case XFROG_SCRUB_GROUP_SUMMARY: @@ -544,6 +576,8 @@ scrubv_f( group = XFROG_SCRUB_GROUP_ISCAN; else if (!strcmp(argv[optind], "summary")) group = XFROG_SCRUB_GROUP_SUMMARY; + else if (!strcmp(argv[optind], "rtgroup")) + group = XFROG_SCRUB_GROUP_RTGROUP; else { printf(_("Unknown group '%s'.\n"), argv[optind]); exitcode = 1; @@ -581,6 +615,12 @@ scrubv_f( return command_usage(&scrubv_cmd); } break; + case XFROG_SCRUB_GROUP_RTGROUP: + if (!parse_rtgroup(argc, argv, optind, &vhead->svh_agno)) { + exitcode = 1; + return command_usage(&scrubv_cmd); + } + break; default: ASSERT(0); break; diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8 index ef3a5681a1a..61eed7f5aa8 100644 --- a/man/man8/xfs_io.8 +++ b/man/man8/xfs_io.8 @@ -1422,11 +1422,12 @@ Currently supported versions are 1 and 5. .RE .PD .TP -.BI "scrub " type " [ " agnumber " | " "ino" " " "gen" " | " metapath " ]" +.BI "scrub " type " [ " agnumber " | " rgnumber " | " "ino" " " "gen" " | " metapath " ]" Scrub internal XFS filesystem metadata. The .BI type parameter specifies which type of metadata to scrub. For AG metadata, one AG number must be specified. +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.