Commit 65e99c43 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Don't assign retval of btrfs_try_tree_write_lock/btrfs_tree_read_lock_atomic

Those function are simple boolean predicates there is no need to assign
their return values to interim variables. Use them directly as
predicates. No functional changes.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent af024ed2
...@@ -2913,15 +2913,13 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -2913,15 +2913,13 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
if (!p->skip_locking) { if (!p->skip_locking) {
level = btrfs_header_level(b); level = btrfs_header_level(b);
if (level <= write_lock_level) { if (level <= write_lock_level) {
err = btrfs_try_tree_write_lock(b); if (!btrfs_try_tree_write_lock(b)) {
if (!err) {
btrfs_set_path_blocking(p); btrfs_set_path_blocking(p);
btrfs_tree_lock(b); btrfs_tree_lock(b);
} }
p->locks[level] = BTRFS_WRITE_LOCK; p->locks[level] = BTRFS_WRITE_LOCK;
} else { } else {
err = btrfs_tree_read_lock_atomic(b); if (!btrfs_tree_read_lock_atomic(b)) {
if (!err) {
btrfs_set_path_blocking(p); btrfs_set_path_blocking(p);
btrfs_tree_read_lock(b); btrfs_tree_read_lock(b);
} }
...@@ -3055,8 +3053,7 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key, ...@@ -3055,8 +3053,7 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
} }
level = btrfs_header_level(b); level = btrfs_header_level(b);
err = btrfs_tree_read_lock_atomic(b); if (!btrfs_tree_read_lock_atomic(b)) {
if (!err) {
btrfs_set_path_blocking(p); btrfs_set_path_blocking(p);
btrfs_tree_read_lock(b); btrfs_tree_read_lock(b);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment