[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 3/6] block: Add blk_add_close_notifier() for BB
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v2 3/6] block: Add blk_add_close_notifier() for BB |
Date: |
Tue, 18 Nov 2014 12:21:16 +0100 |
Adding something like a "delete notifier" to a BlockBackend would not
make much sense, because whoever is interested in registering there will
probably hold a reference to that BlockBackend; therefore, the notifier
will never be called (or only when the notifiee already relinquished its
reference and thus most probably is no longer interested in that
notification).
Therefore, this patch just passes through the close notifier interface
of the root BDS. This will be called when the device is ejected, for
instance, and therefore does make sense.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
---
block/block-backend.c | 5 +++++
include/sysemu/block-backend.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/block/block-backend.c b/block/block-backend.c
index 7a7f690..ef16d73 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -642,6 +642,11 @@ void blk_remove_aio_context_notifier(BlockBackend *blk,
detach_aio_context, opaque);
}
+void blk_add_close_notifier(BlockBackend *blk, Notifier *notify)
+{
+ bdrv_add_close_notifier(blk->bs, notify);
+}
+
void blk_io_plug(BlockBackend *blk)
{
bdrv_io_plug(blk->bs);
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index d9c1337..8871a02 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -143,6 +143,7 @@ void blk_remove_aio_context_notifier(BlockBackend *blk,
void *),
void (*detach_aio_context)(void *),
void *opaque);
+void blk_add_close_notifier(BlockBackend *blk, Notifier *notify);
void blk_io_plug(BlockBackend *blk);
void blk_io_unplug(BlockBackend *blk);
BlockAcctStats *blk_get_stats(BlockBackend *blk);
--
1.9.3
- [Qemu-devel] [PATCH v2 0/6] nbd: Use BlockBackend, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 1/6] block: Lift more functions into BlockBackend, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 2/6] block: Add AioContextNotifier functions to BB, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 4/6] nbd: Change external interface to BlockBackend, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 3/6] block: Add blk_add_close_notifier() for BB,
Max Reitz <=
- [Qemu-devel] [PATCH v2 5/6] nbd: Use BlockBackend internally, Max Reitz, 2014/11/18
- [Qemu-devel] [PATCH v2 6/6] qemu-nbd: Use BlockBackend where reasonable, Max Reitz, 2014/11/18
- Re: [Qemu-devel] [PATCH v2 0/6] nbd: Use BlockBackend, Stefan Hajnoczi, 2014/11/26