From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 0/5] btrfs: remove folio ordered flag
Date: Tue, 12 May 2026 19:35:24 +0200 [thread overview]
Message-ID: <20260512173524.GL2558453@twin.jikos.cz> (raw)
In-Reply-To: <cover.1778131118.git.wqu@suse.com>
On Thu, May 07, 2026 at 02:59:16PM +0930, Qu Wenruo wrote:
> [CHANGELOG]
> RFC->v1:
> - Replace the folio_test_ordered() inside extent_writepage_io()
> Now do the check inside alloc_new_bio(), which is already doing the OE
> search.
>
> Now we can detect dirty blocks without an OE at per-block level, much
> better than the previous per-folio level checks, and without any extra
> overhead.
>
> Btrfs has a long history using an internal folio flag called ordered,
> which is to indicate if an fs block is covered by an ordered extent.
>
> However this means we need to synchronize between ordered extents, which
> are managed by a per-inode ordered tree, and folio flag/subpage bitmap.
>
> Furthermore with huge folio support, the ordered bitmap can be as large
> as 64 bytes (512 bits), which is not a small amount.
>
> The series is going to remove folio ordered flag completely, along with
> the ordered subpage bitmap.
>
> Most call sites of folio_test_ordered() are just inside ASSERT()s, so
> it's not too hard to remove them.
>
> There are two call sites that utilizing *_folio_test_ordered():
>
> - Inside extent_writepage_io()
> The warning left by the legacy COW fixup mechanism.
> The 1st patch is to introduce a more reliable way to detect dirty
> blocks without an OE, other than checking the folio ordered flag, now
> it's doing a per-block level check without introducing new overhead.
>
> - Inside btrfs_invalidate_folio()
> We use ordered flag to check if we can skip an ordered extent.
> This is worked around by using the fact that we have waited for
> writeback of the folio, so that endio should have already finished for
> the writeback range. Then check dirty flags to determine if we can skip
> the OE range.
>
> To get a reliable dirty flag for both sub-folio and full-folio cases, we
> can not clear the folio dirty flag early, so the 2nd patch is
> introduced to change the folio dirty flag clearing timing, then the
> 3rd patch can remove the folio_test_ordered() usage.
>
> Then the 4th patch is to remove the remaining folio_test_ordered()
> usage, and finally we can remove the whole ordered flag/subpage bitmap
> completely.
>
> I tried to hide the ordered flag/bitmap behind DEBUG, but unfortunately
> the subpage bitmap macros are not that easy to be tweaked to handle
> conditional ordered flags.
>
> So the ordered flag/bitmap must be either there, or be completely gone.
> I hope enough test runs will cover the removed ASSERT()s.
>
> Qu Wenruo (5):
> btrfs: detect dirty blocks without an ordered extent more reliably
> btrfs: unify folio dirty flag clearing
> btrfs: use dirty flag to check if an ordered extent needs to be
> truncated
> btrfs: remove folio_test_ordered() usage
> btrfs: remove folio ordered flag and subpage bitmap
Please add it to for-next.
prev parent reply other threads:[~2026-05-12 17:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-07 5:29 [PATCH 0/5] btrfs: remove folio ordered flag Qu Wenruo
2026-05-07 5:29 ` [PATCH 1/5] btrfs: detect dirty blocks without an ordered extent more reliably Qu Wenruo
2026-05-07 5:29 ` [PATCH 2/5] btrfs: unify folio dirty flag clearing Qu Wenruo
2026-05-07 5:29 ` [PATCH 3/5] btrfs: use dirty flag to check if an ordered extent needs to be truncated Qu Wenruo
2026-05-07 5:29 ` [PATCH 4/5] btrfs: remove folio_test_ordered() usage Qu Wenruo
2026-05-07 5:29 ` [PATCH 5/5] btrfs: remove folio ordered flag and subpage bitmap Qu Wenruo
2026-05-12 17:35 ` David Sterba [this message]
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=20260512173524.GL2558453@twin.jikos.cz \
--to=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