From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3QVE-0003Hk-SK for qemu-devel@nongnu.org; Mon, 30 Nov 2015 10:36:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3QVD-0006W7-Rg for qemu-devel@nongnu.org; Mon, 30 Nov 2015 10:36:32 -0500 Date: Mon, 30 Nov 2015 16:36:21 +0100 From: Kevin Wolf Message-ID: <20151130153621.GF4494@noname.str.redhat.com> References: <1447108773-6836-1-git-send-email-mreitz@redhat.com> <1447108773-6836-15-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447108773-6836-15-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v7 14/24] nbd: Switch from close to eject notifier List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Alberto Garcia , qemu-block@nongnu.org, John Snow , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini Am 09.11.2015 um 23:39 hat Max Reitz geschrieben: > The NBD code uses the BDS close notifier to determine when a medium is > ejected. However, now it should use the BB's BDS removal notifier for > that instead of the BDS's close notifier. > > Signed-off-by: Max Reitz > --- > blockdev-nbd.c | 37 +------------------------------------ > nbd.c | 13 +++++++++++++ > 2 files changed, 14 insertions(+), 36 deletions(-) > > diff --git a/blockdev-nbd.c b/blockdev-nbd.c > index bcdd18b..b28a55b 100644 > --- a/blockdev-nbd.c > +++ b/blockdev-nbd.c > @@ -46,37 +46,11 @@ void qmp_nbd_server_start(SocketAddress *addr, Error **errp) > } > } > > -/* > - * Hook into the BlockBackend notifiers to close the export when the > - * backend is closed. > - */ > -typedef struct NBDCloseNotifier { > - Notifier n; > - NBDExport *exp; > - QTAILQ_ENTRY(NBDCloseNotifier) next; > -} NBDCloseNotifier; > - > -static QTAILQ_HEAD(, NBDCloseNotifier) close_notifiers = > - QTAILQ_HEAD_INITIALIZER(close_notifiers); > - > -static void nbd_close_notifier(Notifier *n, void *data) > -{ > - NBDCloseNotifier *cn = DO_UPCAST(NBDCloseNotifier, n, n); > - > - notifier_remove(&cn->n); > - QTAILQ_REMOVE(&close_notifiers, cn, next); > - > - nbd_export_close(cn->exp); > - nbd_export_put(cn->exp); Here you remove a close/put pair, but in the new code you only add the close call. Why is this correct? Kevin