diff mbox series

[V2,05/10] btrfs-progs: adjust ported block group lookup functions in kernel version

Message ID 20191218051849.2587-6-Damenly_Su@gmx.com (mailing list archive)
State New, archived
Headers show
Series unify origanization structure of block group cache | expand

Commit Message

Su Yue Dec. 18, 2019, 5:18 a.m. UTC
From: Su Yue <Damenly_Su@gmx.com>

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 <Damenly_Su@gmx.com>
---
 extent-tree.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Qu Wenruo Dec. 18, 2019, 9:52 a.m. UTC | #1
On 2019/12/18 下午1:18, damenly.su@gmail.com wrote:
> From: Su Yue <Damenly_Su@gmx.com>
> 
> 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 <Damenly_Su@gmx.com>

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);
>  }
>  
>  /*
>
Su Yue Dec. 18, 2019, 11:01 a.m. UTC | #2
On 2019/12/18 5:52 PM, Qu Wenruo wrote:
>
>
> On 2019/12/18 下午1:18, damenly.su@gmail.com wrote:
>> From: Su Yue <Damenly_Su@gmx.com>
>>
>> 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 <Damenly_Su@gmx.com>
>
> It should be folded into previous commit, or this will break bisect.
>

Oh, will do.

Thanks for your review.


> 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);
>>   }
>>
>>   /*
>>
>
diff mbox series

Patch

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);
 }
 
 /*