Skip to content

Commit

Permalink
btrfs: Don't assign retval of btrfs_try_tree_write_lock/btrfs_tree_re…
Browse files Browse the repository at this point in the history
…ad_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: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Nikolay Borisov authored and David Sterba committed Sep 9, 2019
1 parent af024ed commit 65e99c4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2913,15 +2913,13 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
if (!p->skip_locking) {
level = btrfs_header_level(b);
if (level <= write_lock_level) {
err = btrfs_try_tree_write_lock(b);
if (!err) {
if (!btrfs_try_tree_write_lock(b)) {
btrfs_set_path_blocking(p);
btrfs_tree_lock(b);
}
p->locks[level] = BTRFS_WRITE_LOCK;
} else {
err = btrfs_tree_read_lock_atomic(b);
if (!err) {
if (!btrfs_tree_read_lock_atomic(b)) {
btrfs_set_path_blocking(p);
btrfs_tree_read_lock(b);
}
Expand Down Expand Up @@ -3055,8 +3053,7 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
}

level = btrfs_header_level(b);
err = btrfs_tree_read_lock_atomic(b);
if (!err) {
if (!btrfs_tree_read_lock_atomic(b)) {
btrfs_set_path_blocking(p);
btrfs_tree_read_lock(b);
}
Expand Down

0 comments on commit 65e99c4

Please sign in to comment.