* [PATCH] fs/ext3/super.c: Use printf extension %pV
@ 2010-11-09 18:18 Joe Perches
2010-11-09 22:46 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2010-11-09 18:18 UTC (permalink / raw)
To: Jan Kara, Andrew Morton, Andreas Dilger; +Cc: linux-ext4, linux-kernel
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>
---
fs/ext3/super.c | 56 ++++++++++++++++++++++++++++++++++++------------------
1 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 2fedaf8..adfbe0d 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -144,12 +144,16 @@ void ext3_journal_abort_handle(const char *caller, const char *err_fn,
void ext3_msg(struct super_block *sb, const char *prefix,
const char *fmt, ...)
{
+ struct va_format vaf;
va_list args;
va_start(args, fmt);
- printk("%sEXT3-fs (%s): ", prefix, sb->s_id);
- vprintk(fmt, args);
- printk("\n");
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ printk("%sEXT3-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
+
va_end(args);
}
@@ -196,15 +200,20 @@ static void ext3_handle_error(struct super_block *sb)
sb->s_id);
}
-void ext3_error (struct super_block * sb, const char * function,
- const char * fmt, ...)
+void ext3_error(struct super_block *sb, const char *function,
+ const char *fmt, ...)
{
+ struct va_format vaf;
va_list args;
va_start(args, fmt);
- printk(KERN_CRIT "EXT3-fs error (device %s): %s: ",sb->s_id, function);
- vprintk(fmt, args);
- printk("\n");
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ printk(KERN_CRIT "EXT3-fs error (device %s): %s: %pV\n",
+ sb->s_id, function, &vaf);
+
va_end(args);
ext3_handle_error(sb);
@@ -275,15 +284,20 @@ void __ext3_std_error (struct super_block * sb, const char * function,
* case we take the easy way out and panic immediately.
*/
-void ext3_abort (struct super_block * sb, const char * function,
- const char * fmt, ...)
+void ext3_abort(struct super_block *sb, const char *function,
+ const char *fmt, ...)
{
+ struct va_format vaf;
va_list args;
va_start(args, fmt);
- printk(KERN_CRIT "EXT3-fs (%s): error: %s: ", sb->s_id, function);
- vprintk(fmt, args);
- printk("\n");
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ printk(KERN_CRIT "EXT3-fs (%s): error: %s: %pV\n",
+ sb->s_id, function, &vaf);
+
va_end(args);
if (test_opt(sb, ERRORS_PANIC))
@@ -301,16 +315,20 @@ void ext3_abort (struct super_block * sb, const char * function,
journal_abort(EXT3_SB(sb)->s_journal, -EIO);
}
-void ext3_warning (struct super_block * sb, const char * function,
- const char * fmt, ...)
+void ext3_warning(struct super_block *sb, const char *function,
+ const char *fmt, ...)
{
+ struct va_format vaf;
va_list args;
va_start(args, fmt);
- printk(KERN_WARNING "EXT3-fs (%s): warning: %s: ",
- sb->s_id, function);
- vprintk(fmt, args);
- printk("\n");
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ printk(KERN_WARNING "EXT3-fs (%s): warning: %s: %pV\n",
+ sb->s_id, function, &vaf);
+
va_end(args);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs/ext3/super.c: Use printf extension %pV
2010-11-09 18:18 [PATCH] fs/ext3/super.c: Use printf extension %pV Joe Perches
@ 2010-11-09 22:46 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2010-11-09 22:46 UTC (permalink / raw)
To: Joe Perches
Cc: Jan Kara, Andrew Morton, Andreas Dilger, linux-ext4, linux-kernel
On Tue 09-11-10 10:18:05, Joe Perches wrote:
> Using %pV reduces the number of printk calls and
> eliminates any possible message interleaving from
> other printk calls.
Thanks. Merged.
Honza
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> fs/ext3/super.c | 56 ++++++++++++++++++++++++++++++++++++------------------
> 1 files changed, 37 insertions(+), 19 deletions(-)
>
> diff --git a/fs/ext3/super.c b/fs/ext3/super.c
> index 2fedaf8..adfbe0d 100644
> --- a/fs/ext3/super.c
> +++ b/fs/ext3/super.c
> @@ -144,12 +144,16 @@ void ext3_journal_abort_handle(const char *caller, const char *err_fn,
> void ext3_msg(struct super_block *sb, const char *prefix,
> const char *fmt, ...)
> {
> + struct va_format vaf;
> va_list args;
>
> va_start(args, fmt);
> - printk("%sEXT3-fs (%s): ", prefix, sb->s_id);
> - vprintk(fmt, args);
> - printk("\n");
> +
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + printk("%sEXT3-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
> +
> va_end(args);
> }
>
> @@ -196,15 +200,20 @@ static void ext3_handle_error(struct super_block *sb)
> sb->s_id);
> }
>
> -void ext3_error (struct super_block * sb, const char * function,
> - const char * fmt, ...)
> +void ext3_error(struct super_block *sb, const char *function,
> + const char *fmt, ...)
> {
> + struct va_format vaf;
> va_list args;
>
> va_start(args, fmt);
> - printk(KERN_CRIT "EXT3-fs error (device %s): %s: ",sb->s_id, function);
> - vprintk(fmt, args);
> - printk("\n");
> +
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + printk(KERN_CRIT "EXT3-fs error (device %s): %s: %pV\n",
> + sb->s_id, function, &vaf);
> +
> va_end(args);
>
> ext3_handle_error(sb);
> @@ -275,15 +284,20 @@ void __ext3_std_error (struct super_block * sb, const char * function,
> * case we take the easy way out and panic immediately.
> */
>
> -void ext3_abort (struct super_block * sb, const char * function,
> - const char * fmt, ...)
> +void ext3_abort(struct super_block *sb, const char *function,
> + const char *fmt, ...)
> {
> + struct va_format vaf;
> va_list args;
>
> va_start(args, fmt);
> - printk(KERN_CRIT "EXT3-fs (%s): error: %s: ", sb->s_id, function);
> - vprintk(fmt, args);
> - printk("\n");
> +
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + printk(KERN_CRIT "EXT3-fs (%s): error: %s: %pV\n",
> + sb->s_id, function, &vaf);
> +
> va_end(args);
>
> if (test_opt(sb, ERRORS_PANIC))
> @@ -301,16 +315,20 @@ void ext3_abort (struct super_block * sb, const char * function,
> journal_abort(EXT3_SB(sb)->s_journal, -EIO);
> }
>
> -void ext3_warning (struct super_block * sb, const char * function,
> - const char * fmt, ...)
> +void ext3_warning(struct super_block *sb, const char *function,
> + const char *fmt, ...)
> {
> + struct va_format vaf;
> va_list args;
>
> va_start(args, fmt);
> - printk(KERN_WARNING "EXT3-fs (%s): warning: %s: ",
> - sb->s_id, function);
> - vprintk(fmt, args);
> - printk("\n");
> +
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + printk(KERN_WARNING "EXT3-fs (%s): warning: %s: %pV\n",
> + sb->s_id, function, &vaf);
> +
> va_end(args);
> }
>
>
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-09 22:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09 18:18 [PATCH] fs/ext3/super.c: Use printf extension %pV Joe Perches
2010-11-09 22:46 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).