From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: jsnow@redhat.com, mreitz@redhat.com, qemu-block@nongnu.org,
Kevin Wolf <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH v3 4/4] blkdebug: Support .bdrv_co_get_block_status
Date: Mon, 5 Jun 2017 14:08:24 -0500 [thread overview]
Message-ID: <20170605190824.25184-5-eblake@redhat.com> (raw)
In-Reply-To: <20170605190824.25184-1-eblake@redhat.com>
Without a passthrough status of BDRV_BLOCK_RAW, anything wrapped by
blkdebug appears 100% allocated as data. Better is treating it the
same as the underlying file being wrapped.
Update iotest 177 for the new expected output.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
v3: rebase to earlier changes
v2: tweak commit message
---
block/blkdebug.c | 11 +++++++++++
tests/qemu-iotests/177.out | 5 ++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/block/blkdebug.c b/block/blkdebug.c
index a5196e8..1ad8d65 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -642,6 +642,16 @@ static int coroutine_fn blkdebug_co_pdiscard(BlockDriverState *bs,
return bdrv_co_pdiscard(bs->file->bs, offset, count);
}
+static int64_t coroutine_fn blkdebug_co_get_block_status(
+ BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum,
+ BlockDriverState **file)
+{
+ *pnum = nb_sectors;
+ *file = bs->file->bs;
+ return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID |
+ (sector_num << BDRV_SECTOR_BITS);
+}
+
static void blkdebug_close(BlockDriverState *bs)
{
BDRVBlkdebugState *s = bs->opaque;
@@ -912,6 +922,7 @@ static BlockDriver bdrv_blkdebug = {
.bdrv_co_flush_to_disk = blkdebug_co_flush,
.bdrv_co_pwrite_zeroes = blkdebug_co_pwrite_zeroes,
.bdrv_co_pdiscard = blkdebug_co_pdiscard,
+ .bdrv_co_get_block_status = blkdebug_co_get_block_status,
.bdrv_debug_event = blkdebug_debug_event,
.bdrv_debug_breakpoint = blkdebug_debug_breakpoint,
diff --git a/tests/qemu-iotests/177.out b/tests/qemu-iotests/177.out
index fcfbfa3..43a7778 100644
--- a/tests/qemu-iotests/177.out
+++ b/tests/qemu-iotests/177.out
@@ -46,6 +46,9 @@ read 30408704/30408704 bytes at offset 80740352
read 23068672/23068672 bytes at offset 111149056
22 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length File
-0 0x8000000 json:{"image": {"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}}, "driver": "blkdebug", "align": "4k"}
+0 0x800000 TEST_DIR/t.IMGFMT
+0x900000 0x2400000 TEST_DIR/t.IMGFMT
+0x3c00000 0x1100000 TEST_DIR/t.IMGFMT
+0x6a00000 0x1600000 TEST_DIR/t.IMGFMT
No errors were found on the image.
*** done
--
2.9.4
next prev parent reply other threads:[~2017-06-05 19:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 19:08 [Qemu-devel] [PATCH v3 0/4] more blkdebug tweaks Eric Blake
2017-06-05 19:08 ` [Qemu-devel] [PATCH v3 1/4] qemu-io: Don't die on second open Eric Blake
2017-06-05 19:58 ` Eric Blake
2017-06-06 12:51 ` Kevin Wolf
2017-06-05 19:08 ` [Qemu-devel] [PATCH v3 2/4] block: Guarantee that *file is set on bdrv_get_block_status() Eric Blake
2017-06-05 19:08 ` [Qemu-devel] [PATCH v3 3/4] block: Simplify use of BDRV_BLOCK_RAW Eric Blake
2017-06-05 19:08 ` Eric Blake [this message]
2017-06-05 19:31 ` [Qemu-devel] [PATCH v3 0/4] more blkdebug tweaks no-reply
2017-06-05 19:35 ` Eric Blake
2017-06-06 12:19 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170605190824.25184-5-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).