From: Jens Axboe <axboe@kernel.dk>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: cem@kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] iomap: make buffered writes work with RWF_DONTCACHE
Date: Mon, 3 Feb 2025 11:26:54 -0700 [thread overview]
Message-ID: <20bd06ae-0410-4243-a850-6cd10934c3ce@kernel.dk> (raw)
In-Reply-To: <20250203171930.GA134532@frogsfrogsfrogs>
On 2/3/25 10:19 AM, Darrick J. Wong wrote:
> On Mon, Feb 03, 2025 at 09:32:38AM -0700, Jens Axboe wrote:
>> Add iomap buffered write support for RWF_DONTCACHE. If RWF_DONTCACHE is
>> set for a write, mark the folios being written as uncached. Then
>> writeback completion will drop the pages. The write_iter handler simply
>> kicks off writeback for the pages, and writeback completion will take
>> care of the rest.
>>
>> This still needs the user of the iomap buffered write helpers to call
>> folio_end_dropbehind_write() upon successful issue of the writes.
>
> I thought iomap calls folio_end_writeback, which cares of that? So xfs
> doesn't itself have to call folio_end_dropbehind_write?
Yep it does, stale commit message! I'll fix it up and send out a v2.
>> fs/iomap/buffered-io.c | 4 ++++
>> include/linux/iomap.h | 1 +
>> 2 files changed, 5 insertions(+)
>>
>> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
>> index d303e6c8900c..ea863c3cf510 100644
>> --- a/fs/iomap/buffered-io.c
>> +++ b/fs/iomap/buffered-io.c
>> @@ -603,6 +603,8 @@ struct folio *iomap_get_folio(struct iomap_iter *iter, loff_t pos, size_t len)
>>
>> if (iter->flags & IOMAP_NOWAIT)
>> fgp |= FGP_NOWAIT;
>> + if (iter->flags & IOMAP_DONTCACHE)
>> + fgp |= FGP_DONTCACHE;
>> fgp |= fgf_set_order(len);
>>
>> return __filemap_get_folio(iter->inode->i_mapping, pos >> PAGE_SHIFT,
>> @@ -1034,6 +1036,8 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i,
>>
>> if (iocb->ki_flags & IOCB_NOWAIT)
>> iter.flags |= IOMAP_NOWAIT;
>> + if (iocb->ki_flags & IOCB_DONTCACHE)
>> + iter.flags |= IOMAP_DONTCACHE;
>>
>> while ((ret = iomap_iter(&iter, ops)) > 0)
>> iter.processed = iomap_write_iter(&iter, i);
>> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
>> index 75bf54e76f3b..26b0dbe23e62 100644
>> --- a/include/linux/iomap.h
>> +++ b/include/linux/iomap.h
>> @@ -183,6 +183,7 @@ struct iomap_folio_ops {
>> #define IOMAP_DAX 0
>> #endif /* CONFIG_FS_DAX */
>> #define IOMAP_ATOMIC (1 << 9)
>> +#define IOMAP_DONTCACHE (1 << 10)
>
> This needs a mention in the iomap documentation. If the patch below
> accurately summarizes what it does nowadays, then you can add it to the
> series with a:
Thanks Darrick, I'll add that and your SOB as well.
--
Jens Axboe
next prev parent reply other threads:[~2025-02-03 18:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 16:32 [PATCHSET 0/2] Add XFS support for RWF_DONTCACHE Jens Axboe
2025-02-03 16:32 ` [PATCH 1/2] iomap: make buffered writes work with RWF_DONTCACHE Jens Axboe
2025-02-03 17:19 ` Darrick J. Wong
2025-02-03 18:26 ` Jens Axboe [this message]
2025-02-03 16:32 ` [PATCH 2/2] xfs: flag as supporting FOP_DONTCACHE Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2025-02-04 18:39 [PATCHSET v2 0/2] Add XFS support for RWF_DONTCACHE Jens Axboe
2025-02-04 18:39 ` [PATCH 1/2] iomap: make buffered writes work with RWF_DONTCACHE Jens Axboe
2025-02-20 6:06 ` Christoph Hellwig
2025-02-27 9:51 ` Carlos Maiolino
2025-02-27 10:30 ` Christian Brauner
2025-02-27 10:57 ` Carlos Maiolino
2025-02-27 15:14 ` Christoph Hellwig
2025-02-28 10:38 ` Christian Brauner
2025-03-03 13:07 ` John Garry
2025-03-12 20:40 ` Chaitanya Kulkarni
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=20bd06ae-0410-4243-a850-6cd10934c3ce@kernel.dk \
--to=axboe@kernel.dk \
--cc=cem@kernel.org \
--cc=djwong@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