All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hailiang Zhang <zhang.zhanghailiang@huawei.com>
To: Changlong Xie <xiecl.fnst@cn.fujitsu.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: stefanha@redhat.com, kwolf@redhat.com, mreitz@redhat.com,
	pbonzini@redhat.com, wency@cn.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH RFC 4/7] replication: Split out backup_do_checkpoint() from secondary_do_checkpoint()
Date: Mon, 5 Dec 2016 11:41:44 +0800	[thread overview]
Message-ID: <5844E1F8.9020007@huawei.com> (raw)
In-Reply-To: <5810097E.7010907@cn.fujitsu.com>

On 2016/10/26 9:40, Changlong Xie wrote:
> On 10/20/2016 09:57 PM, zhanghailiang wrote:
>> The helper backup_do_checkpoint() will be used for primary related
>> codes. Here we split it out from secondary_do_checkpoint().
>>
>> Besides, it is unnecessary to call backup_do_checkpoint() in
>> replication starting and normally stop replication path.
>
> This patch is unnecessary. We *really* need clean
> backup_job->done_bitmap in replication_start/stop path.
>

After we support internal job ('BLOCK_JOB_INTERNAL'), do we still need
to call backup_do?
IMHO, we don't have to clean 'done_bitmap', because
its initial value is zero, and we don't have to call it in
stop path either, the backup job will be cleaned.


>> We only need call it while do real checkpointing.
>>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> ---
>>    block/replication.c | 36 +++++++++++++++++++-----------------
>>    1 file changed, 19 insertions(+), 17 deletions(-)
>>
>> diff --git a/block/replication.c b/block/replication.c
>> index 2a2fdb2..d687ffc 100644
>> --- a/block/replication.c
>> +++ b/block/replication.c
>> @@ -320,20 +320,8 @@ static bool replication_recurse_is_first_non_filter(BlockDriverState *bs,
>>
>>    static void secondary_do_checkpoint(BDRVReplicationState *s, Error **errp)
>>    {
>> -    Error *local_err = NULL;
>>        int ret;
>>
>> -    if (!s->secondary_disk->bs->job) {
>> -        error_setg(errp, "Backup job was cancelled unexpectedly");
>> -        return;
>> -    }
>> -
>> -    backup_do_checkpoint(s->secondary_disk->bs->job, &local_err);
>> -    if (local_err) {
>> -        error_propagate(errp, local_err);
>> -        return;
>> -    }
>> -
>>        ret = s->active_disk->bs->drv->bdrv_make_empty(s->active_disk->bs);
>>        if (ret < 0) {
>>            error_setg(errp, "Cannot make active disk empty");
>> @@ -539,6 +527,8 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
>>                aio_context_release(aio_context);
>>                return;
>>            }
>> +
>> +        secondary_do_checkpoint(s, errp);
>>            break;
>>        default:
>>            aio_context_release(aio_context);
>> @@ -547,10 +537,6 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
>>
>>        s->replication_state = BLOCK_REPLICATION_RUNNING;
>>
>> -    if (s->mode == REPLICATION_MODE_SECONDARY) {
>> -        secondary_do_checkpoint(s, errp);
>> -    }
>> -
>>        s->error = 0;
>>        aio_context_release(aio_context);
>>    }
>> @@ -560,13 +546,29 @@ static void replication_do_checkpoint(ReplicationState *rs, Error **errp)
>>        BlockDriverState *bs = rs->opaque;
>>        BDRVReplicationState *s;
>>        AioContext *aio_context;
>> +    Error *local_err = NULL;
>>
>>        aio_context = bdrv_get_aio_context(bs);
>>        aio_context_acquire(aio_context);
>>        s = bs->opaque;
>>
>> -    if (s->mode == REPLICATION_MODE_SECONDARY) {
>> +    switch (s->mode) {
>> +    case REPLICATION_MODE_PRIMARY:
>> +        break;
>> +    case REPLICATION_MODE_SECONDARY:
>> +        if (!s->secondary_disk->bs->job) {
>> +            error_setg(errp, "Backup job was cancelled unexpectedly");
>> +            break;
>> +        }
>> +        backup_do_checkpoint(s->secondary_disk->bs->job, &local_err);
>> +        if (local_err) {
>> +            error_propagate(errp, local_err);
>> +            break;
>> +        }
>>            secondary_do_checkpoint(s, errp);
>> +        break;
>> +    default:
>> +        abort();
>>        }
>>        aio_context_release(aio_context);
>>    }
>>
>
>
>
> .
>

  reply	other threads:[~2016-12-05  3:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20 13:57 [Qemu-devel] [PATCH RFC 0/7] COLO block replication supports shared disk case zhanghailiang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 1/7] docs/block-replication: Add description for shared-disk case zhanghailiang
2016-10-25  9:03   ` Changlong Xie
2016-11-28  5:13     ` Hailiang Zhang
2016-11-28  6:00       ` Changlong Xie
2016-11-28  5:58         ` Hailiang Zhang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 2/7] block-backend: Introduce blk_root() helper zhanghailiang
2016-10-25  9:58   ` Changlong Xie
2016-12-05  2:41     ` Hailiang Zhang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 3/7] replication: add shared-disk and shared-disk-id options zhanghailiang
2016-10-25 10:01   ` Changlong Xie
2016-12-05  3:08     ` Hailiang Zhang
2016-10-26  1:58   ` Changlong Xie
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 4/7] replication: Split out backup_do_checkpoint() from secondary_do_checkpoint() zhanghailiang
2016-10-26  1:40   ` Changlong Xie
2016-12-05  3:41     ` Hailiang Zhang [this message]
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 5/7] replication: fix code logic with the new shared_disk option zhanghailiang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 6/7] replication: Implement block replication for shared disk case zhanghailiang
2016-10-20 13:57 ` [Qemu-devel] [PATCH RFC 7/7] nbd/replication: implement .bdrv_get_info() for nbd and replication driver zhanghailiang
2016-10-20 15:34   ` Eric Blake
2016-10-24  2:44     ` Hailiang Zhang
2016-10-26  2:06 ` [Qemu-devel] [PATCH RFC 0/7] COLO block replication supports shared disk case Changlong Xie
2016-11-22 10:33 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-11-23  1:47   ` Hailiang Zhang

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=5844E1F8.9020007@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xiecl.fnst@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.