From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGhHR-0006JA-1t for qemu-devel@nongnu.org; Thu, 10 May 2018 04:50:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGhHQ-0007C4-Du for qemu-devel@nongnu.org; Thu, 10 May 2018 04:50:29 -0400 Date: Thu, 10 May 2018 09:50:19 +0100 From: Stefan Hajnoczi Message-ID: <20180510085019.GF1296@stefanha-x1.localdomain> References: <20180509145815.3330-1-famz@redhat.com> <20180509145815.3330-5-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Y/WcH0a6A93yCHGr" Content-Disposition: inline In-Reply-To: <20180509145815.3330-5-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 4/9] file-posix: Implement bdrv_co_copy_range List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, Paolo Bonzini , Ronnie Sahlberg , qemu-block@nongnu.org, Kevin Wolf , Peter Lieven , Max Reitz --Y/WcH0a6A93yCHGr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 09, 2018 at 10:58:10PM +0800, Fam Zheng wrote: > +static off_t copy_file_range(int in_fd, off_t *in_off, int out_fd, > + off_t *out_off, size_t len, unsigned int flags) > +{ > +#ifdef __NR_copy_file_range > + return syscall(__NR_copy_file_range, in_fd, in_off, out_fd, > + out_off, len, flags); > +#else > + errno = ENOSYS; > + return -1; > +#endif > +} > + > +static ssize_t handle_aiocb_copy_range(RawPosixAIOData *aiocb) > +{ > + uint64_t bytes = aiocb->aio_nbytes; > + off_t in_off = aiocb->aio_offset; > + off_t out_off = aiocb->aio_offset2; > + > + while (bytes) { > + ssize_t ret = copy_file_range(aiocb->aio_fildes, &in_off, > + aiocb->aio_fd2, &out_off, > + bytes, 0); > + if (ret == -EINTR) { > + continue; > + } > + if (ret < 0) { > + return -errno; Convert ENOSYS to ENOTSUP? Reviewed-by: Stefan Hajnoczi --Y/WcH0a6A93yCHGr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJa9AfLAAoJEJykq7OBq3PIH4oH/juQE2lYgc6qc39sdtgta11N O81JzVsRFSwWCWjRpinC+1dGh5pacb6NgSu2pAl01MuJUTTiylonn2qjPjSVwyLM OVqhyRcxj4aZ4j/bj7ItrsdsamwWegQ7be8XhIjDSayaoTwqCnMnc6aopqVT/9XE aXWgoAC1SAhK0tjzwmdXPK3F4me25AwnnlQQCzcGlHuJtSID2rHRGi08uTQSWf+7 PBUhfSFL54lUtjRNZ16vsIZzjgmATmWmcOMMbBeV1QiQ7U+nX97ewP3UfG2nNeqz UkkGmyX1oRWNy9lMNJJuYjGOxAhHHcDKv9xtJPAU3pbkEHP8VLxRBvT8z+jUsFc= =Z6AV -----END PGP SIGNATURE----- --Y/WcH0a6A93yCHGr--