qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 4/9] file-posix: Implement bdrv_co_copy_range


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v3 4/9] file-posix: Implement bdrv_co_copy_range
Date: Thu, 10 May 2018 09:50:19 +0100
User-agent: Mutt/1.9.3 (2018-01-21)

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 <address@hidden>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]