[PATCH 05/10] btrfs-progs: adjust function btrfs_lookup_first_block_group_kernel

damenly.su
2019-12-05T04:29:45Z

From: Su Yue <Damenly_Su@gmx.com>

The are different behavior of btrfs_lookup_first_block_group() and
btrfs_lookup_first_block_group_kernel(). Unify the latter' behavior.

Signed-off-by: Su Yue <Damenly_Su@gmx.com>
---
extent-tree.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/extent-tree.c b/extent-tree.c
index 1d8535049eaf..274dfe540b1f 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -243,12 +243,13 @@ static struct btrfs_block_group_cache *block_group_cache_tree_search(
}

/*
- * Return the block group that starts at or after bytenr
+ * Return the block group that contains @bytenr, otherwise return the next one
+ * that starts after @bytenr
*/
struct btrfs_block_group_cache *btrfs_lookup_first_block_group_kernel(
struct btrfs_fs_info *info, u64 bytenr)
{
- return block_group_cache_tree_search(info, bytenr, 0);
+ return block_group_cache_tree_search(info, bytenr, 2);
}

/*
--
2.21.0 (Apple Git-122)