From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwPk-0000R9-Ed for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clwPj-0006aY-Dd for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:24 -0500 From: Kevin Wolf Date: Thu, 9 Mar 2017 12:39:02 +0100 Message-Id: <1489059542-14232-7-git-send-email-kwolf@redhat.com> In-Reply-To: <1489059542-14232-1-git-send-email-kwolf@redhat.com> References: <1489059542-14232-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 6/6] commit: Implement .bdrv_refresh_filename List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, jcody@redhat.com, famz@redhat.com, qemu-devel@nongnu.org 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 --- block/commit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/commit.c b/block/commit.c index 932d1e6..2832482 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, }; -- 1.8.3.1