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

@@ -259,7 +259,8 @@ static int __xattr_readdir(struct inode *inode, void *dirent, filldir_t filldir)
ih = de.de_ih;
if (!is_direntry_le_ih(ih)) {
reiserfs_warning(inode->i_sb, "not direntry %h", ih);
reiserfs_warning(inode->i_sb, "jdm-20000",
"not direntry %h", ih);
break;
}
copy_item_head(&tmp_ih, ih);
@@ -598,7 +599,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
if (rxh->h_magic != cpu_to_le32(REISERFS_XATTR_MAGIC)) {
unlock_page(page);
reiserfs_put_page(page);
reiserfs_warning(inode->i_sb,
reiserfs_warning(inode->i_sb, "jdm-20001",
"Invalid magic for xattr (%s) "
"associated with %k", name,
INODE_PKEY(inode));
@@ -618,7 +619,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
if (xattr_hash(buffer, isize - sizeof(struct reiserfs_xattr_header)) !=
hash) {
reiserfs_warning(inode->i_sb,
reiserfs_warning(inode->i_sb, "jdm-20002",
"Invalid hash for xattr (%s) associated "
"with %k", name, INODE_PKEY(inode));
err = -EIO;
@@ -652,7 +653,8 @@ __reiserfs_xattr_del(struct dentry *xadir, const char *name, int namelen)
goto out_file;
if (!is_reiserfs_priv_object(dentry->d_inode)) {
reiserfs_warning(dir->i_sb, "OID %08x [%.*s/%.*s] doesn't have "
reiserfs_warning(dir->i_sb, "jdm-20003",
"OID %08x [%.*s/%.*s] doesn't have "
"priv flag set [parent is %sset].",
le32_to_cpu(INODE_PKEY(dentry->d_inode)->
k_objectid), xadir->d_name.len,
@@ -750,7 +752,7 @@ int reiserfs_delete_xattrs(struct inode *inode)
reiserfs_write_unlock_xattrs(inode->i_sb);
dput(root);
} else {
reiserfs_warning(inode->i_sb,
reiserfs_warning(inode->i_sb, "jdm-20006",
"Couldn't remove all entries in directory");
}
unlock_kernel();
@@ -1154,7 +1156,8 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags)
} else if (reiserfs_xattrs_optional(s)) {
/* Old format filesystem, but optional xattrs have been enabled
* at mount time. Error out. */
reiserfs_warning(s, "xattrs/ACLs not supported on pre v3.6 "
reiserfs_warning(s, "jdm-20005",
"xattrs/ACLs not supported on pre v3.6 "
"format filesystem. Failing mount.");
err = -EOPNOTSUPP;
goto error;
@@ -1201,8 +1204,10 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags)
/* If we're read-only it just means that the dir hasn't been
* created. Not an error -- just no xattrs on the fs. We'll
* check again if we go read-write */
reiserfs_warning(s, "xattrs/ACLs enabled and couldn't "
"find/create .reiserfs_priv. Failing mount.");
reiserfs_warning(s, "jdm-20006",
"xattrs/ACLs enabled and couldn't "
"find/create .reiserfs_priv. "
"Failing mount.");
err = -EOPNOTSUPP;
}
}