From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Qu Wenruo <wqu@suse.com>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Cc: Christoph Hellwig <hch@lst.de>,
Naohiro Aota <Naohiro.Aota@wdc.com>,
Damien Le Moal <dlemoal@kernel.org>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v9 01/11] btrfs: add raid stripe tree definitions
Date: Fri, 15 Sep 2023 20:03:55 +0930 [thread overview]
Message-ID: <e2b069ba-deff-4cfc-992e-ad8e1d9b6f02@gmx.com> (raw)
In-Reply-To: <c85e00e7-e9d6-40b0-8bc9-7d966bbd1026@wdc.com>
On 2023/9/15 19:25, Johannes Thumshirn wrote:
> On 15.09.23 02:27, Qu Wenruo wrote:
>>>> /*
>>>> * Records the overall state of the qgroups.
>>>> * There's only one instance of this key present,
>>>> @@ -719,6 +724,32 @@ struct btrfs_free_space_header {
>>>> __le64 num_bitmaps;
>>>> } __attribute__ ((__packed__));
>>>> +struct btrfs_raid_stride {
>>>> + /* The btrfs device-id this raid extent lives on */
>>>> + __le64 devid;
>>>> + /* The physical location on disk */
>>>> + __le64 physical;
>>>> + /* The length of stride on this disk */
>>>> + __le64 length;
>>
>> Forgot to mention, for btrfs_stripe_extent structure, its key is
>> (PHYSICAL, RAID_STRIPE_KEY, LENGTH) right?
>>
>> So is the length in the btrfs_raid_stride duplicated and we can save 8
>> bytes?
>
> Nope. The length in the key is the stripe length. The length in the
> stride is the stride length.
>
> Here's an example for why this is needed:
>
> wrote 32768/32768 bytes at offset 0
> XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> wrote 131072/131072 bytes at offset 0
> XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> wrote 8192/8192 bytes at offset 65536
> XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>
> [snip]
>
> item 0 key (XXXXXX RAID_STRIPE_KEY 32768) itemoff XXXXX itemsize 32
> encoding: RAID0
> stripe 0 devid 1 physical XXXXXXXXX length 32768
> item 1 key (XXXXXX RAID_STRIPE_KEY 131072) itemoff XXXXX
> itemsize 80
Maybe you want to put the whole RAID_STRIPE_KEY definition into the headers.
In fact my initial assumption of such case would be something like this:
item 0 key (X+0 RAID_STRIPE 32K)
stripe 0 devid 1 physical XXXXX len 32K
item 1 key (X+32K RAID_STRIPE 32K)
stripe 0 devid 1 physical XXXXX + 32K len 32K
item 2 key (X+64K RAID_STRIPE 64K)
stripe 0 devid 2 physical YYYYY len 64K
item 3 key (X+128K RAID_STRIPE 32K)
stripe 0 devid 1 physical XXXXX + 64K len 32K
...
AKA, each RAID_STRIPE_KEY would only contain a continous physical stripe.
And in above case, item 0 and item 1 can be easily merged, also length
can be removed.
And this explains why the lookup code is more complex than I initially
thought.
BTW, would the above layout make the code a little easier?
Or is there any special reason for the existing one layout?
Thank,
Qu
> encoding: RAID0
> stripe 0 devid 1 physical XXXXXXXXX length 32768
> stripe 1 devid 2 physical XXXXXXXXX length 65536
> stripe 2 devid 1 physical XXXXXXXXX length 32768
This current layout has another problem.
For RAID10 the interpretation of the RAID_STRIPE item can be very complex.
While
> item 2 key (XXXXXX RAID_STRIPE_KEY 8192) itemoff XXXXX itemsize 32
> encoding: RAID0
> stripe 0 devid 1 physical XXXXXXXXX length 8192
>
> Without the length in the stride, we don't know when to select the next
> stride in item 1 above.
next prev parent reply other threads:[~2023-09-15 10:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 16:06 [PATCH v9 00/11] btrfs: introduce RAID stripe tree Johannes Thumshirn
2023-09-14 16:06 ` [PATCH v9 01/11] btrfs: add raid stripe tree definitions Johannes Thumshirn
2023-09-15 0:22 ` Qu Wenruo
2023-09-15 0:26 ` Qu Wenruo
2023-09-15 9:55 ` Johannes Thumshirn
2023-09-15 10:33 ` Qu Wenruo [this message]
2023-09-15 10:46 ` Johannes Thumshirn
2023-10-02 9:32 ` Johannes Thumshirn
2023-09-14 16:06 ` [PATCH v9 02/11] btrfs: read raid-stripe-tree from disk Johannes Thumshirn
2023-09-14 16:06 ` [PATCH v9 03/11] btrfs: add support for inserting raid stripe extents Johannes Thumshirn
2023-09-14 18:07 ` David Sterba
2023-09-15 10:03 ` Geert Uytterhoeven
2023-09-14 18:10 ` David Sterba
2023-09-15 0:55 ` Qu Wenruo
2023-09-19 12:13 ` Johannes Thumshirn
2023-09-14 16:06 ` [PATCH v9 04/11] btrfs: delete stripe extent on extent deletion Johannes Thumshirn
2023-09-14 16:07 ` [PATCH v9 05/11] btrfs: lookup physical address from stripe extent Johannes Thumshirn
2023-09-14 17:57 ` David Sterba
2023-09-14 16:07 ` [PATCH v9 06/11] btrfs: implement RST version of scrub Johannes Thumshirn
2023-09-15 0:58 ` Qu Wenruo
2023-09-15 14:11 ` David Sterba
2023-09-14 16:07 ` [PATCH v9 07/11] btrfs: zoned: allow zoned RAID Johannes Thumshirn
2023-09-14 17:59 ` David Sterba
2023-09-14 16:07 ` [PATCH v9 08/11] btrfs: add raid stripe tree pretty printer Johannes Thumshirn
2023-09-14 16:07 ` [PATCH v9 09/11] btrfs: announce presence of raid-stripe-tree in sysfs Johannes Thumshirn
2023-09-14 16:07 ` [PATCH v9 10/11] btrfs: add trace events for RST Johannes Thumshirn
2023-09-14 16:07 ` [PATCH v9 11/11] btrfs: add raid-stripe-tree to features enabled with debug Johannes Thumshirn
2023-09-14 18:25 ` [PATCH v9 00/11] btrfs: introduce RAID stripe tree David Sterba
2023-09-20 16:23 ` 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=e2b069ba-deff-4cfc-992e-ad8e1d9b6f02@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=Naohiro.Aota@wdc.com \
--cc=clm@fb.com \
--cc=dlemoal@kernel.org \
--cc=dsterba@suse.com \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wqu@suse.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
all inboxes | Powered by JetHome®