qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, mreitz@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 5/6] qcow2: Let vmstate call qcow2_co_preadv/pwrite directly
Date: Sun, 12 Jun 2016 10:58:02 +0800	[thread overview]
Message-ID: <20160612025802.GD27167@ad.usersys.redhat.com> (raw)
In-Reply-To: <575B41A1.5030702@redhat.com>

On Fri, 06/10 16:39, Eric Blake wrote:
> > +++ b/block/qcow2.c
> > @@ -2903,36 +2903,20 @@ static int qcow2_save_vmstate(BlockDriverState *bs, QEMUIOVector *qiov,
> >                                int64_t pos)
> >  {
> >      BDRVQcow2State *s = bs->opaque;
> > -    int64_t total_sectors = bs->total_sectors;
> > -    bool zero_beyond_eof = bs->zero_beyond_eof;
> > -    int ret;
> >  
> >      BLKDBG_EVENT(bs->file, BLKDBG_VMSTATE_SAVE);
> > -    bs->zero_beyond_eof = false;
> > -    ret = bdrv_pwritev(bs, qcow2_vm_state_offset(s) + pos, qiov);
> > -    bs->zero_beyond_eof = zero_beyond_eof;
> > -
> > -    /* bdrv_co_do_writev will have increased the total_sectors value to include
> > -     * the VM state - the VM state is however not an actual part of the block
> > -     * device, therefore, we need to restore the old value. */
> > -    bs->total_sectors = total_sectors;
> > -
> > -    return ret;
> > +    return bs->drv->bdrv_co_pwritev(bs, qcow2_vm_state_offset(s) + pos,
> > +                                    qiov->size, qiov, 0);
> >  }
> 
> bs->drv->bdrv_co_pwritev() is an optional interface; not all the drivers
> have it yet.  Should you be asserting that it exists, and/or returning
> an error if it does not?

bs->drv is always qcow2 driver here so this is correct.

> 
> >  
> >  static int qcow2_load_vmstate(BlockDriverState *bs, QEMUIOVector *qiov,
> >                                int64_t pos)
> >  {
> >      BDRVQcow2State *s = bs->opaque;
> > -    bool zero_beyond_eof = bs->zero_beyond_eof;
> > -    int ret;
> >  
> >      BLKDBG_EVENT(bs->file, BLKDBG_VMSTATE_LOAD);
> > -    bs->zero_beyond_eof = false;
> > -    ret = bdrv_preadv(bs, qcow2_vm_state_offset(s) + pos, qiov);
> > -    bs->zero_beyond_eof = zero_beyond_eof;
> > -
> > -    return ret;
> > +    return bs->drv->bdrv_co_preadv(bs, qcow2_vm_state_offset(s) + pos,
> > +                                   qiov->size, qiov, 0);
> 
> Ditto.
> 

Fam

  reply	other threads:[~2016-06-12  2:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 16:05 [Qemu-devel] [PATCH 0/6] block: bdrv_load/save_vmstate() cleanups Kevin Wolf
2016-06-10 16:05 ` [Qemu-devel] [PATCH 1/6] block: Introduce bdrv_preadv() Kevin Wolf
2016-06-10 20:50   ` Eric Blake
2016-06-10 16:05 ` [Qemu-devel] [PATCH 2/6] block: Make .bdrv_load_vmstate() vectored Kevin Wolf
2016-06-10 21:25   ` Eric Blake
2016-06-10 16:05 ` [Qemu-devel] [PATCH 3/6] block: Allow .bdrv_load/save_vmstate() to return 0/-errno Kevin Wolf
2016-06-10 21:29   ` Eric Blake
2016-06-10 16:05 ` [Qemu-devel] [PATCH 4/6] block: Make bdrv_load/save_vmstate coroutine_fns Kevin Wolf
2016-06-10 22:33   ` Eric Blake
2016-06-16  8:49   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-10 16:05 ` [Qemu-devel] [PATCH 5/6] qcow2: Let vmstate call qcow2_co_preadv/pwrite directly Kevin Wolf
2016-06-10 22:39   ` Eric Blake
2016-06-12  2:58     ` Fam Zheng [this message]
2016-06-13 12:36       ` Eric Blake
2016-06-10 16:05 ` [Qemu-devel] [PATCH 6/6] block: Remove bs->zero_beyond_eof Kevin Wolf
2016-06-10 22:41   ` Eric Blake
2016-06-12  2:59 ` [Qemu-devel] [PATCH 0/6] block: bdrv_load/save_vmstate() cleanups Fam Zheng
2016-06-16  8:54 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-16  9:33 ` [Qemu-devel] " Kevin Wolf

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=20160612025802.GD27167@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=eblake@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).