@@ -9553,12 +9553,6 @@ int cmd_check(int argc, char **argv)
exit(1);
}
- /*
- * experimental and dangerous
- */
- if (repair && check_mode == CHECK_MODE_LOWMEM)
- warning("low-memory mode repair support is only partial");
-
radix_tree_init();
cache_tree_init(&root_cache);
@@ -9600,6 +9594,28 @@ int cmd_check(int argc, char **argv)
if (repair)
ctree_flags |= OPEN_CTREE_PARTIAL;
+ /*
+ * experimental and dangerous
+ */
+ if (repair && check_mode == CHECK_MODE_LOWMEM) {
+ int delay = 10;
+
+ printf("WARNING:\n\n");
+ printf("\tLow-memory mode repair support is only partial.\n");
+ printf("\tIt's experimental and very dangerous.\n");
+ printf("\tIt may run slow or crash unexpectedly.\n");
+ printf("\tPlease backup device before running low-memory mode repair.\n");
+ printf("\tThe operation will start in %d seconds.\n", delay);
+ printf("\tUse Ctrl-C to stop it.\n");
+
+ while (delay) {
+ printf("%2d", delay--);
+ fflush(stdout);
+ sleep(1);
+ }
+ printf("\nStarting to check and repair filesystem.\n");
+ }
+
info = open_ctree_fs_info(argv[optind], bytenr, tree_root_bytenr,
chunk_root_bytenr, ctree_flags);
if (!info) {
Since lowmem mode repair is so dangerous, delay 10 seconds before start. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> --- check/main.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)