linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: "linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [PATCH] iomap: don't lose folio dropbehind state for overwrites
Date: Mon, 2 Jun 2025 12:04:33 -0600	[thread overview]
Message-ID: <1a2bea7a-71d0-44b4-a376-9f13c0e28381@kernel.dk> (raw)
In-Reply-To: <878qma9guf.fsf@gmail.com>

On 6/2/25 11:46 AM, Ritesh Harjani (IBM) wrote:
> Jens Axboe <axboe@kernel.dk> writes:
> 
>> DONTCACHE I/O must have the completion punted to a workqueue, just like
>> what is done for unwritten extents, as the completion needs task context
>> to perform the invalidation of the folio(s). However, if writeback is
>> started off filemap_fdatawrite_range() off generic_sync() and it's an
>> overwrite, then the DONTCACHE marking gets lost as iomap_add_to_ioend()
>> don't look at the folio being added and no further state is passed down
>> to help it know that this is a dropbehind/DONTCACHE write.
>>
>> Check if the folio being added is marked as dropbehind, and set
>> IOMAP_IOEND_DONTCACHE if that is the case. Then XFS can factor this into
>> the decision making of completion context in xfs_submit_ioend().
>> Additionally include this ioend flag in the NOMERGE flags, to avoid
>> mixing it with unrelated IO.
>>
>> This fixes extra page cache being instantiated when the write performed
>> is an overwrite, rather than newly instantiated blocks.
>>
>> Fixes: b2cd5ae693a3 ("iomap: make buffered writes work with RWF_DONTCACHE")
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>
>> ---
>>
>> Found this one while testing the unrelated issue of invalidation being a
>> bit broken before 6.15 release. We need this to ensure that overwrites
>> also prune correctly, just like unwritten extents currently do.
> 
> I guess I did report this to you a while ago when I was adding support
> for uncahed buffered-io to xfs_io. But I never heard back from you :( 
> 
> https://lore.kernel.org/all/87h649trof.fsf@gmail.com/
> 
> No worries, good that we finally have this fixed.

Sorry not sure how I missed that, to be fair there were a lot of emails
in various threads on this topic back at that time. Not trying to make
excuses... Yes, at least the "would otherwise have been !task context"
issue is resolved.

-- 
Jens Axboe


      reply	other threads:[~2025-06-02 18:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 15:43 [PATCH] iomap: don't lose folio dropbehind state for overwrites Jens Axboe
2025-05-27 21:12 ` Dave Chinner
2025-05-27 21:17   ` Jens Axboe
2025-06-02 17:46 ` Ritesh Harjani
2025-06-02 18:04   ` Jens Axboe [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=1a2bea7a-71d0-44b4-a376-9f13c0e28381@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ritesh.list@gmail.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;
as well as URLs for NNTP newsgroup(s).