Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udf: Neaten logging output, use vsprintf extension %pV

Use %pV and remove a static buffer to save some text space and fix possible
issues when several processes call error reporting function in parallel. Also
change error level from KERN_CRIT to KERN_ERR.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jan Kara <jack@suse.cz>

authored by

Joe Perches and committed by
Jan Kara
c2bff36c 78ace70c

+17 -11
+17 -11
fs/udf/super.c
··· 75 75 76 76 #define UDF_DEFAULT_BLOCKSIZE 2048 77 77 78 - static char error_buf[1024]; 79 - 80 78 /* These are the "meat" - everything else is stuffing */ 81 79 static int udf_fill_super(struct super_block *, void *, int); 82 80 static void udf_put_super(struct super_block *); ··· 2075 2077 void _udf_err(struct super_block *sb, const char *function, 2076 2078 const char *fmt, ...) 2077 2079 { 2080 + struct va_format vaf; 2078 2081 va_list args; 2079 2082 2080 - if (!(sb->s_flags & MS_RDONLY)) { 2081 - /* mark sb error */ 2083 + /* mark sb error */ 2084 + if (!(sb->s_flags & MS_RDONLY)) 2082 2085 sb->s_dirt = 1; 2083 - } 2086 + 2084 2087 va_start(args, fmt); 2085 - vsnprintf(error_buf, sizeof(error_buf), fmt, args); 2088 + 2089 + vaf.fmt = fmt; 2090 + vaf.va = &args; 2091 + 2092 + pr_err("error (device %s): %s: %pV", sb->s_id, function, &vaf); 2093 + 2086 2094 va_end(args); 2087 - pr_crit("error (device %s): %s: %s", 2088 - sb->s_id, function, error_buf); 2089 2095 } 2090 2096 2091 2097 void _udf_warn(struct super_block *sb, const char *function, 2092 2098 const char *fmt, ...) 2093 2099 { 2100 + struct va_format vaf; 2094 2101 va_list args; 2095 2102 2096 2103 va_start(args, fmt); 2097 - vsnprintf(error_buf, sizeof(error_buf), fmt, args); 2104 + 2105 + vaf.fmt = fmt; 2106 + vaf.va = &args; 2107 + 2108 + pr_warn("warning (device %s): %s: %pV", sb->s_id, function, &vaf); 2109 + 2098 2110 va_end(args); 2099 - pr_warn("warning (device %s): %s: %s", 2100 - sb->s_id, function, error_buf); 2101 2111 } 2102 2112 2103 2113 static void udf_put_super(struct super_block *sb)