diff options
author | Max Reitz <mreitz@redhat.com> | 2020-02-18 11:34:42 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2020-02-18 11:55:39 +0100 |
commit | 998a6b2fc55b42c066260a2f75aa11a07e128808 (patch) | |
tree | 75c500abfb23230f7cecbdc11057f00e6fadd6ab /block/blkverify.c | |
parent | 5d69b5ab85d30201c1f5ef34651ba910977fc583 (diff) | |
download | qemu-998a6b2fc55b42c066260a2f75aa11a07e128808.zip qemu-998a6b2fc55b42c066260a2f75aa11a07e128808.tar.gz qemu-998a6b2fc55b42c066260a2f75aa11a07e128808.tar.bz2 |
blkverify: Implement .bdrv_recurse_can_replace()
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200218103454.296704-8-mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/blkverify.c')
-rw-r--r-- | block/blkverify.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/block/blkverify.c b/block/blkverify.c index 304b0a1..0add3ab 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -282,6 +282,20 @@ static bool blkverify_recurse_is_first_non_filter(BlockDriverState *bs, return bdrv_recurse_is_first_non_filter(s->test_file->bs, candidate); } +static bool blkverify_recurse_can_replace(BlockDriverState *bs, + BlockDriverState *to_replace) +{ + BDRVBlkverifyState *s = bs->opaque; + + /* + * blkverify quits the whole qemu process if there is a mismatch + * between bs->file->bs and s->test_file->bs. Therefore, we know + * know that both must match bs and we can recurse down to either. + */ + return bdrv_recurse_can_replace(bs->file->bs, to_replace) || + bdrv_recurse_can_replace(s->test_file->bs, to_replace); +} + static void blkverify_refresh_filename(BlockDriverState *bs) { BDRVBlkverifyState *s = bs->opaque; @@ -328,6 +342,7 @@ static BlockDriver bdrv_blkverify = { .is_filter = true, .bdrv_recurse_is_first_non_filter = blkverify_recurse_is_first_non_filter, + .bdrv_recurse_can_replace = blkverify_recurse_can_replace, }; static void bdrv_blkverify_init(void) |