[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 09/12] commit: Implement bdrv_commit_top.bdrv_co_get_
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 09/12] commit: Implement bdrv_commit_top.bdrv_co_get_block_status |
Date: |
Mon, 13 Mar 2017 15:55:05 +0100 |
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
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
- [Qemu-block] [PULL 00/12] Block layer fixes for 2.9.0-rc1, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 01/12] backup: allow target without .bdrv_get_info, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 02/12] file-posix: Consider max_segments for BlockLimits.max_transfer, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 04/12] backup: React to bdrv_is_allocated() errors, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 05/12] vvfat: React to bdrv_is_allocated() errors, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 06/12] migration: Document handling of bdrv_is_allocated() errors, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 03/12] block: Drop unmaintained 'archipelago' driver, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 08/12] block: Request block status from *file for BDRV_BLOCK_RAW, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 10/12] block: Refresh filename after changing backing file, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 07/12] block: Remove check_new_perm from bdrv_replace_child(), Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 09/12] commit: Implement bdrv_commit_top.bdrv_co_get_block_status,
Kevin Wolf <=
- [Qemu-block] [PULL 11/12] mirror: Implement .bdrv_refresh_filename, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 12/12] commit: Implement .bdrv_refresh_filename, Kevin Wolf, 2017/03/13
- Re: [Qemu-block] [Qemu-devel] [PULL 00/12] Block layer fixes for 2.9.0-rc1, Peter Maydell, 2017/03/13