Message ID | 20220326132534.543738-45-richard.henderson@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp6440266mag; Sat, 26 Mar 2022 06:54:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCc8RkBZCRyUgFkAp4qYBTmEOg5hVXcxWGwZUZQ5PstK2i0XhDajFy2MWoYCmY3VnC6xZj X-Received: by 2002:a05:620a:278d:b0:680:b3f0:3965 with SMTP id g13-20020a05620a278d00b00680b3f03965mr5331509qkp.713.1648302857669; Sat, 26 Mar 2022 06:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648302857; cv=none; d=google.com; s=arc-20160816; b=nSBFrGDTxxkBZphrqhHyxY2HzGu1D56czffZPVdXYhPNfkoqY4jPU6t3etpKyMbvaL AzWuzkgv2JnFKx2snBBGeGtN+fGwqB0KbDFzT87E8OE9qvBR7ROB9tZ3MPXKn20MewMm sWM4FhaMJuYoXBdABlfOsw8Lyxcc4YjQejRPA9uh7ggMHYxRU+LG8kLeRv15vK9BUkIg cXNgD4DCgup6UsNN2dk4QKEZE1oUROkcTcH0wxeS5PnakZdHfXtCJEAWq8035OhfPB1r sML7cmC+WwuWsrf2+kYQT2/2L4sYazytqwWYP83SfNdhslYt11iCuIWeghcm3oimsAG6 JQJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=go+GYnXGkWPQcv2j/hc2xPgBqJ1JmT544mDHf3z2u08=; b=V/xxIolGHSNwU0vI1owj48OZr1d3HV7ShShfOdIY/kVrpMDN/WB7JUVSrCBfp3ufmK D7TJ8Sp/qmEL0975KzA0DVZMa4P/XCSECdbNt4mMZ9ZMfOp9ZUSlU8ILfle+T/yJ1M5E x2jhDG9mXU+YN2YSkII3kqjm+PDd2b4rUr6gufn7b6bZK5kQ5jvInbB5X/PLAScsAvbJ 7Xs790sEXygQuHhjEcx1HIs689RA+nrwycqDT/8Q1QO2XIGoTLmC3azsj3CE49FI1CIf SDoKvTqrsRdHITlI0QcgRtWLjr2WbBSmZb6nqC/tLDJ+zfAfhHeDg9Hi8AcbVTL+zdb8 8irg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CCv+fh7Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x13-20020a0cda0d000000b00440e46a7cbbsi2994406qvj.345.2022.03.26.06.54.17 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 26 Mar 2022 06:54:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CCv+fh7Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1nY6rx-0001SX-6b for patch@linaro.org; Sat, 26 Mar 2022 09:54:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1nY6UE-0002wP-7R for qemu-devel@nongnu.org; Sat, 26 Mar 2022 09:29:46 -0400 Received: from [2607:f8b0:4864:20::232] (port=46670 helo=mail-oi1-x232.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1nY6UC-0005z6-RL for qemu-devel@nongnu.org; Sat, 26 Mar 2022 09:29:45 -0400 Received: by mail-oi1-x232.google.com with SMTP id b188so11067759oia.13 for <qemu-devel@nongnu.org>; Sat, 26 Mar 2022 06:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=go+GYnXGkWPQcv2j/hc2xPgBqJ1JmT544mDHf3z2u08=; b=CCv+fh7ZkpClVw+E0S4VVEZMtdFZr3mW+CJPCh2g7x3iI3TrxX46577jrrNa5W1qEp QVhZt1i07+mC4iCBRO9Wg27AFmel5m32WfR6Rf8jnQy/blT0bOgU9hfkhS8KxmP2pnr3 G8VhwPFrtCHAvWwQ3nirKhe3GLd3Epi0tAC+eUBX6vpSiYK5JU3yCYz8r5cKxD3/B1b9 Ky8mJ0qmwUdA2hOk2Ty/SsfscCoZQB48//8/BCAAyXv+gdapB8rlqYM+HZfR5N15M6US SmmC/HTkkQup3Hbux0E5vxrZu0W1oC/tuAJpe9DR4Y1x4557Bx/iLcnj3L0by+Ow0Ff0 MdeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=go+GYnXGkWPQcv2j/hc2xPgBqJ1JmT544mDHf3z2u08=; b=yfX8rYkFLH6Jwogh2lOf7McKsYToXWFR75/zcREkriD5ykHFpChPCBu/QWiADvg3qc +hkkSvPLKGiliatfsxy/Kkk7EXdx4fRDt5spfxPcXll1GCufp+QvrsoQ8UCMauXSf+dx vTBm5/Yj/M/gXmaw3PjUNNpc9cjiaxAfeYNlN1nanZZrSOjRABg4zXZqwmH5IoooOsQN lGuIKo3t0c4eDS112SetscgccWt4OetLVqA47Ub9VL6XwtbkOoMRzo9fsuFAT2pubYJR 5KLxZyfGWKBUH+E6LSj1+gQBa+rI5i2v+HlABfjv3gM99KNQfN4vcXmiCBNDHGlt1+sX exmw== X-Gm-Message-State: AOAM5338BDzayLJzjrnFI2oTjb/EMADfpQb6QZZwVfQMk8OCggs9Dj1r nbUMpe5Su4xc27ouOV0zImWSRaM6cVAHcrp2 X-Received: by 2002:a05:6808:11cd:b0:2d9:a01a:4bc6 with SMTP id p13-20020a05680811cd00b002d9a01a4bc6mr8176506oiv.237.1648301383855; Sat, 26 Mar 2022 06:29:43 -0700 (PDT) Received: from localhost.localdomain (168.189-204-159.bestelclientes.com.mx. [189.204.159.168]) by smtp.gmail.com with ESMTPSA id s24-20020a056808209800b002da3b9bf8e0sm4394509oiw.32.2022.03.26.06.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Mar 2022 06:29:43 -0700 (PDT) From: Richard Henderson <richard.henderson@linaro.org> To: qemu-devel@nongnu.org Subject: [PATCH v2 36/39] util/log: Combine two logfile closes Date: Sat, 26 Mar 2022 07:25:31 -0600 Message-Id: <20220326132534.543738-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220326132534.543738-1-richard.henderson@linaro.org> References: <20220326132534.543738-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::232 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x232.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
Logging cleanup and per-thread logfiles
|
expand
|
Richard Henderson <richard.henderson@linaro.org> writes: > Merge the close from the changed_name block with the close > from the !need_to_open_file block. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/util/log.c b/util/log.c index 631856e231..21da961d8d 100644 --- a/util/log.c +++ b/util/log.c @@ -157,12 +157,6 @@ static bool qemu_set_log_internal(const char *filename, bool changed_name, g_free(global_filename); global_filename = newname; filename = newname; - - if (logfile) { - qatomic_rcu_set(&global_file, NULL); - call_rcu(logfile, qemu_logfile_free, rcu); - logfile = NULL; - } } else { filename = global_filename; } @@ -182,11 +176,12 @@ static bool qemu_set_log_internal(const char *filename, bool changed_name, daemonized = is_daemonized(); need_to_open_file = log_flags && (!daemonized || filename); - if (logfile && !need_to_open_file) { + if (logfile && (!need_to_open_file || changed_name)) { qatomic_rcu_set(&global_file, NULL); call_rcu(logfile, qemu_logfile_free, rcu); - return true; + logfile = NULL; } + if (!logfile && need_to_open_file) { FILE *fd;
Merge the close from the changed_name block with the close from the !need_to_open_file block. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- util/log.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)