On 2019/12/18 下午1:18, damenly.su@gmail.com wrote: > From: Su Yue > > The are different behavior of btrfs_lookup_first_block_group() and > btrfs_lookup_first_block_group_kernel(). > There are many palaces calling the lookup function include extent > allocation part. It's too complicated to check and change those. > It will influence many functionalities in progs. > > So here, just make kernel version lookup functions run likely in > progs behavior. > > Signed-off-by: Su Yue It should be folded into previous commit, or this will break bisect. Thanks, Qu > --- > extent-tree.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/extent-tree.c b/extent-tree.c > index fdfa29a2409f..3f7b82dc88a2 100644 > --- a/extent-tree.c > +++ b/extent-tree.c > @@ -238,12 +238,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, 1); > } > > /* > @@ -252,7 +253,7 @@ struct btrfs_block_group_cache *btrfs_lookup_first_block_group_kernel( > struct btrfs_block_group_cache *btrfs_lookup_block_group_kernel( > struct btrfs_fs_info *info, u64 bytenr) > { > - return block_group_cache_tree_search(info, bytenr, 1); > + return block_group_cache_tree_search(info, bytenr, 0); > } > > /* >