From: Jens Axboe <axboe@kernel.dk>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-block@vger.kernel.org, willy@infradead.org, clm@fb.com,
torvalds@linux-foundation.org, david@fromorbit.com
Subject: Re: [PATCH 5/5] iomap: support RWF_UNCACHED for buffered writes
Date: Thu, 12 Dec 2019 19:38:07 -0700 [thread overview]
Message-ID: <05d7c9c0-cf60-1610-edf9-4c3998ee5c18@kernel.dk> (raw)
In-Reply-To: <20191213022634.GA99868@magnolia>
On 12/12/19 7:26 PM, Darrick J. Wong wrote:
> On Thu, Dec 12, 2019 at 12:01:33PM -0700, Jens Axboe wrote:
>> This adds support for RWF_UNCACHED for file systems using iomap to
>> perform buffered writes. We use the generic infrastructure for this,
>> by tracking pages we created and calling write_drop_cached_pages()
>> to issue writeback and prune those pages.
>>
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>> ---
>> fs/iomap/apply.c | 24 ++++++++++++++++++++++++
>> fs/iomap/buffered-io.c | 23 +++++++++++++++++++----
>> include/linux/iomap.h | 5 +++++
>> 3 files changed, 48 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/iomap/apply.c b/fs/iomap/apply.c
>> index e76148db03b8..11b6812f7b37 100644
>> --- a/fs/iomap/apply.c
>> +++ b/fs/iomap/apply.c
>> @@ -92,5 +92,29 @@ iomap_apply(struct iomap_data *data, const struct iomap_ops *ops,
>> data->flags, &iomap);
>> }
>>
>> + if (written && (data->flags & IOMAP_UNCACHED)) {
>
> Hmmm... why is a chunk of buffered write(?) code landing in the iomap
> apply function?
I'm going to say that Dave suggested it ;-)
> The #define for IOMAP_UNCACHED doesn't have a comment, so I don't know
> what this is supposed to mean. Judging from the one place it gets set
> in the buffered write function I gather that this is how you implement
> the "write through page cache and immediately unmap the page if it
> wasn't there before" behavior?
>
> So based on that, I think you want ...
>
> if IOMAP_WRITE && _UNCACHED && !_DIRECT && written > 0:
> flush and invalidate
Looking at the comments, I did think it was just for writes, but it
looks generic. I'll take the blame for that, we should only call into
that sync-and-invalidate code for buffered writes. I'll make that
change.
> Since direct writes are never going to create page cache, right?
If they do, it's handled separately.
> And in that case, why not put this at the end of iomap_write_actor?
>
> (Sorry if this came up in the earlier discussions, I've been busy this
> week and still have a long way to go for catching up...)
It did come up, the idea is to do it for the full range, not per chunk.
Does that help?
>> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
>> index 30f40145a9e9..30bb248e1d0d 100644
>> --- a/include/linux/iomap.h
>> +++ b/include/linux/iomap.h
>> @@ -48,12 +48,16 @@ struct vm_fault;
>> *
>> * IOMAP_F_BUFFER_HEAD indicates that the file system requires the use of
>> * buffer heads for this mapping.
>> + *
>> + * IOMAP_F_PAGE_CREATE indicates that pages had to be allocated to satisfy
>> + * this operation.
>> */
>> #define IOMAP_F_NEW 0x01
>> #define IOMAP_F_DIRTY 0x02
>> #define IOMAP_F_SHARED 0x04
>> #define IOMAP_F_MERGED 0x08
>> #define IOMAP_F_BUFFER_HEAD 0x10
>> +#define IOMAP_F_PAGE_CREATE 0x20
>
> I think these new flags need an update to the _STRINGS arrays in
> fs/iomap/trace.h.
I'll add that.
>> /*
>> * Flags set by the core iomap code during operations:
>> @@ -121,6 +125,7 @@ struct iomap_page_ops {
>> #define IOMAP_FAULT (1 << 3) /* mapping for page fault */
>> #define IOMAP_DIRECT (1 << 4) /* direct I/O */
>> #define IOMAP_NOWAIT (1 << 5) /* do not block */
>> +#define IOMAP_UNCACHED (1 << 6)
>
> No comment?
Definitely, I'll add a comment.
Thanks for taking a look! I'll incorporate your suggestions.
--
Jens Axboe
next prev parent reply other threads:[~2019-12-13 2:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 19:01 [PATCHSET v4 0/5] Support for RWF_UNCACHED Jens Axboe
2019-12-12 19:01 ` [PATCH 1/5] fs: add read support " Jens Axboe
2019-12-12 21:21 ` Matthew Wilcox
2019-12-12 21:27 ` Jens Axboe
2019-12-12 19:01 ` [PATCH 2/5] mm: make generic_perform_write() take a struct kiocb Jens Axboe
2019-12-12 19:01 ` [PATCH 3/5] mm: make buffered writes work with RWF_UNCACHED Jens Axboe
2019-12-12 19:01 ` [PATCH 4/5] iomap: add struct iomap_data Jens Axboe
2019-12-13 20:32 ` Darrick J. Wong
2019-12-13 20:47 ` Jens Axboe
2019-12-12 19:01 ` [PATCH 5/5] iomap: support RWF_UNCACHED for buffered writes Jens Axboe
2019-12-13 2:26 ` Darrick J. Wong
2019-12-13 2:38 ` Jens Axboe [this message]
2019-12-13 0:53 ` [PATCHSET v4 0/5] Support for RWF_UNCACHED Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2019-12-11 15:29 [PATCHSET v3 " Jens Axboe
2019-12-11 15:29 ` [PATCH 5/5] iomap: support RWF_UNCACHED for buffered writes Jens Axboe
2019-12-11 17:19 ` Matthew Wilcox
2019-12-11 18:05 ` Jens Axboe
2019-12-12 22:34 ` Dave Chinner
2019-12-13 0:54 ` Jens Axboe
2019-12-13 0:57 ` Jens Axboe
2019-12-16 4:17 ` Dave Chinner
2019-12-17 14:31 ` Jens Axboe
2019-12-18 0:49 ` Dave Chinner
2019-12-18 1:01 ` Jens Axboe
2019-12-10 20:42 [PATCHSET v2 0/5] Support for RWF_UNCACHED Jens Axboe
2019-12-10 20:43 ` [PATCH 5/5] iomap: support RWF_UNCACHED for buffered writes Jens Axboe
2019-12-11 1:14 ` Dave Chinner
2019-12-11 14:44 ` Jens Axboe
2019-12-10 16:24 [PATCHSET 0/5] Support for RWF_UNCACHED Jens Axboe
2019-12-10 16:24 ` [PATCH 5/5] iomap: support RWF_UNCACHED for buffered writes Jens Axboe
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=05d7c9c0-cf60-1610-edf9-4c3998ee5c18@kernel.dk \
--to=axboe@kernel.dk \
--cc=clm@fb.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=torvalds@linux-foundation.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