qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v6 01/13] block: Add op blocker type "device IO"


From: Fam Zheng
Subject: Re: [Qemu-block] [PATCH v6 01/13] block: Add op blocker type "device IO"
Date: Thu, 21 May 2015 15:32:02 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, 05/21 15:06, Wen Congyang wrote:
> On 05/21/2015 02:42 PM, Fam Zheng wrote:
> > It blocks device IO.
> > 
> > All bdrv_op_block_all/blk_op_block_all callers are taken care of:
> > 
> > - virtio_blk_data_plane_create
> > - virtio_scsi_hotplug
> > 
> >   Device creation, unblock it.
> > 
> > - bdrv_set_backing_hd
> > 
> >   Backing hd is not used by device, so blocking is OK.
> > 
> > - backup_start
> > 
> >   Blocking target when backup is running, unblock it.
> 
> Do you forget it?

Oh I think the commit log is wrong: the target image is only written to by
block job, there cannot be a device on it, so it it's similar to
bdrv_set_backing_hd.

> 
> > 
> > - mirror_complete
> > 
> >   Blocking s->to_replace until mirror_exit, OK.
> > 
> > - block_job_complete
> > 
> >   The block job may be long running. Unblock it.
> 
> It should be block_job_create()

Yes.

Fam

> 
> Thanks
> Wen Congyang
> 
> > 
> > - init_blk_migration
> > 
> >   The block migration may be long running, Unblock it.
> > 
> > Signed-off-by: Fam Zheng <address@hidden>
> > ---
> >  blockjob.c                      | 1 +
> >  hw/block/dataplane/virtio-blk.c | 1 +
> >  hw/scsi/virtio-scsi.c           | 1 +
> >  include/block/block.h           | 1 +
> >  migration/block.c               | 1 +
> >  5 files changed, 5 insertions(+)
> > 
> > diff --git a/blockjob.c b/blockjob.c
> > index 2755465..e39bdde 100644
> > --- a/blockjob.c
> > +++ b/blockjob.c
> > @@ -51,6 +51,7 @@ void *block_job_create(const BlockJobDriver *driver, 
> > BlockDriverState *bs,
> >                 BlockJobType_lookup[driver->job_type]);
> >      bdrv_op_block_all(bs, job->blocker);
> >      bdrv_op_unblock(bs, BLOCK_OP_TYPE_DATAPLANE, job->blocker);
> > +    bdrv_op_unblock(bs, BLOCK_OP_TYPE_DEVICE_IO, job->blocker);
> >  
> >      job->driver        = driver;
> >      job->bs            = bs;
> > diff --git a/hw/block/dataplane/virtio-blk.c 
> > b/hw/block/dataplane/virtio-blk.c
> > index 3db139b..3ecc8bd 100644
> > --- a/hw/block/dataplane/virtio-blk.c
> > +++ b/hw/block/dataplane/virtio-blk.c
> > @@ -209,6 +209,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, 
> > VirtIOBlkConf *conf,
> >      blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_MIRROR, s->blocker);
> >      blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_STREAM, s->blocker);
> >      blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_REPLACE, s->blocker);
> > +    blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_DEVICE_IO, s->blocker);
> >  
> >      *dataplane = s;
> >  }
> > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> > index e242fef..5e15fa6 100644
> > --- a/hw/scsi/virtio-scsi.c
> > +++ b/hw/scsi/virtio-scsi.c
> > @@ -772,6 +772,7 @@ static void virtio_scsi_hotplug(HotplugHandler 
> > *hotplug_dev, DeviceState *dev,
> >              return;
> >          }
> >          blk_op_block_all(sd->conf.blk, s->blocker);
> > +        blk_op_unblock(sd->conf.blk, BLOCK_OP_TYPE_DEVICE_IO, s->blocker);
> >          aio_context_acquire(s->ctx);
> >          blk_set_aio_context(sd->conf.blk, s->ctx);
> >          aio_context_release(s->ctx);
> > diff --git a/include/block/block.h b/include/block/block.h
> > index 7d1a717..906fb31 100644
> > --- a/include/block/block.h
> > +++ b/include/block/block.h
> > @@ -159,6 +159,7 @@ typedef enum BlockOpType {
> >      BLOCK_OP_TYPE_RESIZE,
> >      BLOCK_OP_TYPE_STREAM,
> >      BLOCK_OP_TYPE_REPLACE,
> > +    BLOCK_OP_TYPE_DEVICE_IO,
> >      BLOCK_OP_TYPE_MAX,
> >  } BlockOpType;
> >  
> > diff --git a/migration/block.c b/migration/block.c
> > index ddb59cc..b833bac 100644
> > --- a/migration/block.c
> > +++ b/migration/block.c
> > @@ -379,6 +379,7 @@ static void init_blk_migration(QEMUFile *f)
> >          alloc_aio_bitmap(bmds);
> >          error_setg(&bmds->blocker, "block device is in use by migration");
> >          bdrv_op_block_all(bs, bmds->blocker);
> > +        bdrv_op_unblock(bs, BLOCK_OP_TYPE_DEVICE_IO, bmds->blocker);
> >          bdrv_ref(bs);
> >  
> >          block_mig_state.total_sector_sum += sectors;
> > 
> 



reply via email to

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