diff options
author | David Sterba <dsterba@suse.com> | 2017-08-30 19:47:50 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-09-08 16:15:05 +0200 |
commit | b3d343fc9c45f150773b3792bdb960509a9ef483 (patch) | |
tree | 2193d3ee14fc526f7f225ef9e73a57e3d07385ba | |
parent | 902535a9516f39f5b232356f580c29164ad8d9a2 (diff) |
btrfs-progs: check: move fs roots check mode switch to a helper
Simplify main a bit.
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | cmds-check.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/cmds-check.c b/cmds-check.c index 39598b5e..a633d044 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -5314,6 +5314,21 @@ out: return err; } +static int do_check_fs_roots(struct btrfs_fs_info *fs_info, + struct cache_tree *root_cache) +{ + int ret; + + if (!ctx.progress_enabled) + fprintf(stderr, "checking fs roots\n"); + if (check_mode == CHECK_MODE_LOWMEM) + ret = check_fs_roots_v2(fs_info); + else + ret = check_fs_roots(fs_info, root_cache); + + return ret; +} + static int all_backpointers_checked(struct extent_record *rec, int print_errs) { struct list_head *cur = rec->backrefs.next; @@ -13089,12 +13104,7 @@ int cmd_check(int argc, char **argv) * ignore it when this happens. */ no_holes = btrfs_fs_incompat(root->fs_info, NO_HOLES); - if (!ctx.progress_enabled) - fprintf(stderr, "checking fs roots\n"); - if (check_mode == CHECK_MODE_LOWMEM) - ret = check_fs_roots_v2(root->fs_info); - else - ret = check_fs_roots(info, &root_cache); + ret = do_check_fs_roots(info, &root_cache); err |= !!ret; if (ret) { error("errors found in fs roots"); |