From: David Howells <dhowells@redhat.com>
To: Steve French <smfrench@gmail.com>, Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-cachefs@redhat.com, John Hubbard <jhubbard@nvidia.com>,
linux-cifs@vger.kernel.org, linux-rdma@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>,
linux-mm@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
Steve French <sfrench@samba.org>,
Shyam Prasad N <nspmangalore@gmail.com>,
linux-crypto@vger.kernel.org,
Rohith Surabattula <rohiths.msft@gmail.com>,
Christoph Hellwig <hch@lst.de>,
dhowells@redhat.com, Shyam Prasad N <nspmangalore@gmail.com>,
Rohith Surabattula <rohiths.msft@gmail.com>,
Tom Talpey <tom@talpey.com>,
Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
Jeff Layton <jlayton@kernel.org>,
linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 00/12] smb3: Add iter helpers and use iov_iters down to the network transport
Date: Tue, 01 Nov 2022 16:30:41 +0000 [thread overview]
Message-ID: <166732024173.3186319.18204305072070871546.stgit@warthog.procyon.org.uk> (raw)
Hi Steve, Al, Christoph,
Here's an updated version of a subset of my branch to make the cifs/smb3
driver pass iov_iters down to the lowest layers where they can be passed to
the network transport.
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 extract/get/pin pages from an iterator as a future
replacement for iov_iter_get_pages*(). It also adds a function by
which the caller can determine which of "extract/get/pin" the
extraction function will actually do to aid in cleaning up.
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.
(4) Add a netfslib function to use (2) 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 can be rendered into elements that span multiple pages.
Then there are some cifs helpers that work with iterators:
(5) Implement cifs_splice_read() to use an ITER_BVEC rather than an
ITER_PIPE, bulk-allocating the pages, attaching them to the bvec,
doing the I/O and then pushing the pages into the pipe. This avoids
the problem with cifs wanting to split the pipe iterator in a later
patch.
(6) Add a function to walk through an ITER_BVEC/KVEC/XARRAY iterator and
add elements to an RDMA SGE list. Only the DMA addresses are stored,
and an element may span multiple pages (say if an xarray contains a
multipage folio).
(7) Add a function to walk through an ITER_BVEC/KVEC/XARRAY iterator and
pass the contents into a shash function.
(8) Add functions to walk through an ITER_XARRAY iterator and perform
various sorts of cleanup on the folios held therein, to be used on I/o
completion.
(9) Add a function to read from the transport TCP socket directly into an
iterator.
Then come the patches that actually do the work of iteratorising cifs:
(10) The main patch. Replace page lists with iterators. It extracts the
pages from ITER_UBUF and ITER_IOVEC iterators to an ITER_BVEC
iterator, pinning or getting refs on them, before passing them down as
the I/O may be done from a worker thread.
The iterator is extracted into a scatterlist in order to talk to the
crypto interface or to do RDMA.
(11) In the cifs RDMA code, extract the iterator into an RDMA SGE[] list,
removing the scatterlist intermediate - at least for smbd_send().
There appear to be other ways for cifs to talk to the RDMA layer that
don't go through that that I haven't managed to work out.
(12) Remove a chunk of now-unused code.
Note also that I haven't managed to test all the combinations of transport.
Samba doesn't support RDMA and ksmbd doesn't support encryption. I can
test them separately, but not together. That said, rdma, sign, seal and
sign+seal seem to work.
I've pushed the patches here also:
https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=cifs-for-viro
Note that this is based on a merge of Al's work.iov_iter branch with
v6.1-rc2.
David
Link: https://lore.kernel.org/r/166697254399.61150.1256557652599252121.stgit@warthog.procyon.org.uk/
---
David Howells (12):
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
cifs: Implement splice_read to pass down ITER_BVEC not ITER_PIPE
cifs: Add a function to build an RDMA SGE list from an iterator
cifs: Add a function to Hash the contents of an iterator
cifs: Add some helper functions
cifs: Add a function to read into an iter from a socket
cifs: Change the I/O paths to use an iterator rather than a page list
cifs: Build the RDMA SGE list directly from an iterator
cifs: Remove unused code
fs/cifs/Kconfig | 1 +
fs/cifs/cifsencrypt.c | 172 +++-
fs/cifs/cifsfs.c | 12 +-
fs/cifs/cifsfs.h | 6 +
fs/cifs/cifsglob.h | 31 +-
fs/cifs/cifsproto.h | 11 +-
fs/cifs/cifssmb.c | 13 +-
fs/cifs/connect.c | 16 +
fs/cifs/file.c | 1793 ++++++++++++++++++--------------------
fs/cifs/fscache.c | 22 +-
fs/cifs/fscache.h | 10 +-
fs/cifs/misc.c | 127 +--
fs/cifs/smb2ops.c | 378 ++++----
fs/cifs/smb2pdu.c | 45 +-
fs/cifs/smbdirect.c | 503 +++++++----
fs/cifs/smbdirect.h | 4 +-
fs/cifs/transport.c | 57 +-
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 +++++++
24 files changed, 2390 insertions(+), 1672 deletions(-)
create mode 100644 fs/netfs/iterator.c
next reply other threads:[~2022-11-01 16:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 16:30 David Howells [this message]
2022-11-01 16:30 ` [RFC PATCH 01/12] mm: Move FOLL_* defs to mm_types.h David Howells
2022-11-01 16:30 ` [RFC PATCH 02/12] iov_iter: Add a function to extract a page list from an iterator David Howells
2022-11-01 16:31 ` [RFC PATCH 03/12] netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator David Howells
2022-11-01 16:31 ` [RFC PATCH 04/12] netfs: Add a function to extract an iterator into a scatterlist David Howells
2022-11-01 16:31 ` [RFC PATCH 05/12] cifs: Implement splice_read to pass down ITER_BVEC not ITER_PIPE David Howells
2022-11-01 16:31 ` [RFC PATCH 06/12] cifs: Add a function to build an RDMA SGE list from an iterator David Howells
2022-11-01 16:31 ` [RFC PATCH 07/12] cifs: Add a function to Hash the contents of " David Howells
2022-11-01 16:31 ` [RFC PATCH 08/12] cifs: Add some helper functions David Howells
2022-11-01 16:31 ` [RFC PATCH 09/12] cifs: Add a function to read into an iter from a socket David Howells
2022-11-01 16:31 ` [RFC PATCH 10/12] cifs: Change the I/O paths to use an iterator rather than a page list David Howells
2022-11-01 16:32 ` [RFC PATCH 11/12] cifs: Build the RDMA SGE list directly from an iterator David Howells
2022-11-01 16:32 ` [RFC PATCH 12/12] cifs: Remove unused code 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=166732024173.3186319.18204305072070871546.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-crypto@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=nspmangalore@gmail.com \
--cc=rohiths.msft@gmail.com \
--cc=sfrench@samba.org \
--cc=smfrench@gmail.com \
--cc=tom@talpey.com \
--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.