[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 06/22] block: Add bdrv_close_all() notifiers
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v2 06/22] block: Add bdrv_close_all() notifiers |
Date: |
Mon, 9 Feb 2015 13:38:28 -0500 |
This adds a list of notifiers to be invoked on bdrv_close_all().
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block.c | 10 ++++++++++
include/block/block.h | 2 ++
2 files changed, 12 insertions(+)
diff --git a/block.c b/block.c
index 6ad80fe..143c7cc 100644
--- a/block.c
+++ b/block.c
@@ -104,6 +104,9 @@ static void bdrv_reset_dirty(BlockDriverState *bs, int64_t
cur_sector,
/* If non-zero, use only whitelisted block drivers */
static int use_bdrv_whitelist;
+static NotifierList close_all_notifiers =
+ NOTIFIER_LIST_INITIALIZER(close_all_notifiers);
+
#ifdef _WIN32
static int is_windows_drive_prefix(const char *filename)
{
@@ -1907,6 +1910,8 @@ void bdrv_close_all(void)
{
BlockDriverState *bs;
+ notifier_list_notify(&close_all_notifiers, NULL);
+
QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
AioContext *aio_context = bdrv_get_aio_context(bs);
@@ -1916,6 +1921,11 @@ void bdrv_close_all(void)
}
}
+void bdrv_add_close_all_notifier(Notifier *notifier)
+{
+ notifier_list_add(&close_all_notifiers, notifier);
+}
+
/* Check if any requests are in-flight (including throttled requests) */
static bool bdrv_requests_pending(BlockDriverState *bs)
{
diff --git a/include/block/block.h b/include/block/block.h
index 0708a48..79efccb 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -543,4 +543,6 @@ void bdrv_io_plug(BlockDriverState *bs);
void bdrv_io_unplug(BlockDriverState *bs);
void bdrv_flush_io_queue(BlockDriverState *bs);
+void bdrv_add_close_all_notifier(Notifier *notifier);
+
#endif
--
2.1.0
- [Qemu-devel] [PATCH v2 01/22] iotests: Move _filter_nbd into common.filter, (continued)
- [Qemu-devel] [PATCH v2 01/22] iotests: Move _filter_nbd into common.filter, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 05/22] block: Move BDS close notifiers into BB, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 08/22] block: Use blk_remove_bs() in blk_delete(), Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 03/22] iotests: Add test for eject under NBD server, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 02/22] iotests: Do not redirect qemu's stderr, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 09/22] blockdev: Use blk_remove_bs() in do_drive_del(), Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 04/22] quorum: Fix close path, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 10/22] block: Make bdrv_close() static, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 07/22] block: Add bdrv_close_all() handlers, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 06/22] block: Add bdrv_close_all() notifiers,
Max Reitz <=
- [Qemu-devel] [PATCH v2 11/22] block: Add blk_name_taken(), Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 14/22] block: Use BlockBackend more, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 12/22] block: Add blk_next_inserted(), Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 13/22] block: Add blk_commit_all() and blk_invalidate_cache_all(), Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 17/22] block: Make bdrv_drain_one() public, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 15/22] blockdev: Add list of monitor-owned BlockBackends, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 18/22] block: Move some bdrv_*_all() functions to BB, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 19/22] block: Remove bdrv_states, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 20/22] blockdev: Keep track of monitor-owned BDS, Max Reitz, 2015/02/09
- [Qemu-devel] [PATCH v2 16/22] blockdev: Remove blk_hide_on_behalf_of_do_drive_del(), Max Reitz, 2015/02/09