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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 21, 2023 at 02:11:45AM +0100, Al Viro wrote:
> On Thu, Apr 20, 2023 at 11:36:57PM +0100, Al Viro wrote:
> 
> > 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.
> 
> FWIW, broken in this series:
> 	* a bunch of 9p variants (those could probably switch to direct)
> 	* afs
> 	* ceph (very likely)
> 	* ecryptfs (atime propagation)
> 	* dax on various filesystems (probably)
> 	* f2fs
> 	* gfs2
> 	* nfs
> 	* ocfs2
> 	* orangefs
> 	* xfs
> 	* zonefs (probably)
> 	* splice from UDP sockets, unless I'm misreading something.
> Your sock_splice_read() still falls back to generic_file_splice_read(),
> rather than to direct_splice_read() and sockets don't have O_DIRECT
> in flags.  Neither do they have associated page cache ;-)
> 
> Sure, we could provide a bunch of ->splice_read(), but then we'd have to make
> sure that all subsequent changes to matching ->read_iter() get duplicated -
> unless they are on O_DIRECT-only paths, that is...

OK, how about the following modification of ITER_PIPE?
	* buffers might extend past the current position
	* buffers (as now) are either data or zero-copy ones.
	* advance past the end of data => allocate data-type buffers
and fill with zeroes.
	* copying data to area prior to the end of buffers => each
zero-copy-type buffer is converted to a data one; data is copied,
but WTF else can you do?  If there's a page borrowed from page
cache, we can't change its contents anyway.
	* zero-copy of a page into an area overlapping the existing
buffers => treat as data copy for the overlapping part and zero-copy
the rest (if any) in normal fashion.
	* iov_iter_get_pages(): convert everything involved into
data-type buffers first, then give caller references to that.
Zero-fill new pages (if any).
	* iov_iter_revert() does *NOT* truncate anything
	* truncation of stuff past the current position is done by
generic_file_splice_read() not only in error case, but on success
as well - starting at the end of actually read data, of course.

That would make for seekable ITER_PIPE, with zero-copy working for
normal cases.  I agree that O_DIRECT would probably be better off
with ITER_BVEC.

Comments?




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux