From: Jan Kara <jack@suse.cz>
To: Joe Perches <joe@perches.com>
Cc: Jan Kara <jack@suse.cz>, NamJae Jeon <linkinjeon@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] udf: Neaten logging output, use vsprintf extension %pV
Date: Mon, 10 Oct 2011 17:04:44 +0200 [thread overview]
Message-ID: <20111010150444.GD3944@quack.suse.cz> (raw)
In-Reply-To: <f6af3ca08d9e966de00d77cc9a8251d91666f33f.1318233879.git.joe@perches.com>
On Mon 10-10-11 01:08:06, Joe Perches wrote:
> Remove the warning and error prefixes that duplicate KERN_<level>.
Please keep that in the prefix. It's easier to read messages when they
are that way ...
> Use %pV and remove a static buffer to save some text space.
This is actually a bugfix because we could corrupt error message when
several error messages would be reported in parallel... Thanks for finding
this.
Honza
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> fs/udf/super.c | 28 +++++++++++++++++-----------
> 1 files changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index ea1b44b..b72c5ab 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -75,8 +75,6 @@
>
> #define UDF_DEFAULT_BLOCKSIZE 2048
>
> -static char error_buf[1024];
> -
> /* These are the "meat" - everything else is stuffing */
> static int udf_fill_super(struct super_block *, void *, int);
> static void udf_put_super(struct super_block *);
> @@ -2075,29 +2073,37 @@ error_out:
> void _udf_err(struct super_block *sb, const char *function,
> const char *fmt, ...)
> {
> + struct va_format vaf;
> va_list args;
>
> - if (!(sb->s_flags & MS_RDONLY)) {
> - /* mark sb error */
> + /* mark sb error */
> + if (!(sb->s_flags & MS_RDONLY))
> sb->s_dirt = 1;
> - }
> +
> va_start(args, fmt);
> - vsnprintf(error_buf, sizeof(error_buf), fmt, args);
> +
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + pr_crit("device %s: %s: %pV", sb->s_id, function, &vaf);
> +
> va_end(args);
> - pr_crit("error (device %s): %s: %s",
> - sb->s_id, function, error_buf);
> }
>
> void _udf_warn(struct super_block *sb, const char *function,
> const char *fmt, ...)
> {
> + struct va_format vaf;
> va_list args;
>
> va_start(args, fmt);
> - vsnprintf(error_buf, sizeof(error_buf), fmt, args);
> +
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + pr_warn("device %s: %s: %pV", sb->s_id, function, &vaf);
> +
> va_end(args);
> - pr_warn("warning (device %s): %s: %s",
> - sb->s_id, function, error_buf);
> }
>
> static void udf_put_super(struct super_block *sb)
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2011-10-10 15:04 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-03 13:53 [PATCH 1/2 v3] udf : enable error print in udf_read_tagged() Namjae Jeon
2011-10-05 22:08 ` Jan Kara
2011-10-05 22:19 ` Joe Perches
2011-10-06 21:41 ` Jan Kara
2011-10-09 3:16 ` NamJae Jeon
2011-10-09 3:29 ` Joe Perches
2011-10-09 4:44 ` NamJae Jeon
2011-10-09 4:56 ` Joe Perches
2011-10-09 6:25 ` NamJae Jeon
2011-10-09 14:07 ` NamJae Jeon
2011-10-10 8:08 ` [PATCH 0/6] udf: Change some KERN_<level>s and logging neatening Joe Perches
2011-10-10 8:08 ` [PATCH 1/6] udf: Promote some debugging messages to udf_error Joe Perches
2011-10-10 10:06 ` NamJae Jeon
2011-10-10 17:32 ` Jan Kara
2011-10-10 8:08 ` [PATCH 2/6] udf: Rename udf_error to udf_err Joe Perches
2011-10-10 10:18 ` NamJae Jeon
2011-10-10 8:08 ` [PATCH 3/6] udf: Rename udf_warn to udf_warn Joe Perches
2011-10-10 10:18 ` NamJae Jeon
2011-10-10 18:25 ` Paul Bolle
2011-10-10 18:27 ` Joe Perches
2011-10-10 8:08 ` [PATCH 4/6] udf: Convert printks to pr_<level> Joe Perches
2011-10-10 10:21 ` NamJae Jeon
2011-10-10 14:59 ` Jan Kara
2011-10-10 15:20 ` Joe Perches
2011-10-10 15:23 ` Joe Perches
2011-10-10 16:41 ` Jan Kara
2011-10-10 17:25 ` Joe Perches
2011-10-10 17:40 ` Jan Kara
2011-10-10 8:08 ` [PATCH 5/6] udf: Neaten logging output, use vsprintf extension %pV Joe Perches
2011-10-10 10:22 ` NamJae Jeon
2011-10-10 15:04 ` Jan Kara [this message]
2011-10-10 15:20 ` Joe Perches
2011-10-10 8:08 ` [PATCH 6/6] udf: Neaten udf_debug uses Joe Perches
2011-10-10 10:23 ` NamJae Jeon
2011-10-10 10:24 ` [PATCH 0/6] udf: Change some KERN_<level>s and logging neatening NamJae Jeon
2011-10-10 17:47 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2011-10-10 17:50 [PATCH 0/6] udf: Message printing cleanup (v2) Jan Kara
2011-10-10 17:50 ` [PATCH 5/6] udf: Neaten logging output, use vsprintf extension %pV Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111010150444.GD3944@quack.suse.cz \
--to=jack@suse.cz \
--cc=joe@perches.com \
--cc=linkinjeon@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.