mbox series

[RFC,0/9] smb3: Add iter helpers and use iov_iters down to the network transport

Message ID 166697254399.61150.1256557652599252121.stgit@warthog.procyon.org.uk (mailing list archive)
Headers show
Series smb3: Add iter helpers and use iov_iters down to the network transport | expand


David Howells Oct. 28, 2022, 3:55 p.m. UTC
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.

Al, Christoph: Could you look at the first four patches and see if you're okay
with them - at least on a temporary basis so that I can get this moving?

Note that patch (4) uses kmap_local_folio() to map an entire folio - this is
wrong.  I'm going to try using Willy's vmap_folio() code - but I haven't done
that yet.

The first two patches are placed in netfslib as I have patches for netfslib
that will want to use them:

 (1) Add a function to extract part of an IOVEC-/UBUF-type iterator into a
     BVEC-type iterator.  Refs are taken on the pages to prevent them from

 (2) Add a function to extract part of an iterator into a scatterlist.  If
     extracting from an IOVEC-/UBUF-type iterator, the pages have refs taken on
     them; any other type and they don't.

     It might be worth splitting this into two separate functions, one for
     IOVEC/UBUF that refs and one for the others that doesn't.

The other patches are placed in cifs as they're only used by cifs for now.

 (3) Add a function to build an RDMA SGE list from a BVEC-, KVEC- or
     XARRAY-type iterator.  It's left to the caller to make sure they don't

 (4) Add a function to hash part of the contents of a BVEC-, KVEC- or
     XARRAY-type iterator.

I will need to make use of thew proposed page pinning when it becomes
available, but that's not yet.

Changes made in a later patch in the series make the upper layers convert an
IOVEC-/UBUF-iterator to a BVEC-type iterator in direct/unbuffered I/O so that
the signing, crypt and RDMA code see the BVEC instead of user buffers.

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:


David Howells (9):
      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: 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/cifsencrypt.c |  167 +++-
 fs/cifs/cifsfs.h      |    3 +
 fs/cifs/cifsglob.h    |   30 +-
 fs/cifs/cifsproto.h   |   11 +-
 fs/cifs/cifssmb.c     |   13 +-
 fs/cifs/connect.c     |   16 +
 fs/cifs/file.c        | 1700 ++++++++++++++++++-----------------------
 fs/cifs/fscache.c     |   22 +-
 fs/cifs/fscache.h     |   10 +-
 fs/cifs/misc.c        |  110 +--
 fs/cifs/smb2ops.c     |  378 +++++----
 fs/cifs/smb2pdu.c     |   44 +-
 fs/cifs/smbdirect.c   |  503 +++++++-----
 fs/cifs/smbdirect.h   |    4 +-
 fs/cifs/transport.c   |   57 +-
 fs/netfs/Makefile     |    1 +
 fs/netfs/iterator.c   |  347 +++++++++
 include/linux/netfs.h |    5 +
 18 files changed, 1835 insertions(+), 1586 deletions(-)
 create mode 100644 fs/netfs/iterator.c