Re: [RFC PATCH v3 13/61] e2fsck: print thread log properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 18, 2020 at 07:38:59AM -0800, Saranya Muruganandam wrote:
> From: Li Xi <lixi@xxxxxxx>
> 
> 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



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux