diff mbox

[v16,2/8] Backup: clear all bitmap when doing block checkpoint

Message ID 1457692455-15994-3-git-send-email-xiecl.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Changlong Xie March 11, 2016, 10:34 a.m. UTC
From: Wen Congyang <wency@cn.fujitsu.com>

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
---
 block/backup.c            | 15 +++++++++++++++
 include/block/block_int.h |  2 ++
 2 files changed, 17 insertions(+)

Comments

Jeff Cody March 16, 2016, 6:48 p.m. UTC | #1
On Fri, Mar 11, 2016 at 06:34:09PM +0800, Changlong Xie wrote:
> From: Wen Congyang <wency@cn.fujitsu.com>
> 
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
>  block/backup.c            | 15 +++++++++++++++
>  include/block/block_int.h |  2 ++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/block/backup.c b/block/backup.c
> index 0f1b1bc..b2ba939 100644
> --- a/block/backup.c
> +++ b/block/backup.c
> @@ -256,6 +256,21 @@ static void backup_abort(BlockJob *job)
>      }
>  }
>  
> +void backup_do_checkpoint(BlockJob *job, Error **errp)
> +{
> +    BackupBlockJob *backup_job = container_of(job, BackupBlockJob, common);
> +
> +    assert(job->driver->job_type == BLOCK_JOB_TYPE_BACKUP);
> +
> +    if (backup_job->sync_mode != MIRROR_SYNC_MODE_NONE) {
> +        error_setg(errp, "The backup job only supports block checkpoint in"
> +                   " sync=none mode");
> +        return;
> +    }
> +
> +    hbitmap_reset_all(backup_job->bitmap);

This variable changed name and type, it is a simple bitmap now called
'done_bitmap' (backup_job->done_bitmap), and type 'unsigned long *'.

> +}
> +
>  static const BlockJobDriver backup_job_driver = {
>      .instance_size  = sizeof(BackupBlockJob),
>      .job_type       = BLOCK_JOB_TYPE_BACKUP,
> diff --git a/include/block/block_int.h b/include/block/block_int.h
> index 704efe5..48f0f1f 100644
> --- a/include/block/block_int.h
> +++ b/include/block/block_int.h
> @@ -699,6 +699,8 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
>                    BlockCompletionFunc *cb, void *opaque,
>                    BlockJobTxn *txn, Error **errp);
>  
> +void backup_do_checkpoint(BlockJob *job, Error **errp);
> +
>  void blk_set_bs(BlockBackend *blk, BlockDriverState *bs);
>  
>  void blk_dev_change_media_cb(BlockBackend *blk, bool load);
> -- 
> 1.9.3
> 
> 
> 
>
Changlong Xie March 17, 2016, 1:22 a.m. UTC | #2
On 03/17/2016 02:48 AM, Jeff Cody wrote:
> On Fri, Mar 11, 2016 at 06:34:09PM +0800, Changlong Xie wrote:
>> From: Wen Congyang <wency@cn.fujitsu.com>
>>
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
>> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
>> ---
>>   block/backup.c            | 15 +++++++++++++++
>>   include/block/block_int.h |  2 ++
>>   2 files changed, 17 insertions(+)
>>
>> diff --git a/block/backup.c b/block/backup.c
>> index 0f1b1bc..b2ba939 100644
>> --- a/block/backup.c
>> +++ b/block/backup.c
>> @@ -256,6 +256,21 @@ static void backup_abort(BlockJob *job)
>>       }
>>   }
>>
>> +void backup_do_checkpoint(BlockJob *job, Error **errp)
>> +{
>> +    BackupBlockJob *backup_job = container_of(job, BackupBlockJob, common);
>> +
>> +    assert(job->driver->job_type == BLOCK_JOB_TYPE_BACKUP);
>> +
>> +    if (backup_job->sync_mode != MIRROR_SYNC_MODE_NONE) {
>> +        error_setg(errp, "The backup job only supports block checkpoint in"
>> +                   " sync=none mode");
>> +        return;
>> +    }
>> +
>> +    hbitmap_reset_all(backup_job->bitmap);
>
> This variable changed name and type, it is a simple bitmap now called
> 'done_bitmap' (backup_job->done_bitmap), and type 'unsigned long *'.

Thanks for pointing it out, will fix in next version.

Thanks
	-Xie
>
>> +}
>> +
>>   static const BlockJobDriver backup_job_driver = {
>>       .instance_size  = sizeof(BackupBlockJob),
>>       .job_type       = BLOCK_JOB_TYPE_BACKUP,
>> diff --git a/include/block/block_int.h b/include/block/block_int.h
>> index 704efe5..48f0f1f 100644
>> --- a/include/block/block_int.h
>> +++ b/include/block/block_int.h
>> @@ -699,6 +699,8 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
>>                     BlockCompletionFunc *cb, void *opaque,
>>                     BlockJobTxn *txn, Error **errp);
>>
>> +void backup_do_checkpoint(BlockJob *job, Error **errp);
>> +
>>   void blk_set_bs(BlockBackend *blk, BlockDriverState *bs);
>>
>>   void blk_dev_change_media_cb(BlockBackend *blk, bool load);
>> --
>> 1.9.3
>>
>>
>>
>>
>
>
> .
>
diff mbox

Patch

diff --git a/block/backup.c b/block/backup.c
index 0f1b1bc..b2ba939 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -256,6 +256,21 @@  static void backup_abort(BlockJob *job)
     }
 }
 
+void backup_do_checkpoint(BlockJob *job, Error **errp)
+{
+    BackupBlockJob *backup_job = container_of(job, BackupBlockJob, common);
+
+    assert(job->driver->job_type == BLOCK_JOB_TYPE_BACKUP);
+
+    if (backup_job->sync_mode != MIRROR_SYNC_MODE_NONE) {
+        error_setg(errp, "The backup job only supports block checkpoint in"
+                   " sync=none mode");
+        return;
+    }
+
+    hbitmap_reset_all(backup_job->bitmap);
+}
+
 static const BlockJobDriver backup_job_driver = {
     .instance_size  = sizeof(BackupBlockJob),
     .job_type       = BLOCK_JOB_TYPE_BACKUP,
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 704efe5..48f0f1f 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -699,6 +699,8 @@  void backup_start(BlockDriverState *bs, BlockDriverState *target,
                   BlockCompletionFunc *cb, void *opaque,
                   BlockJobTxn *txn, Error **errp);
 
+void backup_do_checkpoint(BlockJob *job, Error **errp);
+
 void blk_set_bs(BlockBackend *blk, BlockDriverState *bs);
 
 void blk_dev_change_media_cb(BlockBackend *blk, bool load);