qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 2/2] backup: Use copy offloading


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH v2 2/2] backup: Use copy offloading
Date: Tue, 5 Jun 2018 22:05:10 +0800
User-agent: Mutt/1.9.5 (2018-04-13)

On Tue, 06/05 13:22, Stefan Hajnoczi wrote:
> On Tue, Jun 05, 2018 at 04:07:10PM +0800, Fam Zheng wrote:
> > The implementation is similar to the 'qemu-img convert'. In the
> > beginning of the job, offloaded copy is attempted. If it fails, further
> > I/O will go through the existing bounce buffer code path.
> > 
> > Signed-off-by: Fam Zheng <address@hidden>
> 
> Nice, this has become much more readable.
> 
> > +/* Copy range to target and return the bytes copied. If error occured, 
> > return a
> > + * negative error number. */
> > +static int backup_cow_with_offload(BackupBlockJob *job,
> 
> coroutine_fn

Will try to remember this better. :)

> 
> > +                                   int64_t start,
> > +                                   int64_t end,
> > +                                   bool is_write_notifier)
> > +{
> > +    int ret;
> > +    int nr_clusters;
> > +    BlockBackend *blk = job->common.blk;
> > +    int nbytes;
> > +
> > +    assert(QEMU_IS_ALIGNED(job->copy_range_size, job->cluster_size));
> > +    nbytes = MIN(job->copy_range_size, end - start);
> > +    nr_clusters = DIV_ROUND_UP(nbytes, job->cluster_size);
> > +    hbitmap_reset(job->copy_bitmap, start / job->cluster_size,
> > +                  nr_clusters);
> > +    ret = blk_co_copy_range(blk, start, job->target, start, nbytes,
> > +                            is_write_notifier ? BDRV_REQ_NO_SERIALISING : 
> > 0);
> > +    if (ret < 0) {
> > +        job->use_copy_range = false;
> 
> This is not necessary since backup_do_cow() also sets it to false.  This
> function doesn't need to know about job->use_copy_range.

Yes, will fix.

Fam



reply via email to

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