summaryrefslogtreecommitdiffstats
path: root/nbd
diff options
context:
space:
mode:
authorKevin Wolf2020-09-24 17:26:56 +0200
committerKevin Wolf2020-10-02 15:46:40 +0200
commitd794f7f3728df0845be978a3c9aecead9d48c81d (patch)
tree817b5cacc659fda48def5e78a3eaae9766459f82 /nbd
parentnbd: Add writethrough to block-export-add (diff)
downloadqemu-d794f7f3728df0845be978a3c9aecead9d48c81d.tar.gz
qemu-d794f7f3728df0845be978a3c9aecead9d48c81d.tar.xz
qemu-d794f7f3728df0845be978a3c9aecead9d48c81d.zip
nbd: Remove NBDExport.close callback
The export close callback is unused by the built-in NBD server. qemu-nbd uses it only during shutdown to wait for the unrefed export to actually go away. It can just use nbd_export_close_all() instead and do without the callback. This removes the close callback from nbd_export_new() and makes both callers of it more similar. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200924152717.287415-11-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'nbd')
-rw-r--r--nbd/server.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/nbd/server.c b/nbd/server.c
index 23d9a53094..1cc915f01d 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -84,7 +84,6 @@ struct NBDRequestData {
struct NBDExport {
BlockExport common;
int refcount;
- void (*close)(NBDExport *exp);
BlockBackend *blk;
char *name;
@@ -1521,8 +1520,7 @@ void nbd_export_set_on_eject_blk(BlockExport *exp, BlockBackend *blk)
NBDExport *nbd_export_new(BlockDriverState *bs,
const char *name, const char *desc,
const char *bitmap, bool readonly, bool shared,
- void (*close)(NBDExport *), bool writethrough,
- Error **errp)
+ bool writethrough, Error **errp)
{
AioContext *ctx;
BlockBackend *blk;
@@ -1625,7 +1623,6 @@ NBDExport *nbd_export_new(BlockDriverState *bs,
assert(strlen(exp->export_bitmap_context) < NBD_MAX_STRING_SIZE);
}
- exp->close = close;
exp->ctx = ctx;
blk_add_aio_context_notifier(blk, blk_aio_attached, blk_aio_detach, exp);
@@ -1723,10 +1720,6 @@ void nbd_export_put(NBDExport *exp)
assert(exp->name == NULL);
assert(exp->description == NULL);
- if (exp->close) {
- exp->close(exp);
- }
-
if (exp->blk) {
if (exp->eject_notifier_blk) {
notifier_remove(&exp->eject_notifier);