block: Use bdrv_filter_(bs|child) where obvious

Places that use patterns like

    if (bs->drv->is_filter && bs->file) {
        ... something about bs->file->bs ...
    }

should be

    BlockDriverState *filtered = bdrv_filter_bs(bs);
    if (filtered) {
        ... something about @filtered ...
    }

instead.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Max Reitz 2019-06-12 17:03:38 +02:00 committed by Kevin Wolf
parent 4935e8be22
commit 93393e698c
3 changed files with 26 additions and 20 deletions

View file

@ -615,13 +615,7 @@ static int init_dirty_bitmap_migration(DBMSaveState *s)
while (bs && bs->drv && bs->drv->is_filter &&
!bdrv_has_named_bitmaps(bs))
{
if (bs->backing) {
bs = bs->backing->bs;
} else if (bs->file) {
bs = bs->file->bs;
} else {
bs = NULL;
}
bs = bdrv_filter_bs(bs);
}
if (bs && bs->drv && !bs->drv->is_filter) {