From nobody Thu Nov 6 16:10:10 2025 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 148941728760635.484754770992936; Mon, 13 Mar 2017 08:01:27 -0700 (PDT) Received: from localhost ([::1]:52528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnRTQ-0001Yr-4Q for importer@patchew.org; Mon, 13 Mar 2017 11:01:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnRNk-0005pF-Oc for qemu-devel@nongnu.org; Mon, 13 Mar 2017 10:55:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnRNj-0002y3-P5 for qemu-devel@nongnu.org; Mon, 13 Mar 2017 10:55:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56126) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cnRNg-0002vZ-CA; Mon, 13 Mar 2017 10:55:28 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 7419B6AAFD; Mon, 13 Mar 2017 14:55:28 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-150.ams2.redhat.com [10.36.117.150]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2DEtEUb009408; Mon, 13 Mar 2017 10:55:27 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 13 Mar 2017 15:55:05 +0100 Message-Id: <1489416908-3771-10-git-send-email-kwolf@redhat.com> In-Reply-To: <1489416908-3771-1-git-send-email-kwolf@redhat.com> References: <1489416908-3771-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 13 Mar 2017 14:55:28 +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] [PULL 09/12] 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, qemu-devel@nongnu.org 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