qemu-block
[Top][All Lists]
Advanced

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

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


From: Fam Zheng
Subject: Re: [Qemu-block] [PATCH v3 4/9] file-posix: Implement bdrv_co_copy_range
Date: Fri, 11 May 2018 15:20:05 +0800
User-agent: Mutt/1.9.2 (2017-12-15)

On Thu, 05/10 09:50, Stefan Hajnoczi wrote:
> 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?

Sounds good.



reply via email to

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