Btrfs: remove always true check in unlock_up
authorLiu Bo <bo.liu@linux.alibaba.com>
Fri, 18 May 2018 03:00:24 +0000 (11:00 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 30 May 2018 14:46:51 +0000 (16:46 +0200)
As unlock_up() is written as

for () {
   if (!path->locks[i])
       break;
   ...
   if (... && path->locks[i]) {
   }
}

Apparently, @path->locks[i] is always true at this 'if'.

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

index 23968233092966115058f11ad31bb2085bdf368e..973912ec899281e87de68e5c9301aa56a236ac99 100644 (file)
@@ -2330,7 +2330,7 @@ static noinline void unlock_up(struct btrfs_path *path, int level,
                        no_skips = 1;
 
                t = path->nodes[i];
-               if (i >= lowest_unlock && i > skip_level && path->locks[i]) {
+               if (i >= lowest_unlock && i > skip_level) {
                        btrfs_tree_unlock_rw(t, path->locks[i]);
                        path->locks[i] = 0;
                        if (write_lock_level &&