summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2023-05-29 16:17:02 +0100
committerDavid Sterba <dsterba@suse.com>2023-06-19 13:59:31 +0200
commit798f4d95db0d71a2803c61b5e1fd5b739569c3da (patch)
tree66ef28b6c6f80795c22b8333caad02bd9ee1c2e9
parentf38462c4476cc57ef0e739bc8b8bc8f0a5754b3b (diff)
downloadlinux-stable-798f4d95db0d71a2803c61b5e1fd5b739569c3da.tar.gz
linux-stable-798f4d95db0d71a2803c61b5e1fd5b739569c3da.tar.bz2
linux-stable-798f4d95db0d71a2803c61b5e1fd5b739569c3da.zip
btrfs: get rid of label and goto at insert_delayed_ref()
At insert_delayed_ref() there's no point of having a label and goto in the case we were able to insert the delayed ref head. We can just add the code under label to the if statement's body and return immediately, and also there is no need to track the return value in a variable, we can just return a literal true or false value directly. So do those changes. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/delayed-ref.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index c3da7c3185de..e4579e66a57a 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -565,15 +565,18 @@ static bool insert_delayed_ref(struct btrfs_delayed_ref_root *root,
{
struct btrfs_delayed_ref_node *exist;
int mod;
- bool ret = false;
spin_lock(&href->lock);
exist = tree_insert(&href->ref_tree, ref);
- if (!exist)
- goto inserted;
+ if (!exist) {
+ if (ref->action == BTRFS_ADD_DELAYED_REF)
+ list_add_tail(&ref->add_list, &href->ref_add_list);
+ atomic_inc(&root->num_entries);
+ spin_unlock(&href->lock);
+ return false;
+ }
/* Now we are sure we can merge */
- ret = true;
if (exist->action == ref->action) {
mod = ref->ref_mod;
} else {
@@ -600,13 +603,7 @@ static bool insert_delayed_ref(struct btrfs_delayed_ref_root *root,
if (exist->ref_mod == 0)
drop_delayed_ref(root, href, exist);
spin_unlock(&href->lock);
- return ret;
-inserted:
- if (ref->action == BTRFS_ADD_DELAYED_REF)
- list_add_tail(&ref->add_list, &href->ref_add_list);
- atomic_inc(&root->num_entries);
- spin_unlock(&href->lock);
- return ret;
+ return true;
}
/*