[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replic
From: |
Wen Congyang |
Subject: |
Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication |
Date: |
Tue, 13 Oct 2015 17:09:33 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 10/13/2015 12:31 AM, Stefan Hajnoczi wrote:
> 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.
I think you are right. I will check it and remove it.
Thanks
Wen Congyang
> .
>
- Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/12
- Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/15
- Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/14
- Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/14
- Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/15
- Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/15
- Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Wen Congyang, 2015/10/16
- Re: [Qemu-block] [PATCH v10 08/10] Implement new driver for block replication, Stefan Hajnoczi, 2015/10/16