Skip to content

Commit 23a2ad6

Browse files
JoePerchesjankara
authored andcommitted
fs/ext2/super.c: Use printf extension %pV
Using %pV reduces the number of printk calls and eliminates any possible message interleaving from other printk calls. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jan Kara <jack@suse.cz>
1 parent 31d710a commit 23a2ad6

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

‎fs/ext2/super.c‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data);
4343
static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf);
4444
static int ext2_sync_fs(struct super_block *sb, int wait);
4545

46-
void ext2_error (struct super_block * sb, const char * function,
47-
const char * fmt, ...)
46+
void ext2_error(struct super_block *sb, const char *function,
47+
const char *fmt, ...)
4848
{
49+
struct va_format vaf;
4950
va_list args;
5051
struct ext2_sb_info *sbi = EXT2_SB(sb);
5152
struct ext2_super_block *es = sbi->s_es;
@@ -59,9 +60,13 @@ void ext2_error (struct super_block * sb, const char * function,
5960
}
6061

6162
va_start(args, fmt);
62-
printk(KERN_CRIT "EXT2-fs (%s): error: %s: ", sb->s_id, function);
63-
vprintk(fmt, args);
64-
printk("\n");
63+
64+
vaf.fmt = fmt;
65+
vaf.va = &args;
66+
67+
printk(KERN_CRIT "EXT2-fs (%s): error: %s: %pV\n",
68+
sb->s_id, function, &vaf);
69+
6570
va_end(args);
6671

6772
if (test_opt(sb, ERRORS_PANIC))
@@ -76,12 +81,16 @@ void ext2_error (struct super_block * sb, const char * function,
7681
void ext2_msg(struct super_block *sb, const char *prefix,
7782
const char *fmt, ...)
7883
{
84+
struct va_format vaf;
7985
va_list args;
8086

8187
va_start(args, fmt);
82-
printk("%sEXT2-fs (%s): ", prefix, sb->s_id);
83-
vprintk(fmt, args);
84-
printk("\n");
88+
89+
vaf.fmt = fmt;
90+
vaf.va = &args;
91+
92+
printk("%sEXT2-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
93+
8594
va_end(args);
8695
}
8796

0 commit comments

Comments
 (0)