summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-05-14 05:51:27 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-05-14 05:51:27 -0700
commit8a64f0cb5fed1320ca2b4dbb163b3c2d86ab7f57 (patch)
tree4ecb5dc3824c8356a7c8c654ef42fe0179887694
parent50f7b6fdba7b1d20cebc622241c656de9c060997 (diff)
[PATCH] befs: debugging code cleanup
From: "Sergey S. Kostyliov" <rathamahata@php4.ru> - Reduce stack usage. - Kill useless duplication of error and warning messages when debug is on. Old behaviour was: ... BeFS(hda1):
-rw-r--r--fs/befs/debug.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/fs/befs/debug.c b/fs/befs/debug.c
index 816fd7191568..b5e190116af1 100644
--- a/fs/befs/debug.c
+++ b/fs/befs/debug.c
@@ -29,22 +29,29 @@ void
befs_error(const struct super_block *sb, const char *fmt, ...)
{
va_list args;
- char err_buf[ERRBUFSIZE];
+ char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
+ if (err_buf == NULL) {
+ printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE);
+ return;
+ }
va_start(args, fmt);
vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
va_end(args);
printk(KERN_ERR "BeFS(%s): %s\n", sb->s_id, err_buf);
-
- befs_debug(sb, err_buf);
+ kfree(err_buf);
}
void
befs_warning(const struct super_block *sb, const char *fmt, ...)
{
va_list args;
- char err_buf[ERRBUFSIZE];
+ char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
+ if (err_buf == NULL) {
+ printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE);
+ return;
+ }
va_start(args, fmt);
vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
@@ -52,7 +59,7 @@ befs_warning(const struct super_block *sb, const char *fmt, ...)
printk(KERN_WARNING "BeFS(%s): %s\n", sb->s_id, err_buf);
- befs_debug(sb, err_buf);
+ kfree(err_buf);
}
void
@@ -61,15 +68,25 @@ befs_debug(const struct super_block *sb, const char *fmt, ...)
#ifdef CONFIG_BEFS_DEBUG
va_list args;
- char err_buf[ERRBUFSIZE];
+ char *err_buf = NULL;
if (BEFS_SB(sb)->mount_opts.debug) {
+ err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
+ if (err_buf == NULL) {
+ printk(KERN_ERR "could not allocate %d bytes\n",
+ ERRBUFSIZE);
+ return;
+ }
+
va_start(args, fmt);
vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
va_end(args);
printk(KERN_DEBUG "BeFS(%s): %s\n", sb->s_id, err_buf);
+
+ kfree(err_buf);
}
+
#endif //CONFIG_BEFS_DEBUG
}