[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 18/26] blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 18/26] blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events |
Date: |
Fri, 7 Jun 2013 13:58:37 +0200 |
From: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block.c | 8 ++++----
block/blkdebug.c | 3 +++
include/block/block.h | 3 +++
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index 3f616de..79ad33d 100644
--- a/block.c
+++ b/block.c
@@ -3186,13 +3186,11 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint8_t
*buf,
void bdrv_debug_event(BlockDriverState *bs, BlkDebugEvent event)
{
- BlockDriver *drv = bs->drv;
-
- if (!drv || !drv->bdrv_debug_event) {
+ if (!bs || !bs->drv || !bs->drv->bdrv_debug_event) {
return;
}
- drv->bdrv_debug_event(bs, event);
+ bs->drv->bdrv_debug_event(bs, event);
}
int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event,
@@ -4024,6 +4022,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
}
/* Write back cached data to the OS even with cache=unsafe */
+ BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS);
if (bs->drv->bdrv_co_flush_to_os) {
ret = bs->drv->bdrv_co_flush_to_os(bs);
if (ret < 0) {
@@ -4036,6 +4035,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
goto flush_parent;
}
+ BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_DISK);
if (bs->drv->bdrv_co_flush_to_disk) {
ret = bs->drv->bdrv_co_flush_to_disk(bs);
} else if (bs->drv->bdrv_aio_flush) {
diff --git a/block/blkdebug.c b/block/blkdebug.c
index 71f99e4..ccb627a 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -182,6 +182,9 @@ static const char *event_names[BLKDBG_EVENT_MAX] = {
[BLKDBG_CLUSTER_ALLOC] = "cluster_alloc",
[BLKDBG_CLUSTER_ALLOC_BYTES] = "cluster_alloc_bytes",
[BLKDBG_CLUSTER_FREE] = "cluster_free",
+
+ [BLKDBG_FLUSH_TO_OS] = "flush_to_os",
+ [BLKDBG_FLUSH_TO_DISK] = "flush_to_disk",
};
static int get_event_by_name(const char *name, BlkDebugEvent *event)
diff --git a/include/block/block.h b/include/block/block.h
index dc5b388..2307f67 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -424,6 +424,9 @@ typedef enum {
BLKDBG_CLUSTER_ALLOC_BYTES,
BLKDBG_CLUSTER_FREE,
+ BLKDBG_FLUSH_TO_OS,
+ BLKDBG_FLUSH_TO_DISK,
+
BLKDBG_EVENT_MAX,
} BlkDebugEvent;
--
1.8.1.4
- [Qemu-devel] [PULL 09/26] qemu-io: Move 'help' function, (continued)
- [Qemu-devel] [PULL 09/26] qemu-io: Move 'help' function, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 11/26] qemu-io: Move qemu_strsep() to cutils.c, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 10/26] qemu-io: Move 'quit' function, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 07/26] qemu-io: Split off commands to qemu-io-cmds.c, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 12/26] qemu-io: Move functions for registering and running commands, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 13/26] qemu-io: Move command_loop() and friends, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 14/26] qemu-io: Move remaining helpers from cmd.c, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 15/26] qemu-io: Interface cleanup, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 16/26] qemu-io: Use the qemu version for -V, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 17/26] Make qemu-io commands available in HMP, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 18/26] blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 19/26] ide-test: Add enum value for DEV, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 21/26] ide-test: Add FLUSH CACHE test case, Stefan Hajnoczi, 2013/06/07
[Qemu-devel] [PULL 20/26] ide: Set BSY bit during FLUSH, Stefan Hajnoczi, 2013/06/07
[Qemu-devel] [PULL 22/26] block: add snapshot info query function bdrv_query_snapshot_info_list(), Stefan Hajnoczi, 2013/06/07
[Qemu-devel] [PULL 23/26] block: add image info query function bdrv_query_image_info(), Stefan Hajnoczi, 2013/06/07