[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v10 07/24] qcow2: introduce icount field for snapsho
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [PATCH v10 07/24] qcow2: introduce icount field for snapshots |
Date: |
Thu, 17 Jan 2019 10:37:30 +0300 |
User-agent: |
StGit/0.17.1-dirty |
This patch introduces the icount field for saving within the snapshot.
It is required for navigation between the snapshots in record/replay mode.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
Acked-by: Kevin Wolf <address@hidden>
--
v2:
- documented format changes in docs/interop/qcow2.txt
(suggested by Eric Blake)
v10:
- updated the documentation
---
block/qcow2-snapshot.c | 7 +++++++
block/qcow2.h | 2 ++
docs/interop/qcow2.txt | 4 ++++
3 files changed, 13 insertions(+)
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index bb6a5b7..d682946 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -103,6 +103,12 @@ int qcow2_read_snapshots(BlockDriverState *bs)
sn->disk_size = bs->total_sectors * BDRV_SECTOR_SIZE;
}
+ if (extra_data_size >= 24) {
+ sn->icount = be64_to_cpu(extra.icount);
+ } else {
+ sn->icount = -1ULL;
+ }
+
/* Read snapshot ID */
sn->id_str = g_malloc(id_str_size + 1);
ret = bdrv_pread(bs->file, offset, sn->id_str, id_str_size);
@@ -209,6 +215,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
memset(&extra, 0, sizeof(extra));
extra.vm_state_size_large = cpu_to_be64(sn->vm_state_size);
extra.disk_size = cpu_to_be64(sn->disk_size);
+ extra.icount = cpu_to_be64(sn->icount);
id_str_size = strlen(sn->id_str);
name_size = strlen(sn->name);
diff --git a/block/qcow2.h b/block/qcow2.h
index 438a1de..f33e26a 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -159,6 +159,7 @@ typedef struct QEMU_PACKED QCowSnapshotHeader {
typedef struct QEMU_PACKED QCowSnapshotExtraData {
uint64_t vm_state_size_large;
uint64_t disk_size;
+ uint64_t icount;
} QCowSnapshotExtraData;
@@ -172,6 +173,7 @@ typedef struct QCowSnapshot {
uint32_t date_sec;
uint32_t date_nsec;
uint64_t vm_clock_nsec;
+ uint64_t icount;
} QCowSnapshot;
struct Qcow2Cache;
diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt
index fb5cb47..14ca489 100644
--- a/docs/interop/qcow2.txt
+++ b/docs/interop/qcow2.txt
@@ -540,6 +540,10 @@ Snapshot table entry:
Byte 48 - 55: Virtual disk size of the snapshot in bytes
+ Byte 56 - 63: icount value which corresponds to
+ the record/replay instruction count
+ when the snapshot was taken
+
Version 3 images must include extra data at least up to
byte 55.
- [Qemu-devel] [PATCH v10 00/24] Fixing record/replay and adding reverse debugging, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 01/24] replay: add missing fix for internal function, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 02/24] block: implement bdrv_snapshot_goto for blkreplay, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 03/24] replay: disable default snapshot for record/replay, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 04/24] replay: update docs for record/replay with block devices, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 05/24] replay: don't drain/flush bdrv queue while RR is working, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 06/24] replay: finish record/replay before closing the disks, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 07/24] qcow2: introduce icount field for snapshots,
Pavel Dovgalyuk <=
- [Qemu-devel] [PATCH v10 09/24] replay: provide an accessor for rr filename, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 08/24] migration: introduce icount field for snapshots, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 10/24] qapi: introduce replay.json for record/replay-related stuff, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 11/24] replay: introduce info hmp/qmp command, Pavel Dovgalyuk, 2019/01/17
- [Qemu-devel] [PATCH v10 12/24] replay: introduce breakpoint at the specified step, Pavel Dovgalyuk, 2019/01/17