From: brookxu <brookxu.cn@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.com,
harshadshirwadkar@gmail.com, linux-ext4@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/4] jbd2: introduce some new log interfaces
Date: Mon, 25 Jan 2021 23:53:42 +0800 [thread overview]
Message-ID: <81586eb0-921c-9fd2-96ef-2fa249ef3b85@gmail.com> (raw)
In-Reply-To: <20210125145448.GG1175@quack2.suse.cz>
Jan Kara wrote on 2021/1/25 22:54:
> On Sat 23-01-21 20:00:44, Chunguang Xu wrote:
>> From: Chunguang Xu <brookxu@tencent.com>
>>
>> Compared to directly using numbers to indicate levels, using abstract
>> error, warn, notice, info, debug to indicate levels may be more
>> convenient for code reading and writing. Similar to other kernel
>> modules, some basic log interfaces are introduced.
>>
>> Signed-off-by: Chunguang Xu <brookxu@tencent.com>
>
> One more thing I've noticed when reading this patch:
>
>> +
>> +#ifdef CONFIG_JBD2_DEBUG
>> +/*
>> + * Define JBD2_EXPENSIVE_CHECKING to enable more expensive internal
>> + * consistency checks. By default we don't do this unless
>> + * CONFIG_JBD2_DEBUG is on.
>> + */
>> +#define JBD2_EXPENSIVE_CHECKING
>> +extern ushort jbd2_journal_enable_debug;
>> +void jbd2_log(int level, journal_t *j, const char *file, const char *func,
>> + unsigned int line, const char *fmt, ...);
>> +
>> +#define JBD2_ERR 1 /* error conditions */
>> +#define JBD2_WARN 2 /* warning conditions */
>> +#define JBD2_NOTICE 3 /* normal but significant condition */
>> +#define JBD2_INFO 4 /* informational */
>> +#define JBD2_DEBUG 5 /* debug-level messages */
>
> This is actually not true. All the jbd_debug() messages are really debug
> messages, not errors, not warnings. It is just a different level of detail.
> Honestly, these days, I'd rather discard all the levels, use pr_debug()
> function to print these messages inside jdb2_debug() and defer to
> CONFIG_DYNAMIC_DEBUG framework for configuration of which messages are
> interesting for a particular debug session.
From a certain point, this is indeed, maybe the changes here are not necessary.
Thanks.
> Honza
>
>> +
>> +#define jbd2_err(j, fmt, a...) \
>> + jbd2_log(JBD2_ERR, j, __FILE__, __func__, __LINE__, (fmt), ##a)
>> +
>> +#define jbd2_warn(j, fmt, a...) \
>> + jbd2_log(JBD2_WARN, j, __FILE__, __func__, __LINE__, (fmt), ##a)
>> +
>> +#define jbd2_notice(j, fmt, a...) \
>> + jbd2_log(JBD2_NOTICE, j, __FILE__, __func__, __LINE__, (fmt), ##a)
>> +
>> +#define jbd2_info(j, fmt, a...) \
>> + jbd2_log(JBD2_INFO, j, __FILE__, __func__, __LINE__, (fmt), ##a)
>> +
>> +#define jbd2_debug(j, fmt, a...) \
>> + jbd2_log(JBD2_DEBUG, j, __FILE__, __func__, __LINE__, (fmt), ##a)
>> +
>> +#else
>> +
>> +#define jbd2_err(j, fmt, a...)
>> +#define jbd2_warn(j, fmt, a...)
>> +#define jbd2_notice(j, fmt, a...)
>> +#define jbd2_info(j, fmt, a...)
>> +#define jbd2_debug(j, fmt, a...)
>> +
>> +#endif
>> #endif
>>
>> /*
>> --
>> 2.30.0
>>
next prev parent reply other threads:[~2021-01-26 2:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 12:00 [RFC PATCH v2 0/4] make jbd2 debug switch per device Chunguang Xu
2021-01-23 12:00 ` [RFC PATCH v2 1/4] jbd2: make jdb2_debug module parameter " Chunguang Xu
2021-01-25 17:15 ` harshad shirwadkar
2021-01-26 0:21 ` brookxu
2021-01-23 12:00 ` [RFC PATCH v2 2/4] jbd2: introduce some new log interfaces Chunguang Xu
2021-01-25 14:54 ` Jan Kara
2021-01-25 15:53 ` brookxu [this message]
2021-01-23 12:00 ` [RFC PATCH v2 3/4] jbd2: replace jbd_debug with the new log interface Chunguang Xu
2021-01-23 12:00 ` [RFC PATCH v2 4/4] ext4: " Chunguang Xu
2021-01-25 21:50 ` [RFC PATCH v2 0/4] make jbd2 debug switch per device Theodore Ts'o
2021-01-26 0:50 ` brookxu
2021-01-27 16:21 ` Theodore Ts'o
2021-01-28 11:39 ` brookxu
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=81586eb0-921c-9fd2-96ef-2fa249ef3b85@gmail.com \
--to=brookxu.cn@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=harshadshirwadkar@gmail.com \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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).