public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Brian Foster <bfoster@redhat.com>
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: Mon, 26 Aug 2024 23:11:42 -0700	[thread overview]
Message-ID: <Zs1uHoemE7jHQ2bw@infradead.org> (raw)
In-Reply-To: <20240822145910.188974-3-bfoster@redhat.com>

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.

> +	/*
> +	 * 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.

Otherwise the series looks sensible to me.


  reply	other threads:[~2024-08-27  6:11 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 [this message]
2024-08-27 14:23     ` Brian Foster
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=Zs1uHoemE7jHQ2bw@infradead.org \
    --to=hch@infradead.org \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.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