[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2 2/2] backup: Use copy offloading
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [PATCH v2 2/2] backup: Use copy offloading |
Date: |
Tue, 5 Jun 2018 13:22:29 +0100 |
User-agent: |
Mutt/1.9.5 (2018-04-13) |
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
> + 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.
signature.asc
Description: PGP signature