[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 07/13] blockdev: Means to destroy blockdev only
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] Re: [PATCH 07/13] blockdev: Means to destroy blockdev only if made with drive_init() |
Date: |
Thu, 10 Jun 2010 16:19:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Thunderbird/3.0.4 |
Am 02.06.2010 18:55, schrieb Markus Armbruster:
> All drives are still made that way. They get destroyed along with
> their device. That's inappropriate for the alternative way to make
> blockdevs that will appear later in this series. These won't have a
> DriveInfo.
>
> blockdev_detach() destroys the blockdev only if it has a DriveInfo.
>
> blockdev_attach() does nothing for now. It'll be fleshed out later.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> blockdev.c | 35 +++++++++++++++++++++++++++++++++++
> blockdev.h | 7 +++++++
> 2 files changed, 42 insertions(+), 0 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index ace74e4..f90d4fc 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1,8 +1,12 @@
> /*
> * QEMU host block devices
> *
> + * Copyright (C) 2010 Red Hat Inc.
> * Copyright (c) 2003-2008 Fabrice Bellard
> *
> + * Authors:
> + * Markus Armbruster <address@hidden>,
> + *
> * This work is licensed under the terms of the GNU GPL, version 2 or
> * later. See the COPYING file in the top-level directory.
> */
> @@ -17,6 +21,37 @@
>
> static QTAILQ_HEAD(drivelist, DriveInfo) drives =
> QTAILQ_HEAD_INITIALIZER(drives);
>
> +static int blockdev_del_dinfo(BlockDriverState *bs)
> +{
> + DriveInfo *dinfo, *next_dinfo;
> + int res = 0;
> +
> + QTAILQ_FOREACH_SAFE(dinfo, &drives, next, next_dinfo) {
> + if (dinfo->bdrv == bs) {
> + qemu_opts_del(dinfo->opts);
> + QTAILQ_REMOVE(&drives, dinfo, next);
> + qemu_free(dinfo);
> + res = 1;
> + }
> + }
> +
> + return res;
Can it happen that a BlockDriverState belongs to multiple DriveInfos? If
no, why not returning in the loop? Wouldn't need a FOREACH_SAFE then, too.
It's not worth respinning because of this one, but there were more
comments and I think you'll send a v2 for the actual -blockdev option
anyway once we have decided how to do it.
I have applied patches 1 to 6 now, and I think I could safely go on
until patch 9 if the minor improvements that were mentioned in comments
are made. I'd ignore patch 10 to 13 for now.
Is this what you would have expected or should I handle anything in a
different way?
Kevin
- [Qemu-devel] [PATCH 00/13] New -blockdev to define a host block device, Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 03/13] monitor: Make "commit FOO" complain when FOO doesn't exist, Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 12/13] blockdev: Factor option value parsers out of drive_init(), Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 01/13] block: Move error actions from DriveInfo to BlockDriverState, Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 04/13] block: New bdrv_next(), Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 05/13] block: Decouple savevm from DriveInfo, Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 11/13] qemu-option: New qemu_opt_next(), qemu_opt_name(), Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 07/13] blockdev: Means to destroy blockdev only if made with drive_init(), Markus Armbruster, 2010/06/02
- [Qemu-devel] Re: [PATCH 07/13] blockdev: Means to destroy blockdev only if made with drive_init(),
Kevin Wolf <=
- [Qemu-devel] [PATCH 02/13] block: Decouple block device "commit all" from DriveInfo, Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 09/13] blockdev: drive_get_by_id() is no longer used, remove, Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 06/13] blockdev: Give drives internal linkage, Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 10/13] qemu-option: New qemu_opts_reset(), Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 08/13] qdev: Decouple qdev_prop_drive from DriveInfo, Markus Armbruster, 2010/06/02
- [Qemu-devel] [PATCH 13/13] blockdev: New -blockdev to define a host block device, Markus Armbruster, 2010/06/02