From: David Howells <dhowells@redhat.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-cachefs@redhat.com, Matthew Wilcox <willy@infradead.org>,
Jeff Layton <jlayton@kernel.org>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
Steve French <sfrench@samba.org>,
Shyam Prasad N <nspmangalore@gmail.com>,
linux-cifs@vger.kernel.org,
Rohith Surabattula <rohiths.msft@gmail.com>,
John Hubbard <jhubbard@nvidia.com>,
Christoph Hellwig <hch@lst.de>,
dhowells@redhat.com, Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
Jeff Layton <jlayton@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 0/4] iov_iter: Add extraction helpers
Date: Thu, 17 Nov 2022 14:54:35 +0000 [thread overview]
Message-ID: <166869687556.3723671.10061142538708346995.stgit@warthog.procyon.org.uk> (raw)
Hi Al,
Here are four patches to provide support for extracting pages from an
iov_iter, where such a thing makes sense, if you could take a look?
The first couple of patches provide iov_iter general stuff:
(1) Move the FOLL_* flags to linux/mm_types.h so that linux/uio.h can make
use of them.
(2) Add a function to list-only, get or pin pages from an iterator as a
future replacement for iov_iter_get_pages*(). Pointers to the pages
are placed into an array (which will get allocated if not provided)
and, depending on the iterator type and direction, the pages will have
a ref or a pin get on them, or left untouched (on the assumption that
the caller manages their lifetime).
The determination is:
UBUF/IOVEC + READ -> pin
UBUF/IOVEC + WRITE -> get
PIPE + READ -> list-only
BVEC/XARRAY -> list-only
Anything else -> EFAULT
It also adds a function by which the caller can determine which of
"list only, get or pin" the extraction function will actually do to
aid in cleaning up (returning 0, FOLL_GET or FOLL_PIN as appropriate).
Then there are a couple of patches that add stuff to netfslib that I want
to use there as well as in cifs:
(3) Add a netfslib function to use (2) to extract pages from an ITER_IOBUF
or ITER_UBUF iterator into an ITER_BVEC iterator. This will get or
pin the pages as appropriate.
(4) Add a netfslib function to extract pages from an iterator that's of
type ITER_UBUF/IOVEC/BVEC/KVEC/XARRAY and add them to a scatterlist.
The function in (2) is used for a UBUF and IOVEC iterators, so those
need cleaning up afterwards. BVEC and XARRAY iterators are ungot and
unpinned and may be rendered into elements that span multiple pages,
for example if large folios are present.
I've pushed the patches here also:
https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=iov-extract
David
Link: https://lore.kernel.org/r/166697254399.61150.1256557652599252121.stgit@warthog.procyon.org.uk/
---
David Howells (4):
mm: Move FOLL_* defs to mm_types.h
iov_iter: Add a function to extract a page list from an iterator
netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator
netfs: Add a function to extract an iterator into a scatterlist
fs/netfs/Makefile | 1 +
fs/netfs/iterator.c | 346 +++++++++++++++++++++++++++++++++++++++
include/linux/mm.h | 74 ---------
include/linux/mm_types.h | 73 +++++++++
include/linux/netfs.h | 5 +
include/linux/uio.h | 29 ++++
lib/iov_iter.c | 333 +++++++++++++++++++++++++++++++++++++
mm/vmalloc.c | 1 +
8 files changed, 788 insertions(+), 74 deletions(-)
create mode 100644 fs/netfs/iterator.c
next reply other threads:[~2022-11-17 14:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 14:54 David Howells [this message]
2022-11-17 14:54 ` [RFC PATCH 1/4] mm: Move FOLL_* defs to mm_types.h David Howells
2022-11-17 23:15 ` John Hubbard
2022-11-22 12:46 ` Christoph Hellwig
2022-11-17 14:54 ` [RFC PATCH 2/4] iov_iter: Add a function to extract a page list from an iterator David Howells
2022-11-22 12:51 ` Christoph Hellwig
2022-11-22 13:36 ` David Howells
2022-11-17 14:55 ` [RFC PATCH 3/4] netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator David Howells
2022-11-17 14:55 ` [RFC PATCH 4/4] netfs: Add a function to extract an iterator into a scatterlist David Howells
2022-11-18 11:07 ` [RFC PATCH 3/4] netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator David Howells
2022-11-18 11:08 ` [RFC PATCH 4/4] netfs: Add a function to extract an iterator into a scatterlist David Howells
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=166869687556.3723671.10061142538708346995.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=jhubbard@nvidia.com \
--cc=jlayton@kernel.org \
--cc=linux-cachefs@redhat.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nspmangalore@gmail.com \
--cc=rohiths.msft@gmail.com \
--cc=sfrench@samba.org \
--cc=viro@zeniv.linux.org.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.