On 07/04/2017 04:44 AM, Kevin Wolf wrote: > Am 04.07.2017 um 10:40 hat Manos Pitsidianakis geschrieben: >> The following functions fail if bs->drv does not implement them: >>
>> @@ -511,6 +513,8 @@ int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry >> *geo) >> >> if (drv && drv->bdrv_probe_geometry) { >> return drv->bdrv_probe_geometry(bs, geo); >> + } else if (drv && bs->file && bs->file->bs) { >> + return bdrv_probe_geometry(bs->file->bs, geo); >> } >> >> return -ENOTSUP; > > The probed geometry would refer to the physical image file, not to the > actually presented image. So propagating this to bs->file is wrong for > image formats. > > Possibly checking .is_filter in addition would be enough. In fact, this made me think: if we define .is_filter as an enum instead of a bool, we could implement 0 for no filter, 1 for file filter, and 2 for backing filter. Then instead of having to have 2 separate default bdrv_get_block_status_for_*() generic functions in patch 4, we could instead patch bdrv_co_get_block_status() to check .is_filter, and automatically fall back to bs->file or bs->backing according to the enum value stored in .is_filter. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature