aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-03-09 11:49:16 +0100
committerKevin Wolf <kwolf@redhat.com>2017-03-13 12:49:33 +0100
commitdcbf37ce41a52698550f8f8b2f14b5e6fee22d2d (patch)
treef69a1fb502186e34897e27a99d5410edc471cb07
parentfd4a6493bb7c5f9bea0e7d9de09ccc0d573e3789 (diff)
commit: Implement .bdrv_refresh_filename
We want query-block to return the right filename, even if a commit job put a bdrv_commit_top on top of the actual image format driver. Let bdrv_commit_top.bdrv_refresh_filename get the filename from its backing file. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
-rw-r--r--block/commit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block/commit.c b/block/commit.c
index 932d1e6046..28324820a4 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -13,6 +13,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/cutils.h"
#include "trace.h"
#include "block/block_int.h"
#include "block/blockjob_int.h"
@@ -242,6 +243,12 @@ static int64_t coroutine_fn bdrv_commit_top_get_block_status(
(sector_num << BDRV_SECTOR_BITS);
}
+static void bdrv_commit_top_refresh_filename(BlockDriverState *bs, QDict *opts)
+{
+ bdrv_refresh_filename(bs->backing->bs);
+ pstrcpy(bs->exact_filename, sizeof(bs->exact_filename),
+ bs->backing->bs->filename);
+}
static void bdrv_commit_top_close(BlockDriverState *bs)
{
@@ -262,6 +269,7 @@ static BlockDriver bdrv_commit_top = {
.format_name = "commit_top",
.bdrv_co_preadv = bdrv_commit_top_preadv,
.bdrv_co_get_block_status = bdrv_commit_top_get_block_status,
+ .bdrv_refresh_filename = bdrv_commit_top_refresh_filename,
.bdrv_close = bdrv_commit_top_close,
.bdrv_child_perm = bdrv_commit_top_child_perm,
};