From nobody Mon Feb 9 05:41:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1559144989; cv=none; d=zoho.com; s=zohoarc; b=UQ09fiKpGy8U6npOS7Mrty7TwvrTLOAP/bJ3ODKXdsVvqU0OPFHnWatJOqpnid3AY7PGRvQiSi29Z8aByET5TfjtrLT2q3Z4+2Yq0zU+zj/bCzz+4ZZywdZJ7g/UVmxo3tPpeAGYFn+RUGyKTh3POfHLzxLPksJ2IKcOjwomwiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559144989; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=n0gqO42z6k+lf2VyaGVfR4DS9heUxIiEC4OmZatpPo4=; b=hUl94iJJhK19BhX7UU1aUk7nH82Ca+wOTKaP3TT1dgNUOplwKlSJXSTopHu8mCSDHliC7iELRn625kDFFTLYhsv/mi3pEawXLf2S05tw8zG9CVbkKNFaXsKuQfxs95MNnTJYhuAJmVonURaskgC7P5vsVwKum6fJ+fx4XPVvKYs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559144989240952.2048018092333; Wed, 29 May 2019 08:49:49 -0700 (PDT) Received: from localhost ([127.0.0.1]:56884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hW0pe-0005qq-QF for importer@patchew.org; Wed, 29 May 2019 11:49:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hW0n9-0004V8-2u for qemu-devel@nongnu.org; Wed, 29 May 2019 11:47:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hW0n7-00053L-RU for qemu-devel@nongnu.org; Wed, 29 May 2019 11:47:03 -0400 Received: from relay.sw.ru ([185.231.240.75]:43116) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hW0n7-00051u-JR; Wed, 29 May 2019 11:47:01 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hW0n1-0004iP-Qs; Wed, 29 May 2019 18:46:55 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Wed, 29 May 2019 18:46:48 +0300 Message-Id: <20190529154654.95870-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190529154654.95870-1-vsementsov@virtuozzo.com> References: <20190529154654.95870-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH v8 1/7] block: teach bdrv_debug_breakpoint skip filters with backing 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: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Teach bdrv_debug_breakpoint and bdrv_debug_remove_breakpoint skip filters with backing. This is needed to implement and use in backup job it's own backup_top filter driver (like mirror already has one), and without this improvement, breakpoint removal will fail at least in 55 iotest. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index 1a73e310c1..e6e9770704 100644 --- a/block.c +++ b/block.c @@ -4982,14 +4982,35 @@ void bdrv_debug_event(BlockDriverState *bs, Blkdebu= gEvent event) bs->drv->bdrv_debug_event(bs, event); } =20 -int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event, - const char *tag) +static BlockDriverState *bdrv_find_debug_node(BlockDriverState *bs) { while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) { - bs =3D bs->file ? bs->file->bs : NULL; + if (bs->file) { + bs =3D bs->file->bs; + continue; + } + + if (bs->drv->is_filter && bs->backing) { + bs =3D bs->backing->bs; + continue; + } + + break; } =20 if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) { + assert(bs->drv->bdrv_debug_remove_breakpoint); + return bs; + } + + return NULL; +} + +int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event, + const char *tag) +{ + bs =3D bdrv_find_debug_node(bs); + if (bs) { return bs->drv->bdrv_debug_breakpoint(bs, event, tag); } =20 @@ -4998,11 +5019,8 @@ int bdrv_debug_breakpoint(BlockDriverState *bs, cons= t char *event, =20 int bdrv_debug_remove_breakpoint(BlockDriverState *bs, const char *tag) { - while (bs && bs->drv && !bs->drv->bdrv_debug_remove_breakpoint) { - bs =3D bs->file ? bs->file->bs : NULL; - } - - if (bs && bs->drv && bs->drv->bdrv_debug_remove_breakpoint) { + bs =3D bdrv_find_debug_node(bs); + if (bs) { return bs->drv->bdrv_debug_remove_breakpoint(bs, tag); } =20 --=20 2.18.0