From patchwork Mon May 16 11:15:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1631496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=chBE8txH; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4L1xWD0Qnnz9s5V for ; Mon, 16 May 2022 21:15:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C7FD66104C; Mon, 16 May 2022 11:15:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0_gzYgFL6YFK; Mon, 16 May 2022 11:15:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 1465F60AB7; Mon, 16 May 2022 11:15:32 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E22EEC0039; Mon, 16 May 2022 11:15:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id DCF42C002D for ; Mon, 16 May 2022 11:15:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id D0CA94014D for ; Mon, 16 May 2022 11:15:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FWe0nhI4T1nq for ; Mon, 16 May 2022 11:15:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 26D55400AB for ; Mon, 16 May 2022 11:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652699728; 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=S2yW4IbVvPCPFAT8ircwS7+HHTpJmc6E05dQNEfRrU0=; b=chBE8txHLxuxFFDLQ7jVj6AOkIh0zDOTQAo85Z7uG3V/kO0cduYMamxVagVSIt7rpuathr oNV2SObXpqn+hyozV11k6zBthzfz6iTKy4ixQx6+ZqFo7B4L/zMu8DKzBo9oJllkI0SQJC 96VJwEGS59+E2DRcxj2OCXysQDsqlX8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-70-f2Nsxg0DM0qk6fdDJYIKIw-1; Mon, 16 May 2022 07:15:27 -0400 X-MC-Unique: f2Nsxg0DM0qk6fdDJYIKIw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E52E101AA42 for ; Mon, 16 May 2022 11:15:27 +0000 (UTC) Received: from dceara.remote.csb (unknown [10.39.192.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9FF140CF8E2 for ; Mon, 16 May 2022 11:15:26 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Mon, 16 May 2022 13:15:24 +0200 Message-Id: <20220516111524.27240-1-dceara@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] raft: Don't use HMAP_FOR_EACH_SAFE when logging commands. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" There's no need to do that because we're not changing the hmap. Also, if DEBUG logging is disabled there's no need to iterate at all. Fixes: 5a9b53a51ec9 ("ovsdb raft: Fix duplicated transaction execution when leader failover.") Signed-off-by: Dumitru Ceara --- ovsdb/raft.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ovsdb/raft.c b/ovsdb/raft.c index 530c5e5a3d82..c0e6687b484e 100644 --- a/ovsdb/raft.c +++ b/ovsdb/raft.c @@ -2266,8 +2266,12 @@ raft_command_initiate(struct raft *raft, static void log_all_commands(struct raft *raft) { + if (!VLOG_IS_DBG_ENABLED()) { + return; + } + struct raft_command *cmd; - HMAP_FOR_EACH_SAFE (cmd, hmap_node, &raft->commands) { + HMAP_FOR_EACH (cmd, hmap_node, &raft->commands) { VLOG_DBG("raft command eid: "UUID_FMT, UUID_ARGS(&cmd->eid)); } }