qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/snapshot: dirty all dirty bitmaps on snapshot-switch
@ 2017-10-23  9:29 Vladimir Sementsov-Ogievskiy
  2017-10-27 21:23 ` Eric Blake
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2017-10-23  9:29 UTC (permalink / raw)
  To: qemu-block, qemu-devel
  Cc: mreitz, kwolf, eblake, jsnow, famz, den, stefanha, vsementsov

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 <vsementsov@virtuozzo.com>
---
 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.11.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-11-20 12:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-23  9:29 [Qemu-devel] [PATCH] block/snapshot: dirty all dirty bitmaps on snapshot-switch Vladimir Sementsov-Ogievskiy
2017-10-27 21:23 ` Eric Blake
2017-11-02 20:55 ` John Snow
2017-11-14 14:58 ` Max Reitz
2017-11-17 12:30 ` Kevin Wolf
2017-11-17 12:58   ` Denis V. Lunev
2017-11-17 13:42     ` Kevin Wolf
2017-11-17 13:45       ` Denis V. Lunev
2017-11-17 15:01   ` Max Reitz
2017-11-17 18:15     ` John Snow
2017-11-17 18:25       ` Kevin Wolf
2017-11-17 20:40         ` John Snow
2017-11-20  9:51           ` Vladimir Sementsov-Ogievskiy
2017-11-20 12:00             ` Vladimir Sementsov-Ogievskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).