btrfs-progs: Reduce error level from error to warning for OPEN_CTREE_PARTIAL

Even if we're using OPEN_CTREE_PARTIAL, like "rescue zero log", the
error message still looks too serious even we skipped that tree:

    bad tree block 2172747776, bytenr mismatch, want=2172747776, have=0
    Couldn't setup extent tree
    ^^^^^^^^^^^^^^^^^^^^^^^^^^

This patch will change the error message to:
- Use error() if we're not using OPEN_CTREE_PARTIAL
- Use warning() and explicitly show we're skipping that tree

So the result would be something like:

  For non-OPEN_CTREE_PARTIAL case:
    bad tree block 2172747776, bytenr mismatch, want=2172747776, have=0
    ERROR: could not setup extent tree

  For OPEN_CTREE_PARTIAL case
    bad tree block 2172747776, bytenr mismatch, want=2172747776, have=0
    WARNING: could not setup extent tree, skipping it

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2019-11-11 15:50:58 +08:00 committed by David Sterba
parent cbe239bf71
commit e731746a18
1 changed files with 4 additions and 2 deletions

View File

@ -889,9 +889,11 @@ static int setup_root_or_create_block(struct btrfs_fs_info *fs_info,
ret = find_and_setup_root(root, fs_info, objectid, info_root);
if (ret) {
printk("Couldn't setup %s tree\n", str);
if (!(flags & OPEN_CTREE_PARTIAL))
if (!(flags & OPEN_CTREE_PARTIAL)) {
error("could not setup %s tree", str);
return -EIO;
}
warning("could not setup %s tree, skipping it", str);
/*
* Need a blank node here just so we don't screw up in the
* million of places that assume a root has a valid ->node