From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgD8F-0004RL-Oy for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgD89-0007FB-JE for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgD89-0007Ez-Cy for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:13 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9KDaCWD014269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 20 Oct 2014 09:36:12 -0400 From: Kevin Wolf Date: Mon, 20 Oct 2014 15:35:37 +0200 Message-Id: <1413812154-11153-12-git-send-email-kwolf@redhat.com> In-Reply-To: <1413812154-11153-1-git-send-email-kwolf@redhat.com> References: <1413812154-11153-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 11/28] blockdev: Eliminate drive_del() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Markus Armbruster drive_del() has become a trivial wrapper around blk_unref(). Get rid of it. Signed-off-by: Markus Armbruster Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- blockdev.c | 9 ++------- device-hotplug.c | 3 ++- hw/ide/piix.c | 4 +++- include/sysemu/blockdev.h | 1 - 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/blockdev.c b/blockdev.c index 63f797b..3038203 100644 --- a/blockdev.c +++ b/blockdev.c @@ -134,7 +134,7 @@ void blockdev_auto_del(BlockDriverState *bs) DriveInfo *dinfo = blk_legacy_dinfo(blk); if (dinfo && dinfo->auto_del) { - drive_del(dinfo); + blk_unref(blk); } } @@ -276,11 +276,6 @@ static void bdrv_format_print(void *opaque, const char *name) error_printf(" %s", name); } -void drive_del(DriveInfo *dinfo) -{ - blk_unref(dinfo->bdrv->blk); -} - typedef struct { QEMUBH *bh; BlockDriverState *bs; @@ -1867,7 +1862,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data) bdrv_set_on_error(bs, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT); } else { - drive_del(dinfo); + blk_unref(blk); } aio_context_release(aio_context); diff --git a/device-hotplug.c b/device-hotplug.c index e6a1ffb..9e38cc4 100644 --- a/device-hotplug.c +++ b/device-hotplug.c @@ -24,6 +24,7 @@ #include "hw/hw.h" #include "hw/boards.h" +#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "qemu/config-file.h" #include "sysemu/sysemu.h" @@ -76,6 +77,6 @@ void drive_hot_add(Monitor *mon, const QDict *qdict) err: if (dinfo) { - drive_del(dinfo); + blk_unref(blk_by_legacy_dinfo(dinfo)); } } diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 49e78a7..ec93977 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -27,6 +27,7 @@ #include #include #include +#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" #include "sysemu/dma.h" @@ -178,12 +179,13 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev) for (; i < 3; i++) { di = drive_get_by_index(IF_IDE, i); if (di != NULL && !di->media_cd) { + BlockBackend *blk = blk_by_legacy_dinfo(di); DeviceState *ds = bdrv_get_attached_dev(di->bdrv); if (ds) { bdrv_detach_dev(di->bdrv, ds); } pci_ide->bus[di->bus].ifs[di->unit].bs = NULL; - drive_del(di); + blk_unref(blk); } } qdev_reset_all(DEVICE(dev)); diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index ccd4bf4..439844d 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -64,7 +64,6 @@ QemuOpts *drive_def(const char *optstr); QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file, const char *optstr); DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type); -void drive_del(DriveInfo *dinfo); /* device-hotplug */ -- 1.8.3.1