[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 7/7] block: assign backing relationship in drive-bac
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH 7/7] block: assign backing relationship in drive-backup |
Date: |
Tue, 2 Jul 2013 13:59:49 +0800 |
Assign source image as the backing hd of target bs, so reading target bs
gets the point-in-time copy of data from source image.
Signed-off-by: Fam Zheng <address@hidden>
---
block/backup.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/block/backup.c b/block/backup.c
index 4e9f927..2dd0540 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -294,6 +294,11 @@ static void coroutine_fn backup_run(void *opaque)
hbitmap_free(job->bitmap);
bdrv_iostatus_disable(target);
+
+ bdrv_put_ref(target->backing_hd);
+ target->backing_hd = NULL;
+ target->backing_file[0] = '\0';
+ target->backing_format[0] = '\0';
bdrv_put_ref(target);
block_job_completed(&job->common, ret);
@@ -332,7 +337,15 @@ void backup_start(BlockDriverState *bs, BlockDriverState
*target,
return;
}
+ target->backing_hd = bs;
+ pstrcpy(target->backing_file, sizeof(target->backing_file),
+ bs->filename);
+ pstrcpy(target->backing_format, sizeof(target->backing_format),
+ bs->drv->format_name);
bdrv_get_ref(target);
+ /* Get another ref to source for backing_hd relationship */
+ bdrv_get_ref(bs);
+
job->on_source_error = on_source_error;
job->on_target_error = on_target_error;
job->target = target;
--
1.8.3.1
- Re: [Qemu-devel] [PATCH 3/7] nbd: use BDS refcount, (continued)
[Qemu-devel] [PATCH 4/7] block: simplify bdrv_drop_intermediate, Fam Zheng, 2013/07/02
[Qemu-devel] [PATCH 5/7] block: rename bdrv_in_use to bdrv_is_shared, Fam Zheng, 2013/07/02
[Qemu-devel] [PATCH 6/7] block: add target-id option to drive-backup QMP command, Fam Zheng, 2013/07/02
[Qemu-devel] [PATCH 7/7] block: assign backing relationship in drive-backup,
Fam Zheng <=