From: Fam Zheng <famz@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
Jeff Cody <jcody@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/2] backup: Use copy offloading
Date: Tue, 5 Jun 2018 22:05:10 +0800 [thread overview]
Message-ID: <20180605140510.GH8708@lemon.usersys.redhat.com> (raw)
In-Reply-To: <20180605122229.GD13288@stefanha-x1.localdomain>
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 <famz@redhat.com>
>
> 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
prev parent reply other threads:[~2018-06-05 14:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-05 8:07 [Qemu-devel] [PATCH v2 0/2] backup: Use copy offloading Fam Zheng
2018-06-05 8:07 ` [Qemu-devel] [PATCH v2 1/2] block: Honour BDRV_REQ_NO_SERIALISING in copy range Fam Zheng
2018-06-05 8:07 ` [Qemu-devel] [PATCH v2 2/2] backup: Use copy offloading Fam Zheng
2018-06-05 12:22 ` Stefan Hajnoczi
2018-06-05 14:05 ` Fam Zheng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180605140510.GH8708@lemon.usersys.redhat.com \
--to=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).