[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/20] block/snapshot: dirty all dirty bitmaps on sna
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 15/20] block/snapshot: dirty all dirty bitmaps on snapshot-switch |
Date: |
Tue, 14 Nov 2017 18:24:12 +0100 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
Snapshot-switch actually changes active state of disk so it should
reflect on dirty bitmaps. Otherwise next incremental backup using
these bitmaps will be invalid.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/snapshot.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/block/snapshot.c b/block/snapshot.c
index a46564e7b7..1d5ab5f90f 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -181,10 +181,24 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
{
BlockDriver *drv = bs->drv;
int ret, open_ret;
+ int64_t len;
if (!drv) {
return -ENOMEDIUM;
}
+
+ len = bdrv_getlength(bs);
+ if (len < 0) {
+ return len;
+ }
+ /* We should set all bits in all enabled dirty bitmaps, because dirty
+ * bitmaps reflect active state of disk and snapshot switch operation
+ * actually dirties active state.
+ * TODO: It may make sense not to set all bits but analyze block status of
+ * current state and destination snapshot and do not set bits corresponding
+ * to both-zero or both-unallocated areas. */
+ bdrv_set_dirty(bs, 0, len);
+
if (drv->bdrv_snapshot_goto) {
return drv->bdrv_snapshot_goto(bs, snapshot_id);
}
--
2.13.6
- [Qemu-devel] [PULL 04/20] qcow2: Don't open images with header.refcount_table_clusters == 0, (continued)
- [Qemu-devel] [PULL 04/20] qcow2: Don't open images with header.refcount_table_clusters == 0, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 06/20] qcow2: Add iotest for an empty refcount table, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 07/20] qcow2: Assert that the crypto header does not overlap other metadata, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 09/20] iotests: Add missing 'blkdebug::' in 040, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 08/20] iotests: Make 030 less flaky, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 10/20] iotests: Make 055 less flaky, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 11/20] iotests: Make 083 less flaky, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 12/20] iotests: Make 136 less flaky, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 13/20] iotests: Use new-style NBD connections, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 14/20] qcow2: Check that corrupted images can be repaired in iotest 060, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 15/20] block/snapshot: dirty all dirty bitmaps on snapshot-switch,
Max Reitz <=
- [Qemu-devel] [PULL 17/20] block/vhdx.c: Don't blindly update the header, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 20/20] qemu-iotests: update unsupported image formats in 194, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 18/20] block/parallels: Do not update header or truncate image when INMIGRATE, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 16/20] iotests: 077: Filter out 'resume' lines, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 19/20] block/parallels: add migration blocker, Max Reitz, 2017/11/14
- Re: [Qemu-devel] [PULL 00/20] Block patches for 2.11.0-rc1, Peter Maydell, 2017/11/14
- Re: [Qemu-devel] [PULL 00/20] Block patches for 2.11.0-rc1, Peter Maydell, 2017/11/14