From nobody Sun Oct 5 19:23:37 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615306413; cv=none; d=zohomail.com; s=zohoarc; b=YM62llC4Db7QAwldrQHfpQC8SHiW+MGWkX3xA5+daFwea5DmQnAex5WmJBUFS2Z7Invn5AOsIO2uwR3umTGHXRH7g7onRyysxofYLkE/Eb3+zq+Mk1XFqkU7Hnf9HMPSBpARNuKAKVa0ptCPNbNYQqoqXWa86kLahSHE00NFIgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615306413; h=Content-Type: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; bh=MgMhVCXkfRHZO1PG5U77+yHl+aw+vu6yfdM7Xctm6X0=; b=WkhZwOyI0IhX+llfHf0HGhPlfoxOsfyO7bjGE4bPbANPi22LBLyjm0MOUCdnQv8IIpzqk4YZy9yPJB5IgLbdl9DBu8IGvokYUheNLkCTKoT6E+vgszlobf1+R6kTx8HpKqfPoShVb4uQF31w2cX/9bY/TjjLTRgOriEB3de1h3c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=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 1615306413804136.93975897949542; Tue, 9 Mar 2021 08:13:33 -0800 (PST) Received: from localhost ([::1]:44538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJezE-0000zf-L7 for importer@patchew.org; Tue, 09 Mar 2021 11:13:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJefG-0004Am-RL for qemu-devel@nongnu.org; Tue, 09 Mar 2021 10:52:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lJeey-00010B-4f for qemu-devel@nongnu.org; Tue, 09 Mar 2021 10:52:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-1JV74jIKOWaNPQtKTlIkvg-1; Tue, 09 Mar 2021 10:52:32 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2778D1018F64; Tue, 9 Mar 2021 15:52:31 +0000 (UTC) Received: from blue.redhat.com (ovpn-112-36.phx2.redhat.com [10.3.112.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E94A19714; Tue, 9 Mar 2021 15:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615305154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MgMhVCXkfRHZO1PG5U77+yHl+aw+vu6yfdM7Xctm6X0=; b=DlkeWnTDTZew/OIYoSp2rf3YpC0dRkz5/klLHoWbT3qyr+gF6B/7E5hh7kX90zoTgrfxny fXfJ1vtUMNK5ENq86yWr0p+se/IxryZ4M5hqohRc+poL3EDWouRITImoQjehm2DD4gYzLK kgHrYyihV8OewRkiGoITv8NlRCcvHZc= X-MC-Unique: 1JV74jIKOWaNPQtKTlIkvg-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PULL 13/17] block/qcow2-bitmap: return status from qcow2_store_persistent_dirty_bitmaps Date: Tue, 9 Mar 2021 09:51:58 -0600 Message-Id: <20210309155202.1312571-14-eblake@redhat.com> In-Reply-To: <20210309155202.1312571-1-eblake@redhat.com> References: <20210309155202.1312571-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eblake@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=eblake@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Cc: Kevin Wolf , Vladimir Sementsov-Ogievskiy , Alberto Garcia , "open list:Dirty Bitmaps" , Greg Kurz , Max Reitz , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy It's better to return status together with setting errp. It makes possible to avoid error propagation. While being here, put ERRP_GUARD() to fix error_prepend(errp, ...) usage inside qcow2_store_persistent_dirty_bitmaps() (see the comment above ERRP_GUARD() definition in include/qapi/error.h) Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Greg Kurz Reviewed-by: Alberto Garcia Message-Id: <20210202124956.63146-11-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake --- block/qcow2.h | 2 +- block/qcow2-bitmap.c | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index d19c8832062e..0fe5f74ed3ea 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -984,7 +984,7 @@ bool qcow2_get_bitmap_info_list(BlockDriverState *bs, Qcow2BitmapInfoList **info_list, Error **e= rrp); int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp); int qcow2_truncate_bitmaps_check(BlockDriverState *bs, Error **errp); -void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, +bool qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, bool release_stored, Error **err= p); int qcow2_reopen_bitmaps_ro(BlockDriverState *bs, Error **errp); bool qcow2_co_can_store_new_dirty_bitmap(BlockDriverState *bs, diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index 9452e9fe76c3..f417f9ccb195 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -1531,9 +1531,10 @@ out: * readonly to begin with, and whether we opened directly or reopened to t= hat * state shouldn't matter for the state we get afterward. */ -void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, +bool qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, bool release_stored, Error **err= p) { + ERRP_GUARD(); BdrvDirtyBitmap *bitmap; BDRVQcow2State *s =3D bs->opaque; uint32_t new_nb_bitmaps =3D s->nb_bitmaps; @@ -1553,7 +1554,7 @@ void qcow2_store_persistent_dirty_bitmaps(BlockDriver= State *bs, bm_list =3D bitmap_list_load(bs, s->bitmap_directory_offset, s->bitmap_directory_size, errp); if (bm_list =3D=3D NULL) { - return; + return false; } } @@ -1668,7 +1669,7 @@ success: } bitmap_list_free(bm_list); - return; + return true; fail: QSIMPLEQ_FOREACH(bm, bm_list, entry) { @@ -1686,16 +1687,14 @@ fail: } bitmap_list_free(bm_list); + return false; } int qcow2_reopen_bitmaps_ro(BlockDriverState *bs, Error **errp) { BdrvDirtyBitmap *bitmap; - Error *local_err =3D NULL; - qcow2_store_persistent_dirty_bitmaps(bs, false, &local_err); - if (local_err !=3D NULL) { - error_propagate(errp, local_err); + if (!qcow2_store_persistent_dirty_bitmaps(bs, false, errp)) { return -EINVAL; } --=20 2.30.1