mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-05 07:08:06 -04:00
btrfs: remove pointless out labels from extent-tree.c
Some functions (lookup_extent_data_ref(), __btrfs_mod_ref() and btrfs_free_tree_block()) have an 'out' label that does nothing but return, making it pointless. Simplify this by removing the label and returning instead of gotos plus setting the 'ret' variable. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
3ca4f9d096
commit
ea8f921005
@@ -477,7 +477,7 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans,
|
||||
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
|
||||
if (key.objectid != bytenr ||
|
||||
key.type != BTRFS_EXTENT_DATA_REF_KEY)
|
||||
goto fail;
|
||||
return ret;
|
||||
|
||||
ref = btrfs_item_ptr(leaf, path->slots[0],
|
||||
struct btrfs_extent_data_ref);
|
||||
@@ -488,12 +488,11 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans,
|
||||
btrfs_release_path(path);
|
||||
goto again;
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
return 0;
|
||||
}
|
||||
path->slots[0]++;
|
||||
}
|
||||
fail:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2501,7 +2500,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
|
||||
int i;
|
||||
int action;
|
||||
int level;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (btrfs_is_testing(fs_info))
|
||||
return 0;
|
||||
@@ -2553,7 +2552,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
|
||||
else
|
||||
ret = btrfs_free_extent(trans, &ref);
|
||||
if (ret)
|
||||
goto fail;
|
||||
return ret;
|
||||
} else {
|
||||
/* We don't know the owning_root, leave as 0. */
|
||||
ref.bytenr = btrfs_node_blockptr(buf, i);
|
||||
@@ -2566,12 +2565,10 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
|
||||
else
|
||||
ret = btrfs_free_extent(trans, &ref);
|
||||
if (ret)
|
||||
goto fail;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
|
||||
@@ -3575,12 +3572,12 @@ int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
|
||||
return 0;
|
||||
|
||||
if (btrfs_header_generation(buf) != trans->transid)
|
||||
goto out;
|
||||
return 0;
|
||||
|
||||
if (root_id != BTRFS_TREE_LOG_OBJECTID) {
|
||||
ret = check_ref_cleanup(trans, buf->start);
|
||||
if (!ret)
|
||||
goto out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bg = btrfs_lookup_block_group(fs_info, buf->start);
|
||||
@@ -3588,7 +3585,7 @@ int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
|
||||
if (btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
|
||||
pin_down_extent(trans, bg, buf->start, buf->len, true);
|
||||
btrfs_put_block_group(bg);
|
||||
goto out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3612,7 +3609,7 @@ int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
|
||||
|| btrfs_is_zoned(fs_info)) {
|
||||
pin_down_extent(trans, bg, buf->start, buf->len, true);
|
||||
btrfs_put_block_group(bg);
|
||||
goto out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WARN_ON(test_bit(EXTENT_BUFFER_DIRTY, &buf->bflags));
|
||||
@@ -3622,7 +3619,6 @@ int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
|
||||
btrfs_put_block_group(bg);
|
||||
trace_btrfs_reserved_extent_free(fs_info, buf->start, buf->len);
|
||||
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user