From nobody Fri Oct 24 22:13:26 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.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519922856621927.0014106556229; Thu, 1 Mar 2018 08:47:36 -0800 (PST) Received: from localhost ([::1]:58067 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erRMl-0006ye-Hh for importer@patchew.org; Thu, 01 Mar 2018 11:47:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erRCG-0006h3-VC for qemu-devel@nongnu.org; Thu, 01 Mar 2018 11:36:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erRCE-0002tv-ME for qemu-devel@nongnu.org; Thu, 01 Mar 2018 11:36:44 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:38572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1erRCE-0002tA-Cj; Thu, 01 Mar 2018 11:36:42 -0500 Received: by mail-wr0-x244.google.com with SMTP id n7so7230815wrn.5; Thu, 01 Mar 2018 08:36:42 -0800 (PST) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id a14sm4187152wrf.22.2018.03.01.08.36.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Mar 2018 08:36:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=cgfAZrQh44wlcFYUgH10YxDyEqk2e5XHQINoefUSSEA=; b=jvdPxZ4qug7HF+KiVB4XnQTIGPPDmvR/LO3UTha7BNfrCSITwW3CZqns6MU9PV14Mq Sctktgc0nOn1m6iUGA0iclIRSiw4PmTBhSHSjvaFcyCpNOnqCZ6PLMmkncZmO/ODwpfR Md3Qq1DFXFTa10sXSchpvUVLgNZ+mWiNaaVdD3CRGVirW5LBFIxSoqJzp7GdIzUpcw9K MX8QZ2bqvGZ2FKBoYaCV4zL7ZK/bKXMakJ1Dfl8lauCmlZYeC6KPenmsF0gezoo7/YkB D/pNkNj0IfjYGqwZqUteF0yf+b4etbhe+jC57EVJvZO6JvKLogSI/6kk8sgCMOBv81Q8 ndFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=cgfAZrQh44wlcFYUgH10YxDyEqk2e5XHQINoefUSSEA=; b=FsmgwTeM07m1VW0jXxtra10NfIF/6l6/+EaEeIwW/7Ui4odX6HKnm/7f4BdBuCEifk xxoJpjiOX5CFpDlRTAoJ23QCRDiIzSUe5h8JMPqjkIw1GIS58jgle6pInFCn6lHHE9SL J7w6kPpakRARif0KZc2ZBxkXhSOHXZQQCiAaRewK6Xng58lJn9sDMNolsFPYLNdZXrSy XbZfRtw8vsYCFWQNMrdmg+/hWFIJ8CcJijc+JmM1h5c6VSsvDMYJdHVjsPP11YSuCo5l R8xrPZOQX70A0ZMVuizxbfKarMEiSjaXnhpiCuwQOMPHrUHEv0GymcxtDSRN34y7+y4T QTVA== X-Gm-Message-State: APf1xPAD5rLqkD6uywqnSMjkUnihyp7nIU+ATZtaH6cUxUMV5yW3UXoR bMSHcm/ew0hgqgbrfViRaC3gTu4M X-Google-Smtp-Source: AG47ELvANp0rAA4QIHfrRW2PvP2ovlQz+tf9y+IHoXS/BuH1rb9c0ZI7CTxxNkV/jnLTPXkFUPh/Mw== X-Received: by 10.223.136.72 with SMTP id e8mr2218475wre.163.1519922195066; Thu, 01 Mar 2018 08:36:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 1 Mar 2018 17:36:15 +0100 Message-Id: <20180301163619.21072-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180301163619.21072-1-pbonzini@redhat.com> References: <20180301163619.21072-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH 4/8] qcow2: fix flushing after dirty bitmap metadata writes 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-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" update_header_sync itself does not need to flush the caches to disk. The only paths that allocate clusters are: - bitmap_list_store with in_place=3Dfalse, called by update_ext_header_and_= dir - store_bitmap_data, called by store_bitmap - store_bitmap, called by qcow2_store_persistent_dirty_bitmaps and followed by update_ext_header_and_dir So in the end the central place where we need to flush the caches is update_ext_header_and_dir. Signed-off-by: Paolo Bonzini --- block/qcow2-bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index efa10c6663..a2dbd9fab4 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -110,7 +110,7 @@ static int update_header_sync(BlockDriverState *bs) return ret; } =20 - return bdrv_flush(bs); + return bdrv_flush(bs->file->bs); } =20 static inline void bitmap_table_to_be(uint64_t *bitmap_table, size_t size) @@ -882,7 +882,7 @@ static int update_ext_header_and_dir(BlockDriverState *= bs, return ret; } =20 - ret =3D bdrv_flush(bs->file->bs); + ret =3D qcow2_flush_caches(bs); if (ret < 0) { goto fail; } --=20 2.14.3