[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication |
Date: |
Mon, 12 Oct 2015 17:31:03 +0100 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Fri, Sep 25, 2015 at 02:17:36PM +0800, Wen Congyang wrote:
> +static void replication_start(BlockDriverState *bs, ReplicationMode mode,
> + Error **errp)
> +{
> + BDRVReplicationState *s = bs->opaque;
> + int64_t active_length, hidden_length, disk_length;
> + AioContext *aio_context;
> + Error *local_err = NULL;
> +
> + if (s->replication_state != BLOCK_REPLICATION_NONE) {
> + error_setg(errp, "Block replication is running or done");
> + return;
> + }
> +
> + if (s->mode != mode) {
> + error_setg(errp, "The parameter mode's value is invalid, needs %d,"
> + " but receives %d", s->mode, mode);
> + return;
> + }
> +
> + switch (s->mode) {
> + case REPLICATION_MODE_PRIMARY:
> + break;
> + case REPLICATION_MODE_SECONDARY:
> + s->active_disk = bs->file;
> + if (!bs->file->backing_hd) {
> + error_setg(errp, "Active disk doesn't have backing file");
> + return;
> + }
> +
> + s->hidden_disk = s->active_disk->backing_hd;
> + if (!s->hidden_disk->backing_hd) {
> + error_setg(errp, "Hidden disk doesn't have backing file");
> + return;
> + }
> +
> + s->secondary_disk = s->hidden_disk->backing_hd;
> + if (!s->secondary_disk->blk) {
> + error_setg(errp, "The secondary disk doesn't have block
> backend");
> + return;
> + }
...
> + aio_context = bdrv_get_aio_context(bs);
> + aio_context_acquire(aio_context);
> + bdrv_set_aio_context(s->secondary_disk, aio_context);
Why is this bdrv_set_aio_context() call necessary?
Child BDS nodes are in the same AioContext as their parents. Other
block jobs need something like this because they operate on a second BDS
which is not bs' backing file chain. I think you have a different
situation here so it's not needed.
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, (continued)
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/12
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/15
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/15
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/14
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/15
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/15
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/16
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/16
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/26
- Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/27
Re: [Qemu-devel] [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication,
Stefan Hajnoczi <=