From nobody Tue May 7 20:07:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489059884423237.06829935032067; Thu, 9 Mar 2017 03:44:44 -0800 (PST) Received: from localhost ([::1]:33434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwUt-0004Sx-64 for importer@patchew.org; Thu, 09 Mar 2017 06:44:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwPb-0000Hi-7r for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clwPZ-0006XP-TE for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32996) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clwPU-0006Ut-QZ; Thu, 09 Mar 2017 06:39:08 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE8578124F; Thu, 9 Mar 2017 11:39:08 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-12.ams2.redhat.com [10.36.117.12]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29Bd4UL005283; Thu, 9 Mar 2017 06:39:07 -0500 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 9 Mar 2017 12:38:57 +0100 Message-Id: <1489059542-14232-2-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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 09 Mar 2017 11:39:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/6] block: Remove check_new_perm from bdrv_replace_child() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All callers pass false now, so the parameter can go away again. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/block.c b/block.c index dd9ded8..756d607 100644 --- a/block.c +++ b/block.c @@ -1751,8 +1751,18 @@ static void bdrv_replace_child_noperm(BdrvChild *chi= ld, } } =20 -static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs, - bool check_new_perm) +/* + * Updates @child to change its reference to point to @new_bs, including + * checking and applying the necessary permisson updates both to the old n= ode + * and to @new_bs. + * + * NULL is passed as @new_bs for removing the reference before freeing @ch= ild. + * + * If @new_bs is not NULL, bdrv_check_perm() must be called beforehand, as= this + * function uses bdrv_set_perm() to update the permissions according to th= e new + * reference that @new_bs gets. + */ +static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs) { BlockDriverState *old_bs =3D child->bs; uint64_t perm, shared_perm; @@ -1770,9 +1780,6 @@ static void bdrv_replace_child(BdrvChild *child, Bloc= kDriverState *new_bs, =20 if (new_bs) { bdrv_get_cumulative_perm(new_bs, &perm, &shared_perm); - if (check_new_perm) { - bdrv_check_perm(new_bs, perm, shared_perm, NULL, &error_abort); - } bdrv_set_perm(new_bs, perm, shared_perm); } } @@ -1803,7 +1810,7 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *c= hild_bs, }; =20 /* This performs the matching bdrv_set_perm() for the above check. */ - bdrv_replace_child(child, child_bs, false); + bdrv_replace_child(child, child_bs); =20 return child; } @@ -1840,7 +1847,7 @@ static void bdrv_detach_child(BdrvChild *child) child->next.le_prev =3D NULL; } =20 - bdrv_replace_child(child, NULL, false); + bdrv_replace_child(child, NULL); =20 g_free(child->name); g_free(child); --=20 1.8.3.1 From nobody Tue May 7 20:07:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489059622512375.0011504929105; Thu, 9 Mar 2017 03:40:22 -0800 (PST) Received: from localhost ([::1]:33402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwQf-0000Ja-Ac for importer@patchew.org; Thu, 09 Mar 2017 06:40:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwPa-0000H2-EM for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clwPZ-0006Wm-FK for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35770) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clwPW-0006VS-LZ; Thu, 09 Mar 2017 06:39:10 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0687C04B954; Thu, 9 Mar 2017 11:39:10 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-12.ams2.redhat.com [10.36.117.12]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29Bd4UM005283; Thu, 9 Mar 2017 06:39:09 -0500 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 9 Mar 2017 12:38:58 +0100 Message-Id: <1489059542-14232-3-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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 09 Mar 2017 11:39:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/6] block: Request block status from *file for BDRV_BLOCK_RAW X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This fixes bdrv_co_get_block_status() for the bdrv_mirror_top block driver, which must fall through to bs->backing instead of bs->file. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index 8f38d46..2709a70 100644 --- a/block/io.c +++ b/block/io.c @@ -1760,7 +1760,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(= BlockDriverState *bs, =20 if (ret & BDRV_BLOCK_RAW) { assert(ret & BDRV_BLOCK_OFFSET_VALID); - ret =3D bdrv_get_block_status(bs->file->bs, ret >> BDRV_SECTOR_BIT= S, + ret =3D bdrv_get_block_status(*file, ret >> BDRV_SECTOR_BITS, *pnum, pnum, file); goto out; } --=20 1.8.3.1 From nobody Tue May 7 20:07:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489059717335749.3153515887495; Thu, 9 Mar 2017 03:41:57 -0800 (PST) Received: from localhost ([::1]:33418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwSB-0001ji-Qn for importer@patchew.org; Thu, 09 Mar 2017 06:41:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwPc-0000JA-AV for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clwPb-0006Xz-6u for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59874) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clwPY-0006W8-GO; Thu, 09 Mar 2017 06:39:12 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95EA637EEB; Thu, 9 Mar 2017 11:39:12 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-12.ams2.redhat.com [10.36.117.12]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29Bd4UN005283; Thu, 9 Mar 2017 06:39:11 -0500 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 9 Mar 2017 12:38:59 +0100 Message-Id: <1489059542-14232-4-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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 09 Mar 2017 11:39:12 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/6] commit: Implement bdrv_commit_top.bdrv_co_get_block_status X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake --- 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(BlockDr= iverState *bs, return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags); } =20 +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 =3D nb_sectors; + *file =3D 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(BlockDriverSta= te *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 =3D { - .format_name =3D "commit_top", - .bdrv_co_preadv =3D bdrv_commit_top_preadv, - .bdrv_close =3D bdrv_commit_top_close, - .bdrv_child_perm =3D bdrv_commit_top_child_perm, + .format_name =3D "commit_top", + .bdrv_co_preadv =3D bdrv_commit_top_preadv, + .bdrv_co_get_block_status =3D bdrv_commit_top_get_block_status, + .bdrv_close =3D bdrv_commit_top_close, + .bdrv_child_perm =3D bdrv_commit_top_child_perm, }; =20 void commit_start(const char *job_id, BlockDriverState *bs, --=20 1.8.3.1 From nobody Tue May 7 20:07:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489059654640609.6050692514143; Thu, 9 Mar 2017 03:40:54 -0800 (PST) Received: from localhost ([::1]:33410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwRB-0000nm-9e for importer@patchew.org; Thu, 09 Mar 2017 06:40:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwPe-0000LR-5W for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clwPd-0006Yo-0P for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35798) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clwPa-0006Wy-8I; Thu, 09 Mar 2017 06:39:14 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66A51C04B93D; Thu, 9 Mar 2017 11:39:14 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-12.ams2.redhat.com [10.36.117.12]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29Bd4UO005283; Thu, 9 Mar 2017 06:39:12 -0500 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 9 Mar 2017 12:39:00 +0100 Message-Id: <1489059542-14232-5-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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 09 Mar 2017 11:39:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/6] block: Refresh filename after changing backing file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In bdrv_open_inherit(), the filename is refreshed after opening the backing file, but we neglected to do the same when the backing file changes later. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block.c b/block.c index 756d607..516cefe 100644 --- a/block.c +++ b/block.c @@ -1933,6 +1933,8 @@ void bdrv_set_backing_hd(BlockDriverState *bs, BlockD= riverState *backing_hd, bdrv_unref(backing_hd); } =20 + bdrv_refresh_filename(bs); + out: bdrv_refresh_limits(bs, NULL); } --=20 1.8.3.1 From nobody Tue May 7 20:07:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489059778049528.9913582664475; Thu, 9 Mar 2017 03:42:58 -0800 (PST) Received: from localhost ([::1]:33423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwT9-0002na-RJ for importer@patchew.org; Thu, 09 Mar 2017 06:42:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwPh-0000PB-W1 for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clwPe-0006Zd-Ui for qemu-devel@nongnu.org; Thu, 09 Mar 2017 06:39:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34146) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clwPc-0006YI-3r; Thu, 09 Mar 2017 06:39:16 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F78180F90; Thu, 9 Mar 2017 11:39:16 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-12.ams2.redhat.com [10.36.117.12]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29Bd4UP005283; Thu, 9 Mar 2017 06:39:14 -0500 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 9 Mar 2017 12:39:01 +0100 Message-Id: <1489059542-14232-6-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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 09 Mar 2017 11:39:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 5/6] mirror: Implement .bdrv_refresh_filename X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We want query-block to return the right filename, even if a mirror job put a bdrv_mirror_top on top of the actual image format driver. Let bdrv_mirror_top.bdrv_refresh_filename get the filename from its backing file. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/mirror.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/mirror.c b/block/mirror.c index a5d30ee..4f3a5cb 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -12,6 +12,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "trace.h" #include "block/blockjob_int.h" #include "block/block_int.h" @@ -1060,6 +1061,13 @@ static int coroutine_fn bdrv_mirror_top_pdiscard(Blo= ckDriverState *bs, return bdrv_co_pdiscard(bs->backing->bs, offset, count); } =20 +static void bdrv_mirror_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_mirror_top_close(BlockDriverState *bs) { } @@ -1088,6 +1096,7 @@ static BlockDriver bdrv_mirror_top =3D { .bdrv_co_pdiscard =3D bdrv_mirror_top_pdiscard, .bdrv_co_flush =3D bdrv_mirror_top_flush, .bdrv_co_get_block_status =3D bdrv_mirror_top_get_block_status, + .bdrv_refresh_filename =3D bdrv_mirror_top_refresh_filename, .bdrv_close =3D bdrv_mirror_top_close, .bdrv_child_perm =3D bdrv_mirror_top_child_perm, }; --=20 1.8.3.1 From nobody Tue May 7 20:07:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489059839408604.4465507075417; Thu, 9 Mar 2017 03:43:59 -0800 (PST) Received: from localhost ([::1]:33428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clwU9-0003YE-K9 for importer@patchew.org; Thu, 09 Mar 2017 06:43:57 -0500 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 Received: from mx1.redhat.com ([209.132.183.28]:46566) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clwPd-0006Yu-Tr; Thu, 09 Mar 2017 06:39:18 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11B4972AE8; Thu, 9 Mar 2017 11:39:18 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-12.ams2.redhat.com [10.36.117.12]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v29Bd4UQ005283; Thu, 9 Mar 2017 06:39:16 -0500 From: Kevin Wolf To: qemu-block@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 09 Mar 2017 11:39:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 6/6] commit: Implement .bdrv_refresh_filename X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake --- 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 @@ */ =20 #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); } =20 +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); +} =20 static void bdrv_commit_top_close(BlockDriverState *bs) { @@ -262,6 +269,7 @@ static BlockDriver bdrv_commit_top =3D { .format_name =3D "commit_top", .bdrv_co_preadv =3D bdrv_commit_top_preadv, .bdrv_co_get_block_status =3D bdrv_commit_top_get_block_status, + .bdrv_refresh_filename =3D bdrv_commit_top_refresh_filename, .bdrv_close =3D bdrv_commit_top_close, .bdrv_child_perm =3D bdrv_commit_top_child_perm, }; --=20 1.8.3.1