mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: linux-fsdevel@vger.kernel.org,
	Namjae Jeon <linkinjeon@kernel.org>,
	Sungjong Seo <sj1557.seo@samsung.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] exfat: Expand exfat_err() and co directly to pr_*() macro
Date: Sat, 23 Jul 2022 01:16:42 -0700	[thread overview]
Message-ID: <23290590dcf9f97187f59d655ce817a8aa658833.camel@perches.com> (raw)
In-Reply-To: <87edyc2r2e.wl-tiwai@suse.de>

On Sat, 2022-07-23 at 10:04 +0200, Takashi Iwai wrote:
> On Sat, 23 Jul 2022 09:42:12 +0200, Joe Perches wrote:
> > On Fri, 2022-07-22 at 16:29 +0200, Takashi Iwai wrote:
> > > Currently the error and info messages handled by exfat_err() and co
> > > are tossed to exfat_msg() function that does nothing but passes the
> > > strings with printk() invocation.  Not only that this is more overhead
> > > by the indirect calls, but also this makes harder to extend for the
> > > debug print usage; because of the direct printk() call, you cannot
> > > make it for dynamic debug or without debug like the standard helpers
> > > such as pr_debug() or dev_dbg().
> > > 
> > > For addressing the problem, this patch replaces exfat_msg() function
> > > with a macro to expand to pr_*() directly.  This allows us to create
> > > exfat_debug() macro that is expanded to pr_debug() (which output can
> > > gracefully suppressed via dyndbg).
> > []
> > > diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
> > []
> > > @@ -508,14 +508,19 @@ void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
> > >  #define exfat_fs_error_ratelimit(sb, fmt, args...) \
> > >  		__exfat_fs_error(sb, __ratelimit(&EXFAT_SB(sb)->ratelimit), \
> > >  		fmt, ## args)
> > > -void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...)
> > > -		__printf(3, 4) __cold;
> > > +
> > > +/* expand to pr_xxx() with prefix */
> > > +#define exfat_msg(sb, lv, fmt, ...) \
> > > +	pr_##lv("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
> > > +
> > >  #define exfat_err(sb, fmt, ...)						\
> > > -	exfat_msg(sb, KERN_ERR, fmt, ##__VA_ARGS__)
> > > +	exfat_msg(sb, err, fmt, ##__VA_ARGS__)
> > >  #define exfat_warn(sb, fmt, ...)					\
> > > -	exfat_msg(sb, KERN_WARNING, fmt, ##__VA_ARGS__)
> > > +	exfat_msg(sb, warn, fmt, ##__VA_ARGS__)
> > >  #define exfat_info(sb, fmt, ...)					\
> > > -	exfat_msg(sb, KERN_INFO, fmt, ##__VA_ARGS__)
> > > +	exfat_msg(sb, info, fmt, ##__VA_ARGS__)
> > > +#define exfat_debug(sb, fmt, ...)					\
> > > +	exfat_msg(sb, debug, fmt, ##__VA_ARGS__)
> > 
> > I think this would be clearer using pr_<level> directly instead
> > of an indirecting macro that uses concatenation of <level> that
> > obscures the actual use of pr_<level>
> > 
> > Either: (and this first option would be my preference)
> > 
> > #define exfat_err(sb, fmt, ...) \
> > 	pr_err("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
> > #define exfat_warn(sb, fmt, ...) \
> > 	pr_warn("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
> > etc...
> 
> IMO, it's a matter of taste, and I don't mind either way.
> Just let me know.
> 
> > or using an indirecting macro:
> > 
> > #define exfat_printk(pr_level, sb, fmt, ...)	\
> > 	pr_level("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__)
> 
> Is pr_level() defined anywhere...?

no

$ git grep -w pr_level
$ 


  reply	other threads:[~2022-07-23  8:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 14:29 [PATCH 0/4] exfat: Fixes for ENAMETOOLONG error handling Takashi Iwai
2022-07-22 14:29 ` [PATCH 1/4] exfat: Return ENAMETOOLONG consistently for oversized paths Takashi Iwai
2022-07-22 14:29 ` [PATCH 2/4] exfat: Define NLS_NAME_* as bit flags explicitly Takashi Iwai
2022-07-22 14:29 ` [PATCH 3/4] exfat: Expand exfat_err() and co directly to pr_*() macro Takashi Iwai
2022-07-23  7:42   ` Joe Perches
2022-07-23  8:04     ` Takashi Iwai
2022-07-23  8:16       ` Joe Perches [this message]
2022-07-26  7:02       ` Namjae Jeon
2022-07-26  7:46         ` Takashi Iwai
2022-07-26  7:54           ` Namjae Jeon
2022-07-23  9:04   ` Petr Vorel
2022-07-22 14:29 ` [PATCH 4/4] exfat: Downgrade ENAMETOOLONG error message to debug messages Takashi Iwai

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=23290590dcf9f97187f59d655ce817a8aa658833.camel@perches.com \
    --to=joe@perches.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=tiwai@suse.de \
    /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

all inboxes | Powered by JetHome®