summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2020-11-06 16:27:29 -0500
committerDavid Sterba <dsterba@suse.com>2020-12-08 15:54:09 +0100
commitffeb03cfe2b49b73da7b325a31714003761fc6d5 (patch)
treeeb17a367e927525f16a9b81783c45b7665568bb5 /fs/btrfs
parentb2598edf8b36f8b7c52e3f5f611c49cbd1c67b36 (diff)
btrfs: cleanup the locking in btrfs_next_old_leaf
We are carrying around this next_rw_lock from when we would do spinning vs blocking read locks. Now that we have the rwsem locking we can simply use the read lock flag unconditionally and the read lock helpers. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index e2673c29e733..ec904db041e6 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -5272,7 +5272,6 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_key key;
u32 nritems;
int ret;
- int next_rw_lock = 0;
nritems = btrfs_header_nritems(path->nodes[0]);
if (nritems == 0)
@@ -5282,7 +5281,6 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
again:
level = 1;
next = NULL;
- next_rw_lock = 0;
btrfs_release_path(path);
path->keep_locks = 1;
@@ -5346,12 +5344,11 @@ again:
}
if (next) {
- btrfs_tree_unlock_rw(next, next_rw_lock);
+ btrfs_tree_read_unlock(next);
free_extent_buffer(next);
}
next = c;
- next_rw_lock = path->locks[level];
ret = read_block_for_search(root, path, &next, level,
slot, &key);
if (ret == -EAGAIN)
@@ -5382,7 +5379,6 @@ again:
BTRFS_NESTING_RIGHT,
path->recurse);
}
- next_rw_lock = BTRFS_READ_LOCK;
}
break;
}
@@ -5391,13 +5387,13 @@ again:
level--;
c = path->nodes[level];
if (path->locks[level])
- btrfs_tree_unlock_rw(c, path->locks[level]);
+ btrfs_tree_read_unlock(c);
free_extent_buffer(c);
path->nodes[level] = next;
path->slots[level] = 0;
if (!path->skip_locking)
- path->locks[level] = next_rw_lock;
+ path->locks[level] = BTRFS_READ_LOCK;
if (!level)
break;
@@ -5411,11 +5407,9 @@ again:
goto done;
}
- if (!path->skip_locking) {
+ if (!path->skip_locking)
__btrfs_tree_read_lock(next, BTRFS_NESTING_RIGHT,
path->recurse);
- next_rw_lock = BTRFS_READ_LOCK;
- }
}
ret = 0;
done: