aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-12-20 08:53:46 -0800
committerDarrick J. Wong <djwong@kernel.org>2023-12-21 18:29:14 -0800
commit9de9b74046527423dfd4a5140e86d74af69ee895 (patch)
tree887bdbf044904a73a29ef8391e65e776609969ad
parent99a0612bd5548c2cb0961e2eb1ed13d015f9cb9d (diff)
downloadxfsprogs-dev-9de9b74046527423dfd4a5140e86d74af69ee895.tar.gz
xfs_io: support passing the FORCE_REBUILD flag to online repair
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>
-rw-r--r--io/scrub.c11
-rw-r--r--man/man8/xfs_io.83
2 files changed, 12 insertions, 2 deletions
diff --git a/io/scrub.c b/io/scrub.c
index cde788fbaa..403b3a7282 100644
--- a/io/scrub.c
+++ b/io/scrub.c
@@ -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");
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index 52f04dd738..56abe000f2 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -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