Btrfs: remove unnecessary level check in balance_level
authorLiu Bo <bo.liu@linux.alibaba.com>
Tue, 11 Sep 2018 22:06:23 +0000 (06:06 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Oct 2018 15:23:30 +0000 (17:23 +0200)
In the callchain:

btrfs_search_slot()
   if (level != 0)
      setup_nodes_for_search()
          balance_level()

It is just impossible to have level=0 in balance_level, we can drop the
check.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c

index 1124d236291d75b12a2f2fae5a3060f6efbc0e67..6178fadf80a1e6c11d2e8406f0bcce95cb4d9f98 100644 (file)
@@ -1815,8 +1815,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];