[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YpWvolJHuCWAnL62@infradead.org>
Date: Mon, 30 May 2022 23:03:14 -0700
From: Christoph Hellwig <hch@...radead.org>
To: David Howells <dhowells@...hat.com>
Cc: Steve French <smfrench@...il.com>,
Shyam Prasad N <nspmangalore@...il.com>,
Rohith Surabattula <rohiths.msft@...il.com>,
Jeff Layton <jlayton@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>, linux-cifs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/9] iov_iter: Add a function to extract an iter's
buffers to a bvec iter
On Fri, May 27, 2022 at 11:44:02AM +0100, David Howells wrote:
> Copy cifs's setup_aio_ctx_iter() and to lib/iov_iter.c and generalise it as
> extract_iter_to_iter(). This allocates and sets up an array of bio_vecs
> for all the page fragments in an I/O iterator and sets a second supplied
> iterator to bvec-type pointing to the array.
>
> This is can be used when setting up for a direct I/O or an asynchronous I/O
> to set up a record of the page fragments that are going to contribute to
> the buffer, paging them all in to prevent DIO->mmap loops and allowing the
> original iterator to be deallocated (it may be on the stack of the caller).
>
> Note that extract_iter_to_iter() doesn't actually need to make a separate
> allocation for the page array. It can place the page array at the end of
> the bvec array storage, provided it traverses both arrays from the 0th
> element forwards.
I really do not like this as a general purpose helper. This is an odd
quirk that we really generally should not needed unless you have very
convoluted locking. So please keep it inside of cifs.
Powered by blists - more mailing lists