[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2331410.1673945056@warthog.procyon.org.uk>
Date: Tue, 17 Jan 2023 08:44:16 +0000
From: David Howells <dhowells@...hat.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: dhowells@...hat.com, Al Viro <viro@...iv.linux.org.uk>,
Matthew Wilcox <willy@...radead.org>,
Jens Axboe <axboe@...nel.dk>, Jan Kara <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>,
Logan Gunthorpe <logang@...tatee.com>,
linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
David Hildenbrand <david@...hat.com>
Subject: Re: [PATCH v6 03/34] iov_iter: Pass I/O direction into iov_iter_get_pages*()
Christoph Hellwig <hch@...radead.org> wrote:
> On Mon, Jan 16, 2023 at 11:08:24PM +0000, David Howells wrote:
> > Define FOLL_SOURCE_BUF and FOLL_DEST_BUF to indicate to get_user_pages*()
> > and iov_iter_get_pages*() how the buffer is intended to be used in an I/O
> > operation. Don't use READ and WRITE as a read I/O writes to memory and
> > vice versa - which causes confusion.
> >
> > The direction is checked against the iterator's data_source.
>
> Why can't we use the existing FOLL_WRITE?
Because FOLL_WRITE doesn't mean the same as WRITE:
(1) It looks like it should really be FOLL_CHECK_PTES_WRITABLE. It's not
defined as being anything to do with the I/O.
(2) The reason Al added ITER_SOURCE and ITER_DEST is that the use of READ and
WRITE with the iterators is confusing and kind of inverted - and the same
would apply with using FOLL_WRITE:
if (rw == READ)
gup_flags |= FOLL_WRITE;
So my thought is to make how you are using the buffer described by the
iterator explicit: "I'm using it as a source buffer" or "I'm using it as a
destination buffer".
Also, I don't want it to be FOLL_WRITE or 0. I want it to be written
explicitly in both cases. If you're going to insist on using FOLL_WRITE, then
there should be a FOLL_READ to go with it, even if it's #defined to 0.
David
Powered by blists - more mailing lists