Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: Johannes Thumshirn <jth@kernel.org>, Chris Mason <clm@fb.com>,
	David Sterba <dsterba@suse.com>,
	"open list:BTRFS FILE SYSTEM" <linux-btrfs@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Qu Wenruo <wqu@suse.com>, Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH] btrfs: also add stripe entries for NOCOW writes
Date: Tue, 24 Sep 2024 08:02:59 +0930	[thread overview]
Message-ID: <d881d399-96fc-4cf5-8a40-96f2e76b7644@gmx.com> (raw)
In-Reply-To: <20240923152046.GA159452@perftesting>



在 2024/9/24 00:50, Josef Bacik 写道:
> On Mon, Sep 23, 2024 at 04:58:34PM +0930, Qu Wenruo wrote:
>>
>>
>> 在 2024/9/23 16:15, Johannes Thumshirn 写道:
>>> From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>>>
>>> NOCOW writes do not generate stripe_extent entries in the RAID stripe
>>> tree, as the RAID stripe-tree feature initially was designed with a
>>> zoned filesystem in mind and on a zoned filesystem, we do not allow NOCOW
>>> writes. But the RAID stripe-tree feature is independent from the zoned
>>> feature, so we must also allow NOCOW writes for zoned filesystems.
>>>
>>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>>
>> Sorry I'm going to repeat myself again, I still believe if we insert an
>> RST entry at falloc() time, it will be more consistent with the non-RST
>> code.
>>
>> Yes, I known preallocated space will not need any read nor search RST
>> entry, and we just fill the page cache with zero at read time.
>>
>> But the point of proper (not just dummy) RST entry for the whole
>> preallocated space is, we do not need to touch the RST entry anymore for
>> NOCOW/PREALLOCATED write at all.
>>
>> This makes the RST NOCOW/PREALLOC writes behavior to align with the
>> non-RST code, which doesn't update any extent item, but only modify the
>> file extent for PREALLOC writes.
>
> I see what you're getting at here, but it creates a huge amount of problems
> later down the line.
>
> I prealloc an extent, I map that logical extent to a physical extent and then I
> insert a RST entry for that mapping.  Now I rip out one of my disks, and now I
> have to update RST entries for extents I'm not going to rewrite because they're
> prealloc.

Why do we even need to do anything update the RST entries?

RST is just an extra layer for logical bytenr mapping, and did you see
the non-RST btrfs do relocation just because one device went missing?

Can you explain more on the "have to update RST entries" part?
That mismatches from my understanding of RST.

>
> RST is a logical->physical mapping.  We do not need to update or insert anything
> until we create that logical->physical mapping.

Just consider the fallocate of non-RST as an example.

We DO allocate real data extents, they have real location on the disk.

Then add the RST layer. Now preallocated extent suddenly do not have RST
mapping, but still have extents allocated for them.

I do not think this is any more consistent.

>  Keeping the rules consistent
> across the different layers will make it easier to reason about and easier to
> maintain.

I think all data extents should have RST mapping, that's way more
consistent than two different handling for different data extents.

Just like we do not bother if a data extent is preallocated or not in scrub.


>  Adding an index at endio time for NOCOW makes sense, we now have
> created a thing on disk that we need to have a mapping for.  The same goes for
> prealloc, adding an entry at prealloc time doesn't make logical sense as we
> haven't yet instantiated that space on disk.  Thanks,

But we allocated data extents. Even if we won't really utilize them for
now, we should have RST for it.

In fact, I do not even think it's correct to insert/update RST at
endio/ordered extent time.

It will be way more consistent to update/insert RST entries at data
extent allocation time.

Thanks,
Qu

>
> Josef
>


  reply	other threads:[~2024-09-23 22:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23  6:45 [PATCH] btrfs: also add stripe entries for NOCOW writes Johannes Thumshirn
2024-09-23  7:28 ` Qu Wenruo
2024-09-23  7:40   ` Johannes Thumshirn
2024-09-23  7:56     ` Qu Wenruo
2024-09-23  8:15       ` Johannes Thumshirn
2024-09-23  8:53         ` Qu Wenruo
2024-09-23 14:41           ` Johannes Thumshirn
2024-09-23 22:23             ` Qu Wenruo
2024-09-23 15:20   ` Josef Bacik
2024-09-23 22:32     ` Qu Wenruo [this message]
2024-09-24  0:46       ` Qu Wenruo
2024-09-24  7:07 ` Naohiro Aota

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=d881d399-96fc-4cf5-8a40-96f2e76b7644@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=jth@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --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