[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201123234021.GK132317@mit.edu>
Date: Mon, 23 Nov 2020 18:40:21 -0500
From: "Theodore Y. Ts'o" <tytso@....edu>
To: Saranya Muruganandam <saranyamohan@...gle.com>
Cc: linux-ext4@...r.kernel.org, adilger.kernel@...ger.ca,
Li Xi <lixi@....com>, Wang Shilong <wshilong@....com>
Subject: Re: [RFC PATCH v3 13/61] e2fsck: print thread log properly
On Wed, Nov 18, 2020 at 07:38:59AM -0800, Saranya Muruganandam wrote:
> From: Li Xi <lixi@....com>
>
> 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
Powered by blists - more mailing lists