From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTsOd-0006NH-0g for qemu-devel@nongnu.org; Mon, 03 Dec 2018 12:52:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTsOZ-0007SR-RD for qemu-devel@nongnu.org; Mon, 03 Dec 2018 12:52:38 -0500 From: Max Reitz Date: Mon, 3 Dec 2018 18:52:10 +0100 Message-Id: <20181203175211.8230-6-mreitz@redhat.com> In-Reply-To: <20181203175211.8230-1-mreitz@redhat.com> References: <20181203175211.8230-1-mreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-next 5/6] blkdebug: Inject errors on .bdrv_co_block_status() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Max Reitz , Kevin Wolf , Eric Blake , Markus Armbruster Signed-off-by: Max Reitz --- qapi/block-core.json | 5 ++++- block/blkdebug.c | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 045206196b..bfe48f71f4 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3041,10 +3041,13 @@ # # @flush: .bdrv_co_flush_to_disk() # +# @block-status: .bdrv_co_block_status() +# # Since: 4.0 ## { 'enum': 'BlkdebugIOType', - 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush' ] } + 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush', + 'block-status' ] } =20 ## # @BlkdebugInjectErrorOptions: diff --git a/block/blkdebug.c b/block/blkdebug.c index 51f07648ba..b86dfe58b5 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -670,7 +670,15 @@ static int coroutine_fn blkdebug_co_block_status(Blo= ckDriverState *bs, int64_t *map, BlockDriverState **file= ) { + int err; + assert(QEMU_IS_ALIGNED(offset | bytes, bs->bl.request_alignment)); + + err =3D rule_check(bs, offset, bytes, BLKDEBUGIO_TYPE_BLOCK_STATUS); + if (err) { + return err; + } + return bdrv_co_block_status_from_file(bs, want_zero, offset, bytes, pnum, map, file); } --=20 2.19.2