Commit 0ff2ea7d authored by Joe Perches's avatar Joe Perches Committed by Theodore Ts'o

ext4: Use printf extension %pV

Using %pV reduces the number of printk calls and eliminates any
possible message interleaving from other printk calls.

In function __ext4_grp_locked_error also added KERN_CONT to some
printks.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 94de56ab
...@@ -388,13 +388,14 @@ static void ext4_handle_error(struct super_block *sb) ...@@ -388,13 +388,14 @@ static void ext4_handle_error(struct super_block *sb)
void __ext4_error(struct super_block *sb, const char *function, void __ext4_error(struct super_block *sb, const char *function,
unsigned int line, const char *fmt, ...) unsigned int line, const char *fmt, ...)
{ {
struct va_format vaf;
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %s: ", vaf.fmt = fmt;
sb->s_id, function, line, current->comm); vaf.va = &args;
vprintk(fmt, args); printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n",
printk("\n"); sb->s_id, function, line, current->comm, &vaf);
va_end(args); va_end(args);
ext4_handle_error(sb); ext4_handle_error(sb);
...@@ -543,28 +544,29 @@ void __ext4_abort(struct super_block *sb, const char *function, ...@@ -543,28 +544,29 @@ void __ext4_abort(struct super_block *sb, const char *function,
panic("EXT4-fs panic from previous error\n"); panic("EXT4-fs panic from previous error\n");
} }
void ext4_msg (struct super_block * sb, const char *prefix, void ext4_msg(struct super_block *sb, const char *prefix, const char *fmt, ...)
const char *fmt, ...)
{ {
struct va_format vaf;
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
printk("%sEXT4-fs (%s): ", prefix, sb->s_id); vaf.fmt = fmt;
vprintk(fmt, args); vaf.va = &args;
printk("\n"); printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
va_end(args); va_end(args);
} }
void __ext4_warning(struct super_block *sb, const char *function, void __ext4_warning(struct super_block *sb, const char *function,
unsigned int line, const char *fmt, ...) unsigned int line, const char *fmt, ...)
{ {
struct va_format vaf;
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
printk(KERN_WARNING "EXT4-fs warning (device %s): %s:%d: ", vaf.fmt = fmt;
sb->s_id, function, line); vaf.va = &args;
vprintk(fmt, args); printk(KERN_WARNING "EXT4-fs warning (device %s): %s:%d: %pV\n",
printk("\n"); sb->s_id, function, line, &vaf);
va_end(args); va_end(args);
} }
...@@ -575,21 +577,25 @@ void __ext4_grp_locked_error(const char *function, unsigned int line, ...@@ -575,21 +577,25 @@ void __ext4_grp_locked_error(const char *function, unsigned int line,
__releases(bitlock) __releases(bitlock)
__acquires(bitlock) __acquires(bitlock)
{ {
struct va_format vaf;
va_list args; va_list args;
struct ext4_super_block *es = EXT4_SB(sb)->s_es; struct ext4_super_block *es = EXT4_SB(sb)->s_es;
es->s_last_error_ino = cpu_to_le32(ino); es->s_last_error_ino = cpu_to_le32(ino);
es->s_last_error_block = cpu_to_le64(block); es->s_last_error_block = cpu_to_le64(block);
__save_error_info(sb, function, line); __save_error_info(sb, function, line);
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: group %u", printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: group %u",
sb->s_id, function, line, grp); sb->s_id, function, line, grp);
if (ino) if (ino)
printk("inode %lu: ", ino); printk(KERN_CONT "inode %lu: ", ino);
if (block) if (block)
printk("block %llu:", (unsigned long long) block); printk(KERN_CONT "block %llu:", (unsigned long long) block);
vprintk(fmt, args); printk(KERN_CONT "%pV\n", &vaf);
printk("\n");
va_end(args); va_end(args);
if (test_opt(sb, ERRORS_CONT)) { if (test_opt(sb, ERRORS_CONT)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment