From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
djwong@kernel.org, josef@toxicpanda.com, david@fromorbit.com
Subject: Re: [PATCH 2/2] iomap: make zero range flush conditional on unwritten mappings
Date: Tue, 27 Aug 2024 10:23:10 -0400 [thread overview]
Message-ID: <Zs3hTiXLtuwXkYgU@bfoster> (raw)
In-Reply-To: <Zs1uHoemE7jHQ2bw@infradead.org>
On Mon, Aug 26, 2024 at 11:11:42PM -0700, Christoph Hellwig wrote:
> On Thu, Aug 22, 2024 at 10:59:10AM -0400, Brian Foster wrote:
> > Note that we also flush for hole mappings because iomap_zero_range()
> > is used for partial folio zeroing in some cases. For example, if a
> > folio straddles EOF on a sub-page FSB size fs, the post-eof portion
> > is hole-backed and dirtied/written via mapped write, and then i_size
> > increases before writeback can occur (which otherwise zeroes the
> > post-eof portion of the EOF folio), then the folio becomes
> > inconsistent with disk until reclaimed.
>
> Eww. I'm not sure iomap_zero_range is the right way to handle this
> even if that's what we have now and it kinda work.
>
Yeah, I agree with that. That was one of the minor appeals (to me) of the
prototype I posted a while back that customizes iomap_truncate_page() to
do unconditional zeroing instead of being an almost pointless wrapper
for iomap_zero_range(). I don't quite recall if that explicitly handled
the hole case since it was quickly hacked together, but the general idea
is that it could be more purpose built for these partial zeroing cases
than zero range might be.
There are some other caveats with that approach that would still require
some variant of zero range, however, so I'm not immediately clear on
what the ideal high level solution looks like quite yet. I'd like to get
the existing mechanism working correctly, improve the test situation and
go from there.
> > + /*
> > + * We can skip pre-zeroed mappings so long as either the mapping was
> > + * clean before we started or we've flushed at least once since.
> > + * Otherwise we don't know whether the current mapping had dirty
> > + * pagecache, so flush it now, stale the current mapping, and proceed
> > + * from there.
> > + */
> > + if (srcmap->type == IOMAP_HOLE || srcmap->type == IOMAP_UNWRITTEN) {
>
> .. at very least the above needs to be documented here as a big fat
> reminder, though.
>
Sure, I'll include that explanation in the code comments in v2. Thanks.
Brian
> Otherwise the series looks sensible to me.
>
>
next prev parent reply other threads:[~2024-08-27 14:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 14:59 [PATCH 0/2] iomap: flush dirty cache over unwritten mappings on zero range Brian Foster
2024-08-22 14:59 ` [PATCH 1/2] iomap: fix handling of dirty folios over unwritten extents Brian Foster
2024-08-22 14:59 ` [PATCH 2/2] iomap: make zero range flush conditional on unwritten mappings Brian Foster
2024-08-27 6:11 ` Christoph Hellwig
2024-08-27 14:23 ` Brian Foster [this message]
2024-08-28 4:32 ` Christoph Hellwig
2024-08-28 12:35 ` Brian Foster
2024-08-29 5:41 ` Christoph Hellwig
2024-08-29 15:05 ` Brian Foster
2024-08-29 21:48 ` Darrick J. Wong
2024-08-30 11:57 ` Brian Foster
2024-08-30 23:02 ` Darrick J. Wong
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=Zs3hTiXLtuwXkYgU@bfoster \
--to=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.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