linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: dhowells@redhat.com, jlayton@redhat.com, smfrench@gmail.com,
	hch@infradead.org, willy@infradead.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [RFC][PATCH] iov_iter: Add extraction functions
Date: Tue, 18 Oct 2022 15:29:42 +0100	[thread overview]
Message-ID: <281330.1666103382@warthog.procyon.org.uk> (raw)
In-Reply-To: <Yy5pzHiQ4GRCOoXV@ZenIV>

Al Viro <viro@zeniv.linux.org.uk> wrote:

> IDGI.  Essentially, you are passing a callback disguised as enum, only to
> lose any type safety.

Granted, but this is how struct iov_iter works.  I'm keeping the enum inside
the internal functions where it can't be got at by external code.

Now, I could just copy the code three times, once for iter=>bvec, once for
iter=>sg and once for iter=>rdma.  I can also grant that iter=>bvec is really
only needed for UBUF/IOVEC-class iterators; I think I can make the assumption
that kernel-supplied buffers are good for the lifetime of the operation.

> How is it better than "iov_iter_get_pages2() into a
> fixed-sized array and handle the result" done in a loop?

Note that iov_iter_get_pages2() doesn't handle KVEC-class iterators, which
this code does - for kmalloc'd, vmalloc'd and vmap'd memory and for global and
stack variables.  What I've written gets the physical addresses but
doesn't/can't pin it (which probably means I can't just move my code into
iov_iter_get_pages2()).

Further, my code also treats multipage folios as single units which
iov_iter_get_pages2() also doesn't - at least from XARRAY-class iterators.

The UBUF-/IOVEC-extraction code doesn't handle multipage folios because
get_user_pages_fast() doesn't - though perhaps it will need to at some point.

David


  parent reply	other threads:[~2022-10-18 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 23:18 [RFC][PATCH] iov_iter: Add extraction functions David Howells
2022-09-24  2:22 ` Al Viro
2022-10-14 12:22 ` David Howells
2022-10-18 14:29 ` David Howells [this message]
2022-10-18 14:48   ` Christoph Hellwig

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=281330.1666103382@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=jlayton@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=smfrench@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).