Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1273175pxu; Mon, 23 Nov 2020 16:42:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyk5G9+fcPWFh17pECgKWM2lBz90H1zVyrHHsqbNaSJZUXT4165vHfch3KX5MkDtA2G00Q1 X-Received: by 2002:a05:6402:559:: with SMTP id i25mr1808497edx.128.1606178530147; Mon, 23 Nov 2020 16:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606178530; cv=none; d=google.com; s=arc-20160816; b=kthH+xDMSQELmp4MAk7sgSj6XigWyrCC9rutnhVQVVYX9MQSbocLb6DwmIh97OfQly 2wcbq7xUXfvoBNbTjTYe3yPghjh8qRhpHyS+a8TeS5v001XDG66QeO7jRPpayK0S6xMF 5FQkdBVVRnCxTBteMSYnLRfGHkWNgt1a7AU/YasDCJGJuay4hDfPtWbAUTXH96ePaM3F diggabq2omuIYtRhq18LcVZYl9QkhyO5/pPIpF5FYSC4mGhTF03ZmbLleXr0ohLKv+LA /vBaAj/LAlQ74HpqMPmYYOHKpQElKYIQUwvxcv2j/I2CkOUkxYi9RUiI8kl/nXQEoo+y bTEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=uStjxCTqPhJG6++HQdlWvuzBFFcPZe1BQSgiAcm0luo=; b=rnzzL8Xhbgrkq8NzehHGU+4eeCsBQgydUoshS7YPJIyr2TeESgkC+o1aM+lVL6rZGX W35Loz25NNBWOfkXUbDhiC+fW8dkLcAinKQ/0EqRwYKAADqHgPDEU2NgRcr1fTIMFnKf Fu7pmyVqJr0AWWkn6bV/JvQ9wQiohOWAF/xg34M/iSKKP34IggV98GqRLuHPNTYgJJgQ uCE01uwzKbU1gfKgDYB+iXOdFqOpbS3mhSS3FuhIN6BIkBZcDp3zJdYDYqZc8Rej+M/c KXrPV8JCQmuzv+wnJ1eIf3/rO72ch0Uxh+PmQ55QyA2/EO/U8OvgP27Nc9Y7VBBp2VJZ 6ilQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rk8si7633402ejb.654.2020.11.23.16.41.47; Mon, 23 Nov 2020 16:42:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727762AbgKWXkb (ORCPT + 99 others); Mon, 23 Nov 2020 18:40:31 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:46666 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727757AbgKWXka (ORCPT ); Mon, 23 Nov 2020 18:40:30 -0500 Received: from callcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 0ANNeMCm021450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Nov 2020 18:40:22 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id E8BBF420136; Mon, 23 Nov 2020 18:40:21 -0500 (EST) Date: Mon, 23 Nov 2020 18:40:21 -0500 From: "Theodore Y. Ts'o" To: Saranya Muruganandam Cc: linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca, Li Xi , Wang Shilong Subject: Re: [RFC PATCH v3 13/61] e2fsck: print thread log properly Message-ID: <20201123234021.GK132317@mit.edu> References: <20201118153947.3394530-1-saranyamohan@google.com> <20201118153947.3394530-14-saranyamohan@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201118153947.3394530-14-saranyamohan@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Nov 18, 2020 at 07:38:59AM -0800, Saranya Muruganandam wrote: > From: Li Xi > > When multi-thread fsck is enabled, logs printed from multiple > threads could overlap with each other. The overlap sometimes > makes the logs unreadable because log_out() is used multiple times > for a single line. > > This patch adds leading [Thread XXX] to each logs if multi-thread > is enabed by -m option. Given that the leading "[Thread XXX]" is output using a separate printf, this is still going to result in potential overlapped messages: > +#ifdef CONFIG_PFSCK > +static void thread_log_out(struct e2fsck_thread *tinfo) > +{ > + printf("[Thread %d] %s", tinfo->et_thread_index, > + tinfo->et_log_buf); > + tinfo->et_log_length = 0; > + tinfo->et_log_buf[0] = '\0'; > +} > +#endif Instead of using a separate 2k buffer for each thread, why not just have a mutex so only one thread can be printing to the terminal and/or log files at one time? - Ted