]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_io: support passing the FORCE_REBUILD flag to online repair
authorDarrick J. Wong <djwong@kernel.org>
Wed, 20 Dec 2023 16:53:46 +0000 (08:53 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 22 Dec 2023 02:29:14 +0000 (18:29 -0800)
Add CLI options to the scrubv and repair commands so that the user can
pass FORCE_REBUILD to force the kernel to rebuild metadata.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
io/scrub.c
man/man8/xfs_io.8

index cde788fbaad3d70327b30ed49111af7933c30664..403b3a7282eacdaa58217f8134a096609f9d268b 100644 (file)
@@ -131,11 +131,15 @@ parse_args(
 {
        int                             type = -1;
        int                             i, c;
+       uint32_t                        flags = 0;
        const struct xfrog_scrub_descr  *d = NULL;
 
        memset(meta, 0, sizeof(struct xfs_scrub_metadata));
-       while ((c = getopt(argc, argv, "")) != EOF) {
+       while ((c = getopt(argc, argv, "R")) != EOF) {
                switch (c) {
+               case 'R':
+                       flags |= XFS_SCRUB_IFLAG_FORCE_REBUILD;
+                       break;
                default:
                        exitcode = 1;
                        return command_usage(cmdinfo);
@@ -160,6 +164,7 @@ parse_args(
        optind++;
 
        meta->sm_type = type;
+       meta->sm_flags = flags;
 
        switch (d->type) {
        case XFROG_SCRUB_TYPE_INODE:
@@ -248,11 +253,13 @@ repair_help(void)
 " or (optionally) take an inode number and generation number to act upon as\n"
 " the second and third parameters.\n"
 "\n"
+" Flags are -R to force rebuilding metadata.\n"
+"\n"
 " Example:\n"
 " 'repair inobt 3' - repairs the inode btree in AG 3.\n"
 " 'repair bmapbtd 128 13525' - repairs the extent map of inode 128 gen 13525.\n"
 "\n"
-" Known metadata repairs types are:"));
+" Known metadata repair types are:"));
        for (i = 0, d = xfrog_scrubbers; i < XFS_SCRUB_TYPE_NR; i++, d++)
                printf(" %s", d->name);
        printf("\n");
index 52f04dd73844adf361e0740c0ab5745adec609c4..56abe000f235fb350c4ec7e21292033893ce442a 100644 (file)
@@ -1343,6 +1343,9 @@ parameter specifies which type of metadata to repair.
 For AG metadata, one AG number must be specified.
 For file metadata, the repair is applied to the open file unless the
 inode number and generation number are specified.
+The
+.B -R
+option can be specified to force rebuilding of a metadata structure.
 .TP
 .BI "label" " " "[ -c | -s " label " ] "
 On filesystems that support online label manipulation, get, set, or clear the