mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-08 10:11:16 +00:00
btrfs-progs: remove the duplicated @level parameter for btrfs_bin_search()
We can easily get the level from @eb parameter, thus the level is not needed. This is inspired by the work of Marek in U-boot. Cc: Marek Behun <marek.behun@nic.cz> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
d617327acb
commit
2b1be545db
@ -6478,7 +6478,7 @@ static int run_next_block(struct btrfs_root *root,
|
|||||||
* technically unreferenced and don't need to be worried about.
|
* technically unreferenced and don't need to be worried about.
|
||||||
*/
|
*/
|
||||||
if (ri != NULL && ri->drop_level && level > ri->drop_level) {
|
if (ri != NULL && ri->drop_level && level > ri->drop_level) {
|
||||||
ret = btrfs_bin_search(buf, &ri->drop_key, level, &i);
|
ret = btrfs_bin_search(buf, &ri->drop_key, &i);
|
||||||
if (ret && i > 0)
|
if (ret && i > 0)
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
6
ctree.c
6
ctree.c
@ -666,9 +666,9 @@ static int generic_bin_search(struct extent_buffer *eb, unsigned long p,
|
|||||||
* leaves vs nodes
|
* leaves vs nodes
|
||||||
*/
|
*/
|
||||||
int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
|
int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
|
||||||
int level, int *slot)
|
int *slot)
|
||||||
{
|
{
|
||||||
if (level == 0)
|
if (btrfs_header_level(eb) == 0)
|
||||||
return generic_bin_search(eb,
|
return generic_bin_search(eb,
|
||||||
offsetof(struct btrfs_leaf, items),
|
offsetof(struct btrfs_leaf, items),
|
||||||
sizeof(struct btrfs_item),
|
sizeof(struct btrfs_item),
|
||||||
@ -1196,7 +1196,7 @@ again:
|
|||||||
ret = check_block(fs_info, p, level);
|
ret = check_block(fs_info, p, level);
|
||||||
if (ret)
|
if (ret)
|
||||||
return -1;
|
return -1;
|
||||||
ret = btrfs_bin_search(b, key, level, &slot);
|
ret = btrfs_bin_search(b, key, &slot);
|
||||||
if (level != 0) {
|
if (level != 0) {
|
||||||
if (ret && slot > 0)
|
if (ret && slot > 0)
|
||||||
slot -= 1;
|
slot -= 1;
|
||||||
|
2
ctree.h
2
ctree.h
@ -2659,7 +2659,7 @@ int btrfs_search_slot_for_read(struct btrfs_root *root,
|
|||||||
struct btrfs_path *p, int find_higher,
|
struct btrfs_path *p, int find_higher,
|
||||||
int return_any);
|
int return_any);
|
||||||
int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
|
int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
|
||||||
int level, int *slot);
|
int *slot);
|
||||||
int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *found_path,
|
int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *found_path,
|
||||||
u64 iobjectid, u64 ioff, u8 key_type,
|
u64 iobjectid, u64 ioff, u8 key_type,
|
||||||
struct btrfs_key *found_key);
|
struct btrfs_key *found_key);
|
||||||
|
Loading…
Reference in New Issue
Block a user