summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-30 19:47:50 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit3ca3f200713d73789f2ee2dfe99c83297b6d5be9 (patch)
tree10761102458466f2ec362817b2084bab46146e43
parentb3e08c27e1e8a7470e95dabb3cd3ecdc24b148fe (diff)
btrfs-progs: check: move chunk and extent check mode switch to a helper
Simplify main a bit. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--cmds-check.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 7dd6a0b4..7f7bfb06 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -11566,6 +11566,20 @@ out:
return err;
}
+static int do_check_chunks_and_extents(struct btrfs_fs_info *fs_info)
+{
+ int ret;
+
+ if (!ctx.progress_enabled)
+ fprintf(stderr, "checking extents\n");
+ if (check_mode == CHECK_MODE_LOWMEM)
+ ret = check_chunks_and_extents_v2(fs_info);
+ else
+ ret = check_chunks_and_extents(fs_info);
+
+ return ret;
+}
+
static int btrfs_fsck_reinit_root(struct btrfs_trans_handle *trans,
struct btrfs_root *root, int overwrite)
{
@@ -13026,12 +13040,7 @@ int cmd_check(int argc, char **argv)
goto close_out;
}
- if (!ctx.progress_enabled)
- fprintf(stderr, "checking extents\n");
- if (check_mode == CHECK_MODE_LOWMEM)
- ret = check_chunks_and_extents_v2(info);
- else
- ret = check_chunks_and_extents(info);
+ ret = do_check_chunks_and_extents(info);
err |= !!ret;
if (ret)
error(