From nobody Tue Feb 10 00:23:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1603391050; cv=none; d=zohomail.com; s=zohoarc; b=IQ1/Kg5L/Sla1g/P3OOaEs1Rh/TCumtLFoJ5UUcgYs++E9vStigD1RWOcax4jFNKHYbZxcTcw+WbCrqEV1uRmkD+p58gFSLNJYqacT3/xC5q+RWq6isOEg2MmhEhxrOadZx/4KFGfxVpN9sEy0RA2QjojrWHm2AQu44pkqkfm20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603391050; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=+M72JHeUqrsOkb2rAht9eWphUYvt8fzmRhYmAVZ5c6U=; b=Uw6LOZ6oAidLMoJ8eVIO740AF0OLc0QB/8Hl+lDDLQ+Nstlg4ah0euMJeggHsaWccMhrgy7XilKuiwYN+uPPwmm0blEAg+mC2TM1MG24e2MGhBsGgmYkK7z0hURjisGlm0HL4DiWI7JvtC2DkCllrV6XC9hnpyOtvdcrDeSOr4w= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1603391050485933.2582209404139; Thu, 22 Oct 2020 11:24:10 -0700 (PDT) Received: from localhost ([::1]:39464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVfFx-0001Eq-FH for importer@patchew.org; Thu, 22 Oct 2020 14:24:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVf64-0000WC-VF; Thu, 22 Oct 2020 14:14:01 -0400 Received: from relay.sw.ru ([185.231.240.75]:52088 helo=relay3.sw.ru) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVf5x-0001nq-Hf; Thu, 22 Oct 2020 14:13:56 -0400 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kVf5r-005dVw-JD; Thu, 22 Oct 2020 21:13:43 +0300 To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, kwolf@redhat.com, mreitz@redhat.com, armbru@redhat.com, jsnow@redhat.com, eblake@redhat.com, den@openvz.org, vsementsov@virtuozzo.com, andrey.shinkevich@virtuozzo.com Subject: [PATCH v12 06/14] copy-on-read: pass bottom node name to COR driver Date: Thu, 22 Oct 2020 21:13:35 +0300 Message-Id: <1603390423-980205-7-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603390423-980205-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1603390423-980205-1-git-send-email-andrey.shinkevich@virtuozzo.com> Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=185.231.240.75; envelope-from=andrey.shinkevich@virtuozzo.com; helo=relay3.sw.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/22 14:13:46 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Andrey Shinkevich From: Andrey Shinkevich via Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We are going to use the COR-filter for a block-stream job. To limit COR operations by the base node in the backing chain during stream job, pass the bottom node name, that is the first non-filter overlay of the base, to the copy-on-read driver as the base node itself may change due to possible concurrent jobs. The rest of the functionality will be implemented in the patch that follows. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/copy-on-read.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 618c4c4..3d8e4db 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -24,18 +24,24 @@ #include "block/block_int.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qapi/qmp/qerror.h" +#include "qapi/qmp/qdict.h" #include "block/copy-on-read.h" =20 =20 typedef struct BDRVStateCOR { bool active; + BlockDriverState *bottom_bs; } BDRVStateCOR; =20 =20 static int cor_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { + BlockDriverState *bottom_bs =3D NULL; BDRVStateCOR *state =3D bs->opaque; + /* Find a bottom node name, if any */ + const char *bottom_node =3D qdict_get_try_str(options, "bottom"); =20 bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, @@ -51,7 +57,17 @@ static int cor_open(BlockDriverState *bs, QDict *options= , int flags, ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) & bs->file->bs->supported_zero_flags); =20 + if (bottom_node) { + bottom_bs =3D bdrv_lookup_bs(NULL, bottom_node, errp); + if (!bottom_bs) { + error_setg(errp, QERR_BASE_NOT_FOUND, bottom_node); + qdict_del(options, "bottom"); + return -EINVAL; + } + qdict_del(options, "bottom"); + } state->active =3D true; + state->bottom_bs =3D bottom_bs; =20 /* * We don't need to call bdrv_child_refresh_perms() now as the permiss= ions --=20 1.8.3.1