From mboxrd@z Thu Jan 1 00:00:00 1970 From: NeilBrown Subject: Re: Why "splice" doesn't splice between two non-pipes? Date: Sat, 28 Jun 2014 18:38:48 +1000 Message-ID: <20140628183848.735f58c4@notabene.brown> References: <1403886882.636943870@f261.i.mail.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/39Xs16epA_qXkuKJsrUak8f"; protocol="application/pgp-signature" Cc: linux-fsdevel@vger.kernel.org To: Askar Safin Return-path: Received: from cantor2.suse.de ([195.135.220.15]:44486 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751237AbaF1Ii5 (ORCPT ); Sat, 28 Jun 2014 04:38:57 -0400 In-Reply-To: <1403886882.636943870@f261.i.mail.ru> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --Sig_/39Xs16epA_qXkuKJsrUak8f Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 27 Jun 2014 20:34:42 +0400 Askar Safin wrote: > Why "splice" doesn't splice between two non-pipes? I think such splice wo= uld be very useful (not only file-to-socket). For example, for dd, cp, cp -= r. Also, it seems, the kernel already supports splice between non-pipes (do= _splice_direct function), this function is just not available to userspace.= (The patch is just an idea, not tested. I don't know how to actually add t= his feature.) >=20 > =3D=3D > Askar Safin >=20 > diff --git a/fs/splice.c b/fs/splice.c > index d37431d..ffb95db 100644 > --- a/fs/splice.c > +++ b/fs/splice.c > @@ -1394,7 +1394,7 @@ static long do_splice(struct file *in, loff_t __use= r *off_in, > return ret; > } > =20 > - return -EINVAL; > + return do_splice_direct(in, off_in, out, off_out, len, flags); > } > =20 > /* Consider using "sendfile" instead of "splice". NeilBrown --Sig_/39Xs16epA_qXkuKJsrUak8f Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIVAwUBU65/GDnsnt1WYoG5AQIsrRAAp9SClHyYFl9fwV2lzhI6A2w+th8Z5Gut wbO9+Oi4YKFQauDYaW75BQ99GXORdNnvozcfFXiz6o+wgEsSMc0OaesqjDEkFVtZ 2yZyIBlWvRW0+8ntfskJsy7SHaRaKFOxeTEwGsnf2mWOFNm9BvpRFK2DIJQ1d0YJ Q317/rUWAsAKIn97N29XRjSWpNhDBflrm/M+SgTcAQRO4yPvp4Vf0MFxOY1buFXQ Lq1Swc6IpagLyXQbISLWGzKKs7GGDnignXqM2o2ajYvgyf6JljMv2xB7004o9CTK cSIDlakoEzNylmvRrSsFCYciJpeeeJ/AsBiaM9WM11o/9QXhbPzQm4pNWIlvSQi+ MggqR0Hl452UztVfkyI3D0Spr0RBQH3ZlQUexVkE+sk6yygIqGEGm5dRdgM6JUAt pmhbTgkjKeydjsgOCnFN1saxwFojQvdbqNnXwWUD1lPjhYJiK25Ggm9ouR2aLZfU lR62un3AkcLiGW9p/ChbKllNRBmTuJXQP5JqTZWluo7u5j9gFw1DzNW327Weq6FS 22vrmUTT4u2yqyPgV7fcYYgzPvf6l0o69u93bzwZ9O0BQ9FKUzRJdFUhRodHdUFn YoLDdJKwHMg0h6MzyfK/e8ocJKWWXI9CZo8Fxg49RY5FROv7d6Ip/tdzYmtnzzI5 H1COjFO1o6A= =nqfr -----END PGP SIGNATURE----- --Sig_/39Xs16epA_qXkuKJsrUak8f--