From 1adb0b5e0f7c5c4f707b1ffa98e2b15ef51ebbc5 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 7 May 2019 22:35:06 +0200 Subject: [PATCH] blkdebug: Inject errors on .bdrv_co_block_status() Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190507203508.18026-6-mreitz@redhat.com Signed-off-by: Max Reitz --- block/blkdebug.c | 8 ++++++++ qapi/block-core.json | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/block/blkdebug.c b/block/blkdebug.c index 1663ed25af..5ae96c52b0 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -670,7 +670,15 @@ static int coroutine_fn blkdebug_co_block_status(BlockDriverState *bs, int64_t *map, BlockDriverState **file) { + int err; + assert(QEMU_IS_ALIGNED(offset | bytes, bs->bl.request_alignment)); + + err = rule_check(bs, offset, bytes, BLKDEBUG_IO_TYPE_BLOCK_STATUS); + if (err) { + return err; + } + return bdrv_co_block_status_from_file(bs, want_zero, offset, bytes, pnum, map, file); } diff --git a/qapi/block-core.json b/qapi/block-core.json index 60f903afa3..61124431d8 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3281,10 +3281,13 @@ # # @flush: .bdrv_co_flush_to_disk() # +# @block-status: .bdrv_co_block_status() +# # Since: 4.1 ## { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE', - 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush' ] } + 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush', + 'block-status' ] } ## # @BlkdebugInjectErrorOptions: