Commit 1fdd6933 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

block: Introduce BDS.file_child



Store the BdrvChild for bs->file. At this point, bs->file_child->bs just
duplicates the bs->file pointer. Later, it will completely replace it.

Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
Reviewed-by: default avatarFam Zheng <famz@redhat.com>
Reviewed-by: default avatarJeff Cody <jcody@redhat.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 68e517a8
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -1487,11 +1487,17 @@ static int bdrv_open_inherit(BlockDriverState **pbs, const char *filename,

        assert(file == NULL);
        bs->open_flags = flags;
        ret = bdrv_open_image(&file, filename, options, "file",
                              bs, &child_file, true, &local_err);
        if (ret < 0) {

        bs->file_child = bdrv_open_child(filename, options, "file", bs,
                                         &child_file, true, &local_err);
        if (local_err) {
            ret = -EINVAL;
            goto fail;
        }

        if (bs->file_child) {
            file = bs->file_child->bs;
        }
    }

    /* Image format probing */
+1 −0
Original line number Diff line number Diff line
@@ -381,6 +381,7 @@ struct BlockDriverState {
    BlockDriverState *backing_hd;
    BdrvChild *backing_child;
    BlockDriverState *file;
    BdrvChild *file_child;

    NotifierList close_notifiers;