reiserfs: rework reiserfs_warning

ReiserFS warnings can be somewhat inconsistent.
In some cases:
 * a unique identifier may be associated with it
 * the function name may be included
 * the device may be printed separately

This patch aims to make warnings more consistent. reiserfs_warning() prints
the device name, so printing it a second time is not required. The function
name for a warning is always helpful in debugging, so it is now automatically
inserted into the output. Hans has stated that every warning should have
a unique identifier. Some cases lack them, others really shouldn't have them.
reiserfs_warning() now expects an id associated with each message. In the
rare case where one isn't needed, "" will suffice.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jeff Mahoney
2009-03-30 14:02:21 -04:00
committed by Linus Torvalds
parent 1d889d9958
commit 45b03d5e8e
17 changed files with 454 additions and 426 deletions

View File

@@ -79,7 +79,10 @@ struct fid;
*/
#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
void reiserfs_warning(struct super_block *s, const char *fmt, ...);
void __reiserfs_warning(struct super_block *s, const char *id,
const char *func, const char *fmt, ...);
#define reiserfs_warning(s, id, fmt, args...) \
__reiserfs_warning(s, id, __func__, fmt, ##args)
/* assertions handling */
/** always check a condition and panic if it's false. */
@@ -558,7 +561,7 @@ static inline int uniqueness2type(__u32 uniqueness)
case V1_DIRENTRY_UNIQUENESS:
return TYPE_DIRENTRY;
default:
reiserfs_warning(NULL, "vs-500: unknown uniqueness %d",
reiserfs_warning(NULL, "vs-500", "unknown uniqueness %d",
uniqueness);
case V1_ANY_UNIQUENESS:
return TYPE_ANY;
@@ -578,7 +581,7 @@ static inline __u32 type2uniqueness(int type)
case TYPE_DIRENTRY:
return V1_DIRENTRY_UNIQUENESS;
default:
reiserfs_warning(NULL, "vs-501: unknown type %d", type);
reiserfs_warning(NULL, "vs-501", "unknown type %d", type);
case TYPE_ANY:
return V1_ANY_UNIQUENESS;
}