From nobody Thu Jan 2 21:16:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1728886723752547.7481728204945; Sun, 13 Oct 2024 23:18:43 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5AA3917E5; Mon, 14 Oct 2024 02:18:42 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id DD027175A; Mon, 14 Oct 2024 02:18:23 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E76CB1560; Mon, 14 Oct 2024 02:18:20 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 739E21733 for ; Mon, 14 Oct 2024 02:18:20 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-nNegHpgwOFiTv8wH9wr-Ug-1; Mon, 14 Oct 2024 02:18:18 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AD9161955EE9 for ; Mon, 14 Oct 2024 06:18:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.4]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CD3E73000198 for ; Mon, 14 Oct 2024 06:18:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728886700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gh0pVjHmpl8abg4ImJhUvErCdJBRcH8MErylnjDiPJM=; b=ChPHJe0xWx4oHBI20/703AlpFoZeOLttczxZQ98lE/orMQgA8SX0SJMdOnE9fuv5ZMqasR Qg4fbW4+q2lX1faIZs7P9dzxQnPuhgI9JYgaMu1BdkzszWR2tsyT7vHj2LOrgun7C/oNFg MIELViuPF3KzaHIf35HQ9G5sryijVVA= X-MC-Unique: nNegHpgwOFiTv8wH9wr-Ug-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH] qemu: snapshot: Remove dead code in 'qemuSnapshotDeleteBlockJobRunning' Date: Mon, 14 Oct 2024 08:18:15 +0200 Message-ID: <2d0df78723fa70fb49d9ed0ae7d1c3b539533c5f.1728886695.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: O2L7OSLRWWNBRSDKCYX2MM55IACVTZ45 X-Message-ID-Hash: O2L7OSLRWWNBRSDKCYX2MM55IACVTZ45 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1728886724181116600 Content-Type: text/plain; charset="utf-8" 'qemuSnapshotDeleteBlockJobIsRunning' returns only 0 and 1. Convert it to bool and remove the dead code handling -1 return in the caller. Closes: https://gitlab.com/libvirt/libvirt/-/issues/682 Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 77ff842fab..1187ebf276 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3303,7 +3303,7 @@ qemuSnapshotDeleteUpdateDisks(void *payload, /* Deleting external snapshot is started by running qemu block-commit job. * We need to wait for all block-commit jobs to be 'ready' or 'pending' to * continue with external snapshot deletion. */ -static int +static bool qemuSnapshotDeleteBlockJobIsRunning(qemuBlockjobState state) { switch (state) { @@ -3311,7 +3311,7 @@ qemuSnapshotDeleteBlockJobIsRunning(qemuBlockjobState= state) case QEMU_BLOCKJOB_STATE_RUNNING: case QEMU_BLOCKJOB_STATE_ABORTING: case QEMU_BLOCKJOB_STATE_PIVOTING: - return 1; + return true; case QEMU_BLOCKJOB_STATE_COMPLETED: case QEMU_BLOCKJOB_STATE_FAILED: @@ -3323,7 +3323,7 @@ qemuSnapshotDeleteBlockJobIsRunning(qemuBlockjobState= state) break; } - return 0; + return false; } @@ -3359,18 +3359,14 @@ static int qemuSnapshotDeleteBlockJobRunning(virDomainObj *vm, qemuBlockJobData *job) { - int rc; qemuBlockJobUpdate(vm, job, VIR_ASYNC_JOB_SNAPSHOT); - while ((rc =3D qemuSnapshotDeleteBlockJobIsRunning(job->state)) > 0) { + while (qemuSnapshotDeleteBlockJobIsRunning(job->state)) { if (qemuDomainObjWait(vm) < 0) return -1; qemuBlockJobUpdate(vm, job, VIR_ASYNC_JOB_SNAPSHOT); } - if (rc < 0) - return -1; - return 0; } --=20 2.46.2