From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, jcody@redhat.com,
famz@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/6] commit: Implement bdrv_commit_top.bdrv_co_get_block_status
Date: Thu, 9 Mar 2017 12:38:59 +0100 [thread overview]
Message-ID: <1489059542-14232-4-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1489059542-14232-1-git-send-email-kwolf@redhat.com>
In some cases, bdrv_co_get_block_status() is called recursively for the
whole backing chain. The automatically inserted bdrv_commit_top filter
driver must not stop the recursion, so implement a callback that simply
forwards the request to bs->backing.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/commit.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/block/commit.c b/block/commit.c
index 9c41988..932d1e6 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -232,6 +232,17 @@ static int coroutine_fn bdrv_commit_top_preadv(BlockDriverState *bs,
return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags);
}
+static int64_t coroutine_fn bdrv_commit_top_get_block_status(
+ BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum,
+ BlockDriverState **file)
+{
+ *pnum = nb_sectors;
+ *file = bs->backing->bs;
+ return BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID | BDRV_BLOCK_DATA |
+ (sector_num << BDRV_SECTOR_BITS);
+}
+
+
static void bdrv_commit_top_close(BlockDriverState *bs)
{
}
@@ -248,10 +259,11 @@ static void bdrv_commit_top_child_perm(BlockDriverState *bs, BdrvChild *c,
/* Dummy node that provides consistent read to its users without requiring it
* from its backing file and that allows writes on the backing file chain. */
static BlockDriver bdrv_commit_top = {
- .format_name = "commit_top",
- .bdrv_co_preadv = bdrv_commit_top_preadv,
- .bdrv_close = bdrv_commit_top_close,
- .bdrv_child_perm = bdrv_commit_top_child_perm,
+ .format_name = "commit_top",
+ .bdrv_co_preadv = bdrv_commit_top_preadv,
+ .bdrv_co_get_block_status = bdrv_commit_top_get_block_status,
+ .bdrv_close = bdrv_commit_top_close,
+ .bdrv_child_perm = bdrv_commit_top_child_perm,
};
void commit_start(const char *job_id, BlockDriverState *bs,
--
1.8.3.1
next prev parent reply other threads:[~2017-03-09 11:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-09 11:38 [Qemu-devel] [PATCH 0/6] block: More op blocker fixes Kevin Wolf
2017-03-09 11:38 ` [Qemu-devel] [PATCH 1/6] block: Remove check_new_perm from bdrv_replace_child() Kevin Wolf
2017-03-09 11:38 ` [Qemu-devel] [PATCH 2/6] block: Request block status from *file for BDRV_BLOCK_RAW Kevin Wolf
2017-03-09 11:38 ` Kevin Wolf [this message]
2017-03-09 11:39 ` [Qemu-devel] [PATCH 4/6] block: Refresh filename after changing backing file Kevin Wolf
2017-03-09 11:39 ` [Qemu-devel] [PATCH 5/6] mirror: Implement .bdrv_refresh_filename Kevin Wolf
2017-03-09 11:39 ` [Qemu-devel] [PATCH 6/6] commit: " Kevin Wolf
2017-03-09 14:23 ` [Qemu-devel] [PATCH 0/6] block: More op blocker fixes Eric Blake
2017-03-09 17:41 ` 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=1489059542-14232-4-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=famz@redhat.com \
--cc=jcody@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).