linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>, Boris Burkov <boris@bur.io>,
	dsterba@suse.cz, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH v2 2/4] btrfs: make __btrfs_dump_space_info() output better formatted
Date: Wed, 27 Jul 2022 11:09:09 -0400	[thread overview]
Message-ID: <05e134a8-c26e-0cd4-29b4-a9fdfdcef2b3@dorminy.me> (raw)
In-Reply-To: <59e228e2-9927-56a1-5fac-ab6b7e49451e@gmx.com>



On 7/26/22 21:44, Qu Wenruo wrote:
> 
> 
> On 2022/7/27 09:21, Sweet Tea Dorminy wrote:
>>
>>
>> On 7/26/22 19:21, Boris Burkov wrote:
>>> On Tue, Jul 26, 2022 at 11:39:28PM +0200, David Sterba wrote:
>>>> On Tue, Jul 26, 2022 at 01:53:33PM -0700, Boris Burkov wrote:
>>>>>> Yes we shold care about readability but kernel printk output lines 
>>>>>> can
>>>>>> be interleaved, single line is much easier to grep for and all the
>>>>>> values are from one event. The format where it's a series of
>>>>>> "key=value"
>>>>>> is common and I think we're used to it from tracepoints too. There 
>>>>>> are
>>>>>> lines that do not put "=" between keys and values we could unify that
>>>>>> eventually.
>>>>>
>>>>> Agreed that a long line is OK, and preferable to full on splitting.
>>>>>
>>>>> What about making some btrfs printing macros that use KERN_CONT? I
>>>>> think
>>>>> that would do what Qu wants without splitting the lines or being bad
>>>>> for
>>>>> ratelimiting.
>>>>
>>>> IIRC I've read some discussions about KERN_CONT suggesting not to use
>>>> it, I'll ask what's the status.
>>>
>>> I just saw a comment at its definition that reads:
>>>
>>> /*
>>>   * Annotation for a "continued" line of log printout (only done after a
>>>   * line that had no enclosing \n). Only to be used by core/arch code
>>>   * during early bootup (a continued line is not SMP-safe otherwise).
>>>   */
>>> #define KERN_CONT       KERN_SOH "c"
>>>
>>> So that's not an encouraging sign. OTOH, I found some code in
>>> ext4/super.c that prints its errors with KERN_CONT here:
>>> 'ext4: super.c: Update logging style using KERN_CONT
>>
>> Some other log message from somewhere else could be emitted to the
>> printk ringbuffer between the original and the continued message. In
>> such a case, the continued message instead gets treated as its own
>> message of loglevel default. (kernel/printk/printk.c:2173ish) Using
>> KERN_CONT seems like it has a lot of potential for confusion, especially
>> if the default message level has been changed to be different from the
>> original messages' level.
> 
> Thanks for all the discussion, it looks like the current long single
> line is the way to go (in fact, the space info dumping itself is still
> two lines, and we may want to fix it).
> 
> Although it's not that human readable, the racy nature of message output
> is indeed a concern.
> This also means the old DUMP_BLOCK_RSV() function calls are not safe 
> either.
> 
> 
> But on the other hand, what if we output one line with multiple '\n'?
> Would it keep things readable while still count as one single line?

Yes, it would count as only one message, but it would break scripts that 
assume dmesg etc outputs a timestamp for every line; I think many kernel 
log scrapers make that assumption.

sample dmesg -T

[Wed Jul 27 10:59:54 2022] test three
                            line message

[Wed Jul 27 11:03:50 2022] next message.

sample journalctl:

Jul 27 10:59:54 vmcentral unknown: test three
                            line message
Jul 27 11:03:50 vmcentral unknown: next message.

  reply	other threads:[~2022-07-27 15:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19  5:11 [PATCH v2 0/4] btrfs: output more info for -ENOSPC caused transaction abort and other enhancement Qu Wenruo
2022-07-19  5:11 ` [PATCH v2 1/4] btrfs: output human readable space info flag Qu Wenruo
2022-07-19 20:38   ` Sweet Tea Dorminy
2022-07-19  5:11 ` [PATCH v2 2/4] btrfs: make __btrfs_dump_space_info() output better formatted Qu Wenruo
2022-07-19 20:56   ` Sweet Tea Dorminy
2022-07-19 21:38     ` David Sterba
2022-07-19 22:58       ` Qu Wenruo
2022-07-26 18:13         ` David Sterba
2022-07-26 20:53           ` Boris Burkov
2022-07-26 21:39             ` David Sterba
2022-07-26 23:21               ` Boris Burkov
2022-07-27  1:21                 ` Sweet Tea Dorminy
2022-07-27  1:44                   ` Qu Wenruo
2022-07-27 15:09                     ` Sweet Tea Dorminy [this message]
2022-07-19  5:11 ` [PATCH v2 3/4] btrfs: make DUMP_BLOCK_RSV() to have better output Qu Wenruo
2022-07-19  5:11 ` [PATCH v2 4/4] btrfs: dump all space infos if we abort transaction due to ENOSPC Qu Wenruo
2022-07-20  0:42   ` Sweet Tea Dorminy
2022-07-20  1:03     ` Qu Wenruo
2022-07-20  1:43       ` Sweet Tea Dorminy
2022-07-20  1:57         ` Qu Wenruo
2022-07-26 18:20       ` David Sterba
2022-07-26 18:38         ` Sweet Tea Dorminy
2022-08-24 15:53 ` [PATCH v2 0/4] btrfs: output more info for -ENOSPC caused transaction abort and other enhancement David Sterba
2022-08-25  3:04   ` Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=05e134a8-c26e-0cd4-29b4-a9fdfdcef2b3@dorminy.me \
    --to=sweettea-kernel@dorminy.me \
    --cc=boris@bur.io \
    --cc=dsterba@suse.cz \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).