nilfs2: convert __nilfs_msg to integrate the level and format
authorJoe Perches <joe@perches.com>
Wed, 12 Aug 2020 01:35:46 +0000 (18:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Aug 2020 17:58:01 +0000 (10:58 -0700)
Reduce object size a bit by removing the KERN_<LEVEL> as a separate
argument and adding it to the format string.

Reduce overall object size by about ~.5% (x86-64 defconfig w/ nilfs2)

old:
$ size -t fs/nilfs2/built-in.a | tail -1
 191738    8676      44  200458   30f0a (TOTALS)

new:
$ size -t fs/nilfs2/built-in.a | tail -1
 190971    8676      44  199691   30c0b (TOTALS)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/1595860111-3920-3-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/nilfs2/nilfs.h
fs/nilfs2/super.c

index 42395ba..979a410 100644 (file)
@@ -289,9 +289,8 @@ static inline int nilfs_mark_inode_dirty_sync(struct inode *inode)
 /* super.c */
 extern struct inode *nilfs_alloc_inode(struct super_block *);
 
-extern __printf(3, 4)
-void __nilfs_msg(struct super_block *sb, const char *level,
-                const char *fmt, ...);
+__printf(2, 3)
+void __nilfs_msg(struct super_block *sb, const char *fmt, ...);
 extern __printf(3, 4)
 void __nilfs_error(struct super_block *sb, const char *function,
                   const char *fmt, ...);
@@ -299,7 +298,7 @@ void __nilfs_error(struct super_block *sb, const char *function,
 #ifdef CONFIG_PRINTK
 
 #define nilfs_msg(sb, level, fmt, ...)                                 \
-       __nilfs_msg(sb, level, fmt, ##__VA_ARGS__)
+       __nilfs_msg(sb, level fmt, ##__VA_ARGS__)
 #define nilfs_error(sb, fmt, ...)                                      \
        __nilfs_error(sb, __func__, fmt, ##__VA_ARGS__)
 
@@ -307,7 +306,7 @@ void __nilfs_error(struct super_block *sb, const char *function,
 
 #define nilfs_msg(sb, level, fmt, ...)                                 \
        do {                                                            \
-               no_printk(fmt, ##__VA_ARGS__);                          \
+               no_printk(level fmt, ##__VA_ARGS__);                    \
                (void)(sb);                                             \
        } while (0)
 #define nilfs_error(sb, fmt, ...)                                      \
index 5729ee8..fef4821 100644 (file)
@@ -62,19 +62,25 @@ struct kmem_cache *nilfs_btree_path_cache;
 static int nilfs_setup_super(struct super_block *sb, int is_mount);
 static int nilfs_remount(struct super_block *sb, int *flags, char *data);
 
-void __nilfs_msg(struct super_block *sb, const char *level, const char *fmt,
-                ...)
+void __nilfs_msg(struct super_block *sb, const char *fmt, ...)
 {
        struct va_format vaf;
        va_list args;
+       int level;
 
        va_start(args, fmt);
-       vaf.fmt = fmt;
+
+       level = printk_get_level(fmt);
+       vaf.fmt = printk_skip_level(fmt);
        vaf.va = &args;
+
        if (sb)
-               printk("%sNILFS (%s): %pV\n", level, sb->s_id, &vaf);
+               printk("%c%cNILFS (%s): %pV\n",
+                      KERN_SOH_ASCII, level, sb->s_id, &vaf);
        else
-               printk("%sNILFS: %pV\n", level, &vaf);
+               printk("%c%cNILFS: %pV\n",
+                      KERN_SOH_ASCII, level, &vaf);
+
        va_end(args);
 }