Received: from eggs.gnu.org ([209.51.188.92]:57921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFLuk-0007DO-Gl for qemu-devel@nongnu.org; Sat, 13 Apr 2019 12:54:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFLuj-0002oH-K6 for qemu-devel@nongnu.org; Sat, 13 Apr 2019 12:54:02 -0400 From: Max Reitz Date: Sat, 13 Apr 2019 18:53:41 +0200 Message-Id: <20190413165343.9018-6-mreitz@redhat.com> In-Reply-To: <20190413165343.9018-1-mreitz@redhat.com> References: <20190413165343.9018-1-mreitz@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v3 5/7] 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 , Vladimir Sementsov-Ogievskiy , Andrey Shinkevich , Eric Blake , Kevin Wolf , "Denis V . Lunev" Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- 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 717b13f7f5..2aa675a192 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3252,10 +3252,13 @@ # # @flush: .bdrv_co_flush_to_disk() # +# @block-status: .bdrv_co_block_status() +# # Since: 4.1 ## { '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 69c608be6f..df9c8b1673 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.20.1