From: David Sterba Date: Wed, 30 Aug 2017 17:47:50 +0000 (+0200) Subject: btrfs-progs: check: move fs roots check mode switch to a helper X-Git-Tag: upstream/4.16.1~464 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3d343fc9c45f150773b3792bdb960509a9ef483;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: check: move fs roots check mode switch to a helper Simplify main a bit. Signed-off-by: David Sterba --- diff --git a/cmds-check.c b/cmds-check.c index 39598b5..a633d04 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");