From: Brian Foster <bfoster@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org, hch@infradead.org,
djwong@kernel.org, willy@infradead.org
Subject: [PATCH v2 0/7] iomap: zero range folio batch support
Date: Mon, 14 Jul 2025 09:20:52 -0400 [thread overview]
Message-ID: <20250714132059.288129-1-bfoster@redhat.com> (raw)
Hi all,
Quick update.. This series was held up by testing work on my end. I
don't have the custom test to go along with patch 7 yet, but hch was
asking for updates, I have vacation looming, and realistically I wasn't
going to get to that beforehand. So I'm posting v2 without the
additional test and reviewers can decide if/how to proceed in the
meantime. Either way, I'll pick up where this leaves off.
Zero range is still obviously functionally testable. We just don't yet
have the enhanced coverage I was hoping for via the errortag knobs.
There are also a couple small fstests failures related to to tests that
explicitly expect unwritten extents in cases where this now decides to
perform zeroing (generic/009, xfs/242). I don't consider these
functional regressions, but the tests need to be fixed up to accommodate
behavior. Again, I'll get back to this stuff either way, it's just going
to be a couple weeks or so at least at this point. Thanks.
Brian
--- Original cover letter ---
Hi all,
Here's a first real v1 of folio batch support for iomap. This initially
only targets zero range, the use case being zeroing of dirty folios over
unwritten mappings. There is potential to support other operations in
the future: iomap seek data/hole has similar raciness issues as zero
range, the prospect of using this for buffered write has been raised for
granular locking purposes, etc.
The one major caveat with this zero range implementation is that it
doesn't look at iomap_folio_state to determine whether to zero a
sub-folio portion of the folio. Instead it just relies on whether the
folio was dirty or not. This means that spurious zeroing of unwritten
ranges is possible if a folio is dirty but the target range includes a
subrange that is not.
The reasoning is that this is essentially a complexity tradeoff. The
current use cases for iomap_zero_range() are limited mostly to partial
block zeroing scenarios. It's relatively harmless to zero an unwritten
block (i.e. not a correctness issue), and this is something that
filesystems have done in the past without much notice or issue. The
advantage is less code and this makes it a little easier to use a
filemap lookup function for the batch rather than open coding more logic
in iomap. That said, this can probably be enhanced to look at ifs in the
future if the use case expands and/or other operations justify it.
WRT testing, I've tested with and without a local hack to redirect
fallocate zero range calls to iomap_zero_range() in XFS. This helps test
beyond the partial block/folio use case, i.e. to cover boundary
conditions like full folio batch handling, etc. I recently added patch 7
in spirit of that, which turns this logic into an XFS errortag. Further
comments on that are inline with patch 7.
Thoughts, reviews, flames appreciated.
Brian
v2:
- Move filemap patch to top. Add some comments and drop export.
- Drop unnecessary BUG_ON()s from iomap_write_begin() instead of moving.
- Added folio mapping check to batch codepath, improved comments.
v1: https://lore.kernel.org/linux-fsdevel/20250605173357.579720-1-bfoster@redhat.com/
- Dropped most prep patches from previous version (merged separately).
- Reworked dirty folio lookup to use find_get_entry() loop (new patch
for filemap helper).
- Misc. bug fixes, code cleanups, comments, etc.
- Added (RFC) prospective patch for wider zero range test coverage.
RFCv2: https://lore.kernel.org/linux-fsdevel/20241213150528.1003662-1-bfoster@redhat.com/
- Port onto incremental advance, drop patch 1 from RFCv1.
- Moved batch into iomap_iter, dynamically allocate and drop flag.
- Tweak XFS patch to always trim zero range on EOF boundary.
RFCv1: https://lore.kernel.org/linux-fsdevel/20241119154656.774395-1-bfoster@redhat.com/
Brian Foster (7):
filemap: add helper to look up dirty folios in a range
iomap: move pos+len BUG_ON() to after folio lookup
iomap: optional zero range dirty folio processing
xfs: always trim mapping to requested range for zero range
xfs: fill dirty folios on zero range of unwritten mappings
iomap: remove old partial eof zeroing optimization
xfs: error tag to force zeroing on debug kernels
fs/iomap/buffered-io.c | 116 +++++++++++++++++++++++++----------
fs/iomap/iter.c | 6 ++
fs/xfs/libxfs/xfs_errortag.h | 4 +-
fs/xfs/xfs_error.c | 3 +
fs/xfs/xfs_file.c | 21 +++++--
fs/xfs/xfs_iomap.c | 38 +++++++++---
include/linux/iomap.h | 4 ++
include/linux/pagemap.h | 2 +
mm/filemap.c | 58 ++++++++++++++++++
9 files changed, 205 insertions(+), 47 deletions(-)
--
2.50.0
next reply other threads:[~2025-07-14 13:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 13:20 Brian Foster [this message]
2025-07-14 13:20 ` [PATCH v2 1/7] filemap: add helper to look up dirty folios in a range Brian Foster
2025-07-14 13:19 ` Christoph Hellwig
2025-07-14 13:20 ` [PATCH v2 2/7] iomap: move pos+len BUG_ON() to after folio lookup Brian Foster
2025-07-14 13:20 ` Christoph Hellwig
2025-07-14 13:42 ` Brian Foster
2025-07-14 13:20 ` [PATCH v2 3/7] iomap: optional zero range dirty folio processing Brian Foster
2025-07-14 13:20 ` Christoph Hellwig
2025-07-14 13:20 ` [PATCH v2 4/7] xfs: always trim mapping to requested range for zero range Brian Foster
2025-07-14 13:20 ` [PATCH v2 5/7] xfs: fill dirty folios on zero range of unwritten mappings Brian Foster
2025-07-14 13:21 ` Christoph Hellwig
2025-07-14 13:20 ` [PATCH v2 6/7] iomap: remove old partial eof zeroing optimization Brian Foster
2025-07-14 13:20 ` [PATCH v2 7/7] xfs: error tag to force zeroing on debug kernels Brian Foster
2025-07-14 13:23 ` Christoph Hellwig
2025-07-14 13:42 ` Brian Foster
2025-07-14 14:12 ` Brian Foster
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=20250714132059.288129-1-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).