public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 0/2] btrfs: migrate extent_buffer::pages[] to folio and more cleanups
Date: Tue, 5 Dec 2023 07:40:55 +1030	[thread overview]
Message-ID: <59a3a8d7-1f00-4d79-94e7-e77528d610ab@gmx.com> (raw)
In-Reply-To: <20231204162624.GC2205@twin.jikos.cz>



On 2023/12/5 02:56, David Sterba wrote:
> On Fri, Dec 01, 2023 at 04:36:53PM +1030, Qu Wenruo wrote:
>> [CHANGELOG]
>> v2:
>> - Adda new patch to do more cleanups for metadata page pointers usage
>>
>> This patchset would migrate extent_buffer::pages[] to folios[], then
>> cleanup the existing metadata page pointer usage to proper folios ones.
>>
>> This cleanup would help future higher order folios usage for metadata in
>> the following aspects:
>>
>> - No more need to iterate through the remaining pages for page flags
>>    We just call folio_set/mark/start_*() helpers, for the single folio.
>>    The helper would only set the flag (mostly for the leading page).
>>
>> - Single bio_add_folio() call for the whole eb
>>
>> - Better filio helpers naming
>>    PageUptodate() compared to folio_test_uptodate().
>>
>> The first patch would do a very simple conversion, then the 2nd patch do
>> the prepartion for the higher order folio situation.
>>
>> There are two locations which won't be converted to folios yet:
>>
>> - Subpage code
>>    There is no meaning to support higher order folio for subpage.
>>    The two conditions are just conflicting with each other.
>>
>> - Data page pointers
>>    That would be more useful in the future, before we going to support
>>    multi-page sectorsize.
>>
>> However the 2nd one would also add a new corner case:
>>
>> - Order mismatch in filemap and eb folios
>>    Unforatunately I don't have a better plan other than re-allocate the
>>    folios to the same order.
>>    Maybe in the future we would have better ways to handle it? Like
>>    migrating the pages to the higher order one?
>
> As long as it's a no-op for now this is OK, we can do the higher order
> allocation for eb pages afterwards.
>
Yep, it won't cause any problem for now.

Although this corner case is making me wondering if the new
alloc-then-attach is really any better than the original
alloc-and-attach solution.

If the mm (filemap) layer can allow us to allocate larger folios, it may
be much simpler.
The current code only needs to setlarge folio support for the mapping,
then go with high order fpg_flags.
The filemap code is already doing the retry and unalignment check.

But the existing filemap code would also try to reduce the order, which
can lead to other problems, like one extent buffer with multiple
different order folios.
Meanwhile alloc-and-attach gives us full control on the order, thus
allowing all-or-none (one single large folio, or all single page ones)
solution required by the 2nd patch.

Anyway, I would continue with the current alloc-then-attach method to
experiment the higher order folios allocation first to find out all the
pitfalls first.

Thanks,
Qu

  reply	other threads:[~2023-12-04 21:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01  6:06 [PATCH v2 0/2] btrfs: migrate extent_buffer::pages[] to folio and more cleanups Qu Wenruo
2023-12-01  6:06 ` [PATCH v2 1/2] btrfs: migrate extent_buffer::pages[] to folio Qu Wenruo
2023-12-01  6:06 ` [PATCH v2 2/2] btrfs: cleanup metadata page pointer usage Qu Wenruo
2023-12-05 14:00   ` David Sterba
2023-12-05 20:13     ` Qu Wenruo
2023-12-04 16:26 ` [PATCH v2 0/2] btrfs: migrate extent_buffer::pages[] to folio and more cleanups David Sterba
2023-12-04 21:10   ` Qu Wenruo [this message]
2023-12-05 14:04     ` 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=59a3a8d7-1f00-4d79-94e7-e77528d610ab@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@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