aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>2021-03-29 11:06:03 +0300
committerMax Reitz <mreitz@redhat.com>2021-03-29 18:04:29 +0200
commitad0ce642799c15e3e5783bfcad60450c3f5687e1 (patch)
treec25f0cc5121246bb3eed13dbb2c7467f252c2af3 /block
parentd751448d4fe904d82db52d454fe85534992d167a (diff)
downloadqemu-ad0ce642799c15e3e5783bfcad60450c3f5687e1.zip
qemu-ad0ce642799c15e3e5783bfcad60450c3f5687e1.tar.gz
qemu-ad0ce642799c15e3e5783bfcad60450c3f5687e1.tar.bz2
qcow2: use external virtual timers
Regular virtual timers are used to emulate timings related to vCPU and peripheral states. QCOW2 uses timers to clean the cache. These timers should have external flag. In the opposite case they affect the execution and it can't be recorded and replayed. This patch adds external flag to the timer for qcow2 cache clean. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <161700516327.1141158.8366564693714562536.stgit@pasha-ThinkPad-X280> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index 0db1227..2fb43c6 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -840,9 +840,10 @@ static void cache_clean_timer_init(BlockDriverState *bs, AioContext *context)
{
BDRVQcow2State *s = bs->opaque;
if (s->cache_clean_interval > 0) {
- s->cache_clean_timer = aio_timer_new(context, QEMU_CLOCK_VIRTUAL,
- SCALE_MS, cache_clean_timer_cb,
- bs);
+ s->cache_clean_timer =
+ aio_timer_new_with_attrs(context, QEMU_CLOCK_VIRTUAL,
+ SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL,
+ cache_clean_timer_cb, bs);
timer_mod(s->cache_clean_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
(int64_t) s->cache_clean_interval * 1000);
}