linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Su Yue <Damenly_Su@gmx.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	damenly.su@gmail.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] btrfs-progs: add comments of block group lookup functions
Date: Mon, 11 Nov 2019 17:49:35 +0800	[thread overview]
Message-ID: <bf2131c4-c780-a66f-8963-452082438375@gmx.com> (raw)
In-Reply-To: <97915605-5df1-ab83-ca98-3133b0648df9@gmx.com>



On 2019/11/11 5:28 PM, Qu Wenruo wrote:
>
>
> On 2019/11/11 下午4:42, damenly.su@gmail.com wrote:
>> From: Su Yue <Damenly_Su@gmx.com>
>>
>> The progs side function btrfs_lookup_first_block_group() calls
>> find_first_extent_bit() to find block group which contains bytenr
>> or after the bytenr. This behavior differs from kernel code, so
>> add the comments.
>>
>> Add the coments of btrfs_lookup_block_group() too, this one works
>> like kernel side.
>>
>> Signed-off-by: Su Yue <Damenly_Su@gmx.com>
>> ---
>>   extent-tree.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/extent-tree.c b/extent-tree.c
>> index d67e4098351f..f690ae999f37 100644
>> --- a/extent-tree.c
>> +++ b/extent-tree.c
>> @@ -164,6 +164,9 @@ err:
>>   	return 0;
>>   }
>>
>> +/*
>> + * Return the block group that contains or after bytenr
>> + */
>
> What about "Return the block group thart starts at or after @bytenr" ?
>

That's what documented in kernel already.
The thing I try to express is "contains".
For such a block group marked as B[n, m).
btrfs_lookup_first_block_group(x) (x > n && x < m). Kernel code will
return the block group next to B. However, progs side will return the
block group B.

Thanks.
> Thanks,
> Qu
>
>>   struct btrfs_block_group_cache *btrfs_lookup_first_block_group(struct
>>   						       btrfs_fs_info *info,
>>   						       u64 bytenr)
>> @@ -193,6 +196,9 @@ struct btrfs_block_group_cache *btrfs_lookup_first_block_group(struct
>>   	return block_group;
>>   }
>>
>> +/*
>> + * Return the block group that contains the given bytenr
>> + */
>>   struct btrfs_block_group_cache *btrfs_lookup_block_group(struct
>>   							 btrfs_fs_info *info,
>>   							 u64 bytenr)
>>
>

  reply	other threads:[~2019-11-11  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11  8:42 [PATCH 1/2] btrfs-progs: add comments of block group lookup functions damenly.su
2019-11-11  8:42 ` [PATCH 2/2] btrfs-progs: check: call btrfs_lookup_block_group() instead in check_extent_type() damenly.su
2019-11-11  9:28 ` [PATCH 1/2] btrfs-progs: add comments of block group lookup functions Qu Wenruo
2019-11-11  9:49   ` Su Yue [this message]
2019-11-11 10:03     ` Qu Wenruo
2019-11-11 10:17       ` Su Yue
2019-11-15 16:17         ` David Sterba
2019-11-15 16:20 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf2131c4-c780-a66f-8963-452082438375@gmx.com \
    --to=damenly_su@gmx.com \
    --cc=damenly.su@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).