----- Original Message -----
> From: "Al Viro" <viro@xxxxxxxxxxxxxxxxxx>
> To: "Linus Torvalds" <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Cc: "Dave Chinner" <david@xxxxxxxxxxxxx>, "CAI Qian" <caiqian@xxxxxxxxxx>,
> "linux-xfs" <linux-xfs@xxxxxxxxxxxxxxx>,
> xfs@xxxxxxxxxxx, "Jens Axboe" <axboe@xxxxxxxxx>, "Nick Piggin"
> <npiggin@xxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx
> Sent: Friday, September 23, 2016 3:00:32 PM
> Subject: [RFC][CFT] splice_read reworked
>
> The series is supposed to solve the locking order problems for
> ->splice_read() and get rid of code duplication between the read-side
> methods.
> pipe_lock is lifted out of ->splice_read() instances, along with
> waiting for empty space in pipe, etc. - we do that stuff in callers.
> A new variant of iov_iter is introduced - it's backed by a pipe,
> copy_to_iter() results in allocating pages and copying into those,
> copy_page_to_iter() just sticks a reference to that page into pipe.
> Running out of space in pipe yields a short read, as a fault in iovec-backed
> iov_iter would have. Enough primitives are implemented for normal
> ->read_iter() instances to work.
> generic_file_splice_read() switched to feeding such iov_iter to
> ->read_iter() instance. That turns out to be enough to kill almost all
> ->splice_read() instances; the only ones _not_ using
> generic_file_splice_read()
> or default_file_splice_read() (== no zero-copy fallback) are
> fuse_dev_splice_read(), 3 instances in kernel/{relay.c,trace/trace.c} and
> sock_splice_read(). It's almost certainly possible to convert fuse one
> and the same might be possible to do to socket one. relay and tracing
> stuff is just plain weird; might or might not be doable.
>
> Something hopefully working is in
> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git #work.splice_read
Tested-by: CAI Qian <caiqian@xxxxxxxxxx>
|