From 2860b4c0b13b29790097c497f9800209958b8232 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Wed, 12 Aug 2020 10:45:20 +0100 Subject: [PATCH] [thin_check] rename --fix-metadata-leaks to --auto-repair This flag will cover all trivial fixes, such as data leaks. --- functional-tests/scenario-string-constants.scm | 2 +- functional-tests/thin-functional-tests.scm | 18 +++++++++--------- man8/thin_check.txt | 4 ++++ thin-provisioning/thin_check.cc | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/functional-tests/scenario-string-constants.scm b/functional-tests/scenario-string-constants.scm index 09cb7dd..4ba53b2 100644 --- a/functional-tests/scenario-string-constants.scm +++ b/functional-tests/scenario-string-constants.scm @@ -30,7 +30,7 @@ Options: {-h|--help} {-V|--version} {-m|--metadata-snap} - {--fix-metadata-leaks} + {--auto-repair} {--override-mapping-root} {--clear-needs-check-flag} {--ignore-non-fatal-errors} diff --git a/functional-tests/thin-functional-tests.scm b/functional-tests/thin-functional-tests.scm index 07fd62c..55b0e60 100644 --- a/functional-tests/thin-functional-tests.scm +++ b/functional-tests/thin-functional-tests.scm @@ -95,14 +95,14 @@ "Unrecognised option should cause failure" (run-fail (thin-check "--hedgehogs-only"))) - (define-scenario (thin-check incompatible-options fix-metadata-leaks) + (define-scenario (thin-check incompatible-options auto-repair) "Incompatible options should cause failure" (with-valid-metadata (md) - (run-fail (thin-check "--fix-metadata-leaks" "-m" md)) - (run-fail (thin-check "--fix-metadata-leaks" "--override-mapping-root 123" md)) - (run-fail (thin-check "--fix-metadata-leaks" "--super-block-only" md)) - (run-fail (thin-check "--fix-metadata-leaks" "--skip-mappings" md)) - (run-fail (thin-check "--fix-metadata-leaks" "--ignore-non-fatal-errors" md)))) + (run-fail (thin-check "--auto-repair" "-m" md)) + (run-fail (thin-check "--auto-repair" "--override-mapping-root 123" md)) + (run-fail (thin-check "--auto-repair" "--super-block-only" md)) + (run-fail (thin-check "--auto-repair" "--skip-mappings" md)) + (run-fail (thin-check "--auto-repair" "--ignore-non-fatal-errors" md)))) (define-scenario (thin-check incompatible-options clear-needs-check-flag) "Incompatible options should cause failure" @@ -145,10 +145,10 @@ (with-valid-metadata (md) (run-ok (thin-check "--clear-needs-check-flag" md)))) - (define-scenario (thin-check fix-metadata-leaks) - "Accepts --fix-metadata-leaks" + (define-scenario (thin-check auto-repair) + "Accepts --auto-repair" (with-valid-metadata (md) - (run-ok (thin-check "--fix-metadata-leaks" md)))) + (run-ok (thin-check "--auto-repair" md)))) (define-scenario (thin-check tiny-metadata) "Prints helpful message in case tiny metadata given" diff --git a/man8/thin_check.txt b/man8/thin_check.txt index 55452e6..4ab342f 100644 --- a/man8/thin_check.txt +++ b/man8/thin_check.txt @@ -40,6 +40,10 @@ OPTIONS The snap does not contain space maps, so these will not be checked. This may be used on live metadata. + --auto-repair Automatically repair any trivial issues found with the metadata. + + Currently only fixes metadata leaks. + --override-mapping-root Specify a mapping root to use. Don't use this. This overrides what's specified in the superblock. Only diff --git a/thin-provisioning/thin_check.cc b/thin-provisioning/thin_check.cc index 3a4ef4b..60f7838 100644 --- a/thin-provisioning/thin_check.cc +++ b/thin-provisioning/thin_check.cc @@ -92,7 +92,7 @@ thin_check_cmd::usage(std::ostream &out) const << " {-h|--help}\n" << " {-V|--version}\n" << " {-m|--metadata-snap}\n" - << " {--fix-metadata-leaks}\n" + << " {--auto-repair}\n" << " {--override-mapping-root}\n" << " {--clear-needs-check-flag}\n" << " {--ignore-non-fatal-errors}\n" @@ -117,7 +117,7 @@ thin_check_cmd::run(int argc, char **argv) { "ignore-non-fatal-errors", no_argument, NULL, 3}, { "clear-needs-check-flag", no_argument, NULL, 4 }, { "override-mapping-root", required_argument, NULL, 5}, - { "fix-metadata-leaks", no_argument, NULL, 6}, + { "auto-repair", no_argument, NULL, 6}, { NULL, no_argument, NULL, 0 } }; @@ -165,7 +165,7 @@ thin_check_cmd::run(int argc, char **argv) break; case 6: - // fix-metadata-leaks + // auto-repair fs.check_opts.set_fix_metadata_leaks(); break;