|
|
9ae3a8 |
From 89f3f5eafd6aed8a79b4570553af711dffc3a1d6 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 23 Nov 2015 17:38:36 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 17/27] blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1448300320-7772-18-git-send-email-jsnow@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 68448
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 17/21] blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events
|
|
|
9ae3a8 |
Bugzilla: 1272523
|
|
|
9ae3a8 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit bf736fe34caba0688c9095c31b9d097ea15c1296)
|
|
|
9ae3a8 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
block/blkdebug.c: debug event ordering
|
|
|
9ae3a8 |
include/block/block.h: debug event ordering
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block.c | 8 ++++----
|
|
|
9ae3a8 |
block/blkdebug.c | 3 +++
|
|
|
9ae3a8 |
include/block/block.h | 3 +++
|
|
|
9ae3a8 |
3 files changed, 10 insertions(+), 4 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block.c b/block.c
|
|
|
9ae3a8 |
index bc6e75c..ecb2b09 100644
|
|
|
9ae3a8 |
--- a/block.c
|
|
|
9ae3a8 |
+++ b/block.c
|
|
|
9ae3a8 |
@@ -4026,13 +4026,11 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
void bdrv_debug_event(BlockDriverState *bs, BlkDebugEvent event)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- BlockDriver *drv = bs->drv;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- if (!drv || !drv->bdrv_debug_event) {
|
|
|
9ae3a8 |
+ if (!bs || !bs->drv || !bs->drv->bdrv_debug_event) {
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- drv->bdrv_debug_event(bs, event);
|
|
|
9ae3a8 |
+ bs->drv->bdrv_debug_event(bs, event);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event,
|
|
|
9ae3a8 |
@@ -4879,6 +4877,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Write back cached data to the OS even with cache=unsafe */
|
|
|
9ae3a8 |
+ BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS);
|
|
|
9ae3a8 |
if (bs->drv->bdrv_co_flush_to_os) {
|
|
|
9ae3a8 |
ret = bs->drv->bdrv_co_flush_to_os(bs);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
@@ -4891,6 +4890,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
|
|
|
9ae3a8 |
goto flush_parent;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK);
|
|
|
9ae3a8 |
if (bs->drv->bdrv_co_flush_to_disk) {
|
|
|
9ae3a8 |
ret = bs->drv->bdrv_co_flush_to_disk(bs);
|
|
|
9ae3a8 |
} else if (bs->drv->bdrv_aio_flush) {
|
|
|
9ae3a8 |
diff --git a/block/blkdebug.c b/block/blkdebug.c
|
|
|
9ae3a8 |
index c61ce52..8e468b2 100644
|
|
|
9ae3a8 |
--- a/block/blkdebug.c
|
|
|
9ae3a8 |
+++ b/block/blkdebug.c
|
|
|
9ae3a8 |
@@ -184,6 +184,9 @@ static const char *event_names[BLKDBG_EVENT_MAX] = {
|
|
|
9ae3a8 |
[BLKDBG_CLUSTER_ALLOC_BYTES] = "cluster_alloc_bytes",
|
|
|
9ae3a8 |
[BLKDBG_CLUSTER_FREE] = "cluster_free",
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ [BLKDBG_FLUSH_TO_OS] = "flush_to_os",
|
|
|
9ae3a8 |
+ [BLKDBG_FLUSH_TO_DISK] = "flush_to_disk",
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
[BLKDBG_PWRITEV_RMW_HEAD] = "pwritev_rmw.head",
|
|
|
9ae3a8 |
[BLKDBG_PWRITEV_RMW_AFTER_HEAD] = "pwritev_rmw.after_head",
|
|
|
9ae3a8 |
[BLKDBG_PWRITEV_RMW_TAIL] = "pwritev_rmw.tail",
|
|
|
9ae3a8 |
diff --git a/include/block/block.h b/include/block/block.h
|
|
|
9ae3a8 |
index 8339cac..75147b2 100644
|
|
|
9ae3a8 |
--- a/include/block/block.h
|
|
|
9ae3a8 |
+++ b/include/block/block.h
|
|
|
9ae3a8 |
@@ -508,6 +508,9 @@ typedef enum {
|
|
|
9ae3a8 |
BLKDBG_CLUSTER_ALLOC_BYTES,
|
|
|
9ae3a8 |
BLKDBG_CLUSTER_FREE,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ BLKDBG_FLUSH_TO_OS,
|
|
|
9ae3a8 |
+ BLKDBG_FLUSH_TO_DISK,
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
BLKDBG_PWRITEV_RMW_HEAD,
|
|
|
9ae3a8 |
BLKDBG_PWRITEV_RMW_AFTER_HEAD,
|
|
|
9ae3a8 |
BLKDBG_PWRITEV_RMW_TAIL,
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|