From nobody Sun May 5 18:18:05 2024 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; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554302398984410.1440317800598; Wed, 3 Apr 2019 07:39:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:42164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBh3J-0008Jh-KW for importer@patchew.org; Wed, 03 Apr 2019 10:39:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBh26-0007l5-4U for qemu-devel@nongnu.org; Wed, 03 Apr 2019 10:38:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBh24-0001X9-AF for qemu-devel@nongnu.org; Wed, 03 Apr 2019 10:38:30 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:53373) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hBh22-0000cN-8H; Wed, 03 Apr 2019 10:38:27 -0400 Received: from 85-76-110-1-nat.elisa-mobile.fi ([85.76.110.1] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hBh1i-0002Fq-O5; Wed, 03 Apr 2019 16:38:06 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hBh1T-0002ZY-UE; Wed, 03 Apr 2019 17:37:51 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Message-Id:Date:Subject:Cc:To:From; bh=5VHQlSLbmNXpvD0XHY4jKL/Y2Uj1G6s9x9BUehXGs1o=; b=FhT7SZqCzjN3cAXZyJP4Rtmj/S22KK42Wacq1d62tHlVgmNl0W0QerYf1BknP+UcyCFECvdxogphOJ3xaTmcuIlwmuAxz8mWNlLjQfpuXaZQ3DAIuo5eygCrmW1iJWmpaLDrRzY3jnrbAyX4BIvevjZ3IGvhgZ9IkuxclAwYJmereF93gSjdyLJ/T5m+F5Vuhlv56MRUJIHU6dQBuZHYAoOWBmotlZJnarCacMfNEXGaX2nL2aEJ7sjzToZQe3R++39ON5lN7hwKrfoGCnJhXXA8dYsF7TsTHg4sC2nbyUYpXF2QB9LATfKrJ48giNa/W56AXkSrqADz6SIdD44PlA==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 17:37:48 +0300 Message-Id: <20190403143748.9790-1-berto@igalia.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH for-4.1] 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 , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- block/commit.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/block/commit.c b/block/commit.c index ba60fef58a..a0beb7d265 100644 --- a/block/commit.c +++ b/block/commit.c @@ -304,23 +304,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.11.0