From nobody Thu Dec 18 13:28:39 2025 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557242976; cv=none; d=zoho.com; s=zohoarc; b=OFFbpX3Dw4kLAyy5/lLVF0y4WGGiOSAkSS1rh+xSOMU3vLVvjnSq+bXIXC/o2WA3iVVbq9BAYlM4N/e9x6EF+hsLjq6jNAupy9NDEzJP5mp9jvlpYuQFvoBzaSL7oZvbonUPLGbjJv+5dHLFD9X2C/kG3R49Y3OSrl2s07qftAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557242976; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=bs90NIuGADH0/nfZy06WnqpYOqEM4YB2adVDpCk/mMc=; b=iyzlgYtS44lP2rVX6Yk4p3svH386WP9rUXSDwdqogwgI4RKOPgVKNc/9vLgJSwLtnQ36KAU4a9PZdtCSFN6lkfcktF9LCnXxUFjjtyiBO2V2Cuwdjhu/hvFP/4ZKaiK9tiiCtDInk4crP3sYfV0qZWw94vn7P0fNHCbIfz8uXKM= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155724297675490.84622766400469; Tue, 7 May 2019 08:29:36 -0700 (PDT) Received: from localhost ([127.0.0.1]:48614 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hO228-00015j-Nc for importer@patchew.org; Tue, 07 May 2019 11:29:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hO1rm-00086D-4M for qemu-devel@nongnu.org; Tue, 07 May 2019 11:18:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hO1rl-00045b-7W for qemu-devel@nongnu.org; Tue, 07 May 2019 11:18:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35092) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hO1ri-00043c-JF; Tue, 07 May 2019 11:18:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2A53308793B; Tue, 7 May 2019 15:18:45 +0000 (UTC) Received: from localhost (unknown [10.40.205.217]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A4D2173D9; Tue, 7 May 2019 15:18:45 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 7 May 2019 17:18:18 +0200 Message-Id: <20190507151819.17401-11-mreitz@redhat.com> In-Reply-To: <20190507151819.17401-1-mreitz@redhat.com> References: <20190507151819.17401-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 07 May 2019 15:18:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/11] commit: Use bdrv_append() in commit_start() 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: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Alberto Garcia This function combines bdrv_set_backing_hd() and bdrv_replace_node() so we can use it to simplify the code a bit in commit_start(). Signed-off-by: Alberto Garcia Message-id: 20190403143748.9790-1-berto@igalia.com Signed-off-by: Max Reitz --- block/commit.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/block/commit.c b/block/commit.c index 27537d995b..14e5bb394c 100644 --- a/block/commit.c +++ b/block/commit.c @@ -303,23 +303,14 @@ void commit_start(const char *job_id, BlockDriverStat= e *bs, commit_top_bs->total_sectors =3D top->total_sectors; bdrv_set_aio_context(commit_top_bs, bdrv_get_aio_context(top)); =20 - bdrv_set_backing_hd(commit_top_bs, top, &local_err); + bdrv_append(commit_top_bs, top, &local_err); if (local_err) { - bdrv_unref(commit_top_bs); - commit_top_bs =3D NULL; - error_propagate(errp, local_err); - goto fail; - } - bdrv_replace_node(top, commit_top_bs, &local_err); - if (local_err) { - bdrv_unref(commit_top_bs); commit_top_bs =3D NULL; error_propagate(errp, local_err); goto fail; } =20 s->commit_top_bs =3D commit_top_bs; - bdrv_unref(commit_top_bs); =20 /* Block all nodes between top and base, because they will * disappear from the chain after this operation. */ --=20 2.20.1