Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

exfat: Expand exfat_err() and co directly to pr_*() macro

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_*() macro to
expand to pr_*() directly. Along with it, add the new exfat_debug()
macro that is expanded to pr_debug() (which output can be gracefully
suppressed via dyndbg).

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>

authored by

Takashi Iwai and committed by
Namjae Jeon
6425baab 1b1a9195

+7 -22
+7 -5
fs/exfat/exfat_fs.h
··· 509 509 #define exfat_fs_error_ratelimit(sb, fmt, args...) \ 510 510 __exfat_fs_error(sb, __ratelimit(&EXFAT_SB(sb)->ratelimit), \ 511 511 fmt, ## args) 512 - void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...) 513 - __printf(3, 4) __cold; 512 + 513 + /* expand to pr_*() with prefix */ 514 514 #define exfat_err(sb, fmt, ...) \ 515 - exfat_msg(sb, KERN_ERR, fmt, ##__VA_ARGS__) 515 + pr_err("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) 516 516 #define exfat_warn(sb, fmt, ...) \ 517 - exfat_msg(sb, KERN_WARNING, fmt, ##__VA_ARGS__) 517 + pr_warn("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) 518 518 #define exfat_info(sb, fmt, ...) \ 519 - exfat_msg(sb, KERN_INFO, fmt, ##__VA_ARGS__) 519 + pr_info("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) 520 + #define exfat_debug(sb, fmt, ...) \ 521 + pr_debug("exFAT-fs (%s): " fmt "\n", (sb)->s_id, ##__VA_ARGS__) 520 522 521 523 void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, 522 524 u8 tz, __le16 time, __le16 date, u8 time_cs);
-17
fs/exfat/misc.c
··· 46 46 } 47 47 } 48 48 49 - /* 50 - * exfat_msg() - print preformated EXFAT specific messages. 51 - * All logs except what uses exfat_fs_error() should be written by exfat_msg() 52 - */ 53 - void exfat_msg(struct super_block *sb, const char *level, const char *fmt, ...) 54 - { 55 - struct va_format vaf; 56 - va_list args; 57 - 58 - va_start(args, fmt); 59 - vaf.fmt = fmt; 60 - vaf.va = &args; 61 - /* level means KERN_ pacility level */ 62 - printk("%sexFAT-fs (%s): %pV\n", level, sb->s_id, &vaf); 63 - va_end(args); 64 - } 65 - 66 49 #define SECS_PER_MIN (60) 67 50 #define TIMEZONE_SEC(x) ((x) * 15 * SECS_PER_MIN) 68 51