Re: [PATCH v18 09/15] iov_iter: Kill ITER_PIPE

From: Al Viro
Date: Thu Apr 20 2023 - 18:37:19 EST


On Thu, Apr 20, 2023 at 11:22:31PM +0100, Al Viro wrote:
> On Tue, Mar 14, 2023 at 10:07:51PM +0000, David Howells wrote:
> > The ITER_PIPE-type iterator was only used for generic_file_splice_read(),
> > but that has now been switched to either pull pages directly from the
> > pagecache for buffered file splice-reads or to use ITER_BVEC instead for
> > O_DIRECT file splice-reads. This leaves ITER_PIPE unused - so remove it.
>
> Wonderful, except that now you've got duplicates of ->read_iter() for
> everyone who wants zero-copy on ->splice_read() ;-/
>
> I understand the attraction of arbitrary seeks on those suckers; ITER_PIPE
> is a massive headache in that respect. But I really don't like what your
> approach trades it for.
>
> And you are nowhere near done - consider e.g. NFS. Mainline has it
> feed ITER_PIPE to nfs_file_read(), which does call generic_file_read_iter() -
> after
> result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
>
> Sure, you can add nfs_file_splice_read() that would do what nfs_file_read()
> does, calling filemap_spice_read() instead of generic_file_read_iter().
>
> Repeat the same for ocfs2 (locking of its own). And orangefs. And
> XFS (locking, again). And your own AFS, while we are at it. Et sodding
> cetera - *everything* that uses generic_file_splice_read() with
> ->read_iter other than generic_file_read_iter() needs review and,
> quite likely, a ->splice_read() instance of its own.

Don't get me wrong - I'd love to kill ITER_PIPE off; it's just that tons
of ->splice_read() duplicating the corresponding ->read_iter() up to the
point where it would call generic_file_read_iter(), modulo ignoring
O_DIRECT case and then calling filemap_splice_read() instead... Painful
and asking for trouble down the road.