Skip to content

Commit 99fbb1e

Browse files
JoePerchesjankara
authored andcommitted
fs/ext3/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 23a2ad6 commit 99fbb1e

1 file changed

Lines changed: 37 additions & 19 deletions

File tree

‎fs/ext3/super.c‎

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,16 @@ void ext3_journal_abort_handle(const char *caller, const char *err_fn,
143143
void ext3_msg(struct super_block *sb, const char *prefix,
144144
const char *fmt, ...)
145145
{
146+
struct va_format vaf;
146147
va_list args;
147148

148149
va_start(args, fmt);
149-
printk("%sEXT3-fs (%s): ", prefix, sb->s_id);
150-
vprintk(fmt, args);
151-
printk("\n");
150+
151+
vaf.fmt = fmt;
152+
vaf.va = &args;
153+
154+
printk("%sEXT3-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
155+
152156
va_end(args);
153157
}
154158

@@ -195,15 +199,20 @@ static void ext3_handle_error(struct super_block *sb)
195199
sb->s_id);
196200
}
197201

198-
void ext3_error (struct super_block * sb, const char * function,
199-
const char * fmt, ...)
202+
void ext3_error(struct super_block *sb, const char *function,
203+
const char *fmt, ...)
200204
{
205+
struct va_format vaf;
201206
va_list args;
202207

203208
va_start(args, fmt);
204-
printk(KERN_CRIT "EXT3-fs error (device %s): %s: ",sb->s_id, function);
205-
vprintk(fmt, args);
206-
printk("\n");
209+
210+
vaf.fmt = fmt;
211+
vaf.va = &args;
212+
213+
printk(KERN_CRIT "EXT3-fs error (device %s): %s: %pV\n",
214+
sb->s_id, function, &vaf);
215+
207216
va_end(args);
208217

209218
ext3_handle_error(sb);
@@ -274,15 +283,20 @@ void __ext3_std_error (struct super_block * sb, const char * function,
274283
* case we take the easy way out and panic immediately.
275284
*/
276285

277-
void ext3_abort (struct super_block * sb, const char * function,
278-
const char * fmt, ...)
286+
void ext3_abort(struct super_block *sb, const char *function,
287+
const char *fmt, ...)
279288
{
289+
struct va_format vaf;
280290
va_list args;
281291

282292
va_start(args, fmt);
283-
printk(KERN_CRIT "EXT3-fs (%s): error: %s: ", sb->s_id, function);
284-
vprintk(fmt, args);
285-
printk("\n");
293+
294+
vaf.fmt = fmt;
295+
vaf.va = &args;
296+
297+
printk(KERN_CRIT "EXT3-fs (%s): error: %s: %pV\n",
298+
sb->s_id, function, &vaf);
299+
286300
va_end(args);
287301

288302
if (test_opt(sb, ERRORS_PANIC))
@@ -300,16 +314,20 @@ void ext3_abort (struct super_block * sb, const char * function,
300314
journal_abort(EXT3_SB(sb)->s_journal, -EIO);
301315
}
302316

303-
void ext3_warning (struct super_block * sb, const char * function,
304-
const char * fmt, ...)
317+
void ext3_warning(struct super_block *sb, const char *function,
318+
const char *fmt, ...)
305319
{
320+
struct va_format vaf;
306321
va_list args;
307322

308323
va_start(args, fmt);
309-
printk(KERN_WARNING "EXT3-fs (%s): warning: %s: ",
310-
sb->s_id, function);
311-
vprintk(fmt, args);
312-
printk("\n");
324+
325+
vaf.fmt = fmt;
326+
vaf.va = &args;
327+
328+
printk(KERN_WARNING "EXT3-fs (%s): warning: %s: %pV\n",
329+
sb->s_id, function, &vaf);
330+
313331
va_end(args);
314332
}
315333

0 commit comments

Comments
 (0)