[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 04/23] block: Connect BlockBackend and DriveI
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v5 04/23] block: Connect BlockBackend and DriveInfo |
Date: |
Thu, 2 Oct 2014 12:55:34 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 02.10.2014 um 11:04 hat Markus Armbruster geschrieben:
> Make the BlockBackend own the DriveInfo. Change blockdev_init() to
> return the BlockBackend instead of the DriveInfo.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> Reviewed-by: Max Reitz <address@hidden>
> @@ -200,11 +202,11 @@ DriveInfo *drive_get_next(BlockInterfaceType type)
>
> DriveInfo *drive_get_by_blockdev(BlockDriverState *bs)
> {
> - DriveInfo *dinfo;
> + BlockBackend *blk;
>
> - QTAILQ_FOREACH(dinfo, &drives, next) {
> - if (dinfo->bdrv == bs) {
> - return dinfo;
> + for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
> + if (blk == bs->blk) {
> + return blk_legacy_dinfo(blk);
> }
> }
> return NULL;
In v3, I asked why you don't use bs->blk here. Apparently you understood
this as a suggestion to change the if condition from:
if (blk_bs(blk) == bs)
to:
if (blk == bs->blk)
Which isn't a wrong change, it just doesn't change a lot. What I really
meant is something like this, removing the loop:
DriveInfo *drive_get_by_blockdev(BlockDriverState *bs)
{
return bs->blk ? blk_legacy_dinfo(bs->blk) : NULL;
}
This would only behave differently if there were BlockBackends that can
be assigned to bs->blk, but aren't iterated by blk_next(). But such
BlockBackends don't exist, blk_next() includes all of them.
Kevin
- [Qemu-devel] [PATCH v5 01/23] block: Split bdrv_new_root() off bdrv_new(), (continued)
- [Qemu-devel] [PATCH v5 01/23] block: Split bdrv_new_root() off bdrv_new(), Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 05/23] block: Code motion to get rid of stubs/blockdev.c, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 13/23] virtio-blk: Drop redundant VirtIOBlock member conf, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 07/23] block: Eliminate bdrv_iterate(), use bdrv_next(), Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 03/23] block: Connect BlockBackend to BlockDriverState, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 09/23] block: Merge BlockBackend and BlockDriverState name spaces, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 02/23] block: New BlockBackend, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 04/23] block: Connect BlockBackend and DriveInfo, Markus Armbruster, 2014/10/02
- Re: [Qemu-devel] [PATCH v5 04/23] block: Connect BlockBackend and DriveInfo,
Kevin Wolf <=
- [Qemu-devel] [PATCH v5 10/23] block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo(), Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 06/23] block: Make BlockBackend own its BlockDriverState, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 21/23] blockdev: Convert qmp_eject(), qmp_change_blockdev() to BlockBackend, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 14/23] virtio-blk: Rename VirtIOBlkConf variables to conf, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 20/23] block/qapi: Convert qmp_query_block() to BlockBackend, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 18/23] blockdev: Drop superfluous DriveInfo member id, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 08/23] block: Eliminate BlockDriverState member device_name[], Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 23/23] block: Make device model's references to BlockBackend strong, Markus Armbruster, 2014/10/02
- [Qemu-devel] [PATCH v5 17/23] pc87312: Drop unused members of PC87312State, Markus Armbruster, 2014/10/02