All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <dsterba@suse.cz>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v3 2/6] btrfs-progs: utils: Introduce basic set operations for range
Date: Tue, 24 Jan 2017 08:40:47 +0800	[thread overview]
Message-ID: <0f627fae-095d-b172-8560-2f5b18fa1832@cn.fujitsu.com> (raw)
In-Reply-To: <20170123172835.GO11951@twin.jikos.cz>



At 01/24/2017 01:28 AM, David Sterba wrote:
> On Mon, Dec 19, 2016 at 02:56:38PM +0800, Qu Wenruo wrote:
>> Introduce basic set operations: is_subset() and is_intersection().
>>
>> This is quite useful to check if a range [start, start + len) subset or
>> intersection of another range.
>> So we don't need to use open code to do it, which I sometimes do it
>> wrong.
>>
>> Also use these new facilities in btrfs-convert, to check if a range is a
>> subset or intersects with btrfs convert reserved ranges.
>
> I see the range helpers used only inside convert so I don't think we
> need to export them into utils. Then you could introduce a helper
> structure with start and len members and use that instead of 2 arrays

Right, I could move it convert.

>
>> --- a/disk-io.h
>> +++ b/disk-io.h
>> @@ -97,11 +97,16 @@ enum btrfs_read_sb_flags {
>>  	SBREAD_PARTIAL		= (1 << 1),
>>  };
>>
>> +/*
>> + * Use macro to define mirror super block position
>> + * So we can use it in static array initializtion
>> + */
>> +#define BTRFS_SB_MIRROR_OFFSET(mirror)	((u64)(16 * 1024) << \
>> +					 (BTRFS_SUPER_MIRROR_SHIFT * (mirror)))
>
> This is unrelated change and should go separately.

OK, I can send out a patch first.

Thanks for reviewing,
Qu

>
>>  static inline u64 btrfs_sb_offset(int mirror)
>>  {
>> -	u64 start = 16 * 1024;
>>  	if (mirror)
>> -		return start << (BTRFS_SUPER_MIRROR_SHIFT * mirror);
>> +		return BTRFS_SB_MIRROR_OFFSET(mirror);
>>  	return BTRFS_SUPER_INFO_OFFSET;
>>  }
>>
>
>



  reply	other threads:[~2017-01-24  0:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19  6:56 [PATCH v3 0/6] Convert rollback rework for v4.9 Qu Wenruo
2016-12-19  6:56 ` [PATCH v3 1/6] btrfs-progs: file-item: Fix wrong file extents inserted Qu Wenruo
2016-12-19  6:56 ` [PATCH v3 2/6] btrfs-progs: utils: Introduce basic set operations for range Qu Wenruo
2017-01-23 17:28   ` David Sterba
2017-01-24  0:40     ` Qu Wenruo [this message]
2017-01-23 17:40   ` David Sterba
2016-12-19  6:56 ` [PATCH v3 3/6] btrfs-progs: convert: Introduce function to record relocated ranges Qu Wenruo
2016-12-19  6:56 ` [PATCH v3 4/6] btrfs-progs: convert: Introduce new function to check if we can rollback Qu Wenruo
2016-12-19  6:56 ` [PATCH v3 5/6] btrfs-progs: convert: Switch to new rollback function Qu Wenruo
2016-12-20  5:36   ` Chandan Rajendra
2017-01-23 17:54   ` David Sterba
2017-01-24  0:44     ` Qu Wenruo
2017-01-24 16:37       ` David Sterba
2017-01-25  0:42         ` Qu Wenruo
2017-01-30 14:55           ` David Sterba
2016-12-19  6:56 ` [PATCH v3 6/6] btrfs-progs: convert-test: trigger chunk allocation after convert Qu Wenruo
2016-12-21 14:35 ` [PATCH v3 0/6] Convert rollback rework for v4.9 David Sterba
2016-12-22  1:53   ` Qu Wenruo

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=0f627fae-095d-b172-8560-2f5b18fa1832@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.