Message ID | 1536861359-55509-1-git-send-email-bo.liu@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] Btrfs: remove level==0 check in balance_level | expand |
On Fri, Sep 14, 2018 at 01:55:59AM +0800, Liu Bo wrote: > btrfs_search_slot() > if (level != 0) > setup_nodes_for_search() > balance_level() > > It is just impossible to have level=0 in balance_level. > > Reviewed-by: Nikolay Borisov <nborisov@suse.com> > Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com> Reviewed-by: David Sterba <dsterba@suse.com>
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 8b31caa60b0a..ada44c786f2e 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1778,8 +1778,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, int orig_slot = path->slots[level]; u64 orig_ptr; - if (level == 0) - return 0; + ASSERT(level > 0); mid = path->nodes[level];