* [patch 00/11] reiserfs fixups and error handling
@ 2007-07-12 19:37 jeffm
2007-07-12 19:37 ` [patch 01/11] reiserfs: fix up lockdep warnings jeffm
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
This is the first part of a series of patches I've been developing for
reiserfs. I'm posting them now for review followed by submission to 2.6.23.
The first 4 patches are small fixes:
* Adding proper lockdep annotation to xattrs
* Switching to panic() instead of BUG() in reiserfs_panic()
* Making is_reusable bitmap sanity checking unconditional
* Using the first zero hint in bitmap iteration
The remaining 7 work to make reiserfs error handling more consistent
and robust:
* Use consistent message prefixes for all reiserfs log output
* Add a reiserfs_info() call for multiline output that doesn't
masquerade as a warning.
* Make reiserfs_warning() calls more consistent, requiring an ID, and
including the device and function where the warning is occuring.
* Make reiserfs_panic() more consistent in the same manner.
* Rearrange reiserfs_journal_abort() since it was modelled after jbd's
call and doesn't need to be. There's several function calls that
just get optimized out anyway.
* Add a reiserfs_error() call to handle metadata errors by aborting
the journal and marking the file system read-only.
* Convert 50 reiserfs_warning(), 2 reiserfs_panic(), and one BUG_ON
site to use the new reiserfs_error().,
-Jeff
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 01/11] reiserfs: fix up lockdep warnings
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 02/11] reiserfs: dont use BUG when panicking jeffm
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-fix-lockdep-warnings --]
[-- Type: text/plain, Size: 1153 bytes --]
This patch adds I_MUTEX_XATTR annotations to the inode locking in
the reiserfs xattr code.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/reiserfs/xattr.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/fs/reiserfs/xattr.c 2007-06-13 11:51:51.000000000 -0400
+++ b/fs/reiserfs/xattr.c 2007-06-13 13:39:14.000000000 -0400
@@ -478,7 +478,7 @@ reiserfs_xattr_set(struct inode *inode,
/* Resize it so we're ok to write there */
newattrs.ia_size = buffer_size;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
- mutex_lock(&xinode->i_mutex);
+ mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR);
err = notify_change(fp->f_path.dentry, &newattrs);
if (err)
goto out_filp;
@@ -1217,7 +1217,8 @@ int reiserfs_xattr_init(struct super_blo
if (!IS_ERR(dentry)) {
if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) {
struct inode *inode = dentry->d_parent->d_inode;
- mutex_lock(&inode->i_mutex);
+ mutex_lock_nested(&inode->i_mutex,
+ I_MUTEX_XATTR);
err = inode->i_op->mkdir(inode, dentry, 0700);
mutex_unlock(&inode->i_mutex);
if (err) {
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 02/11] reiserfs: dont use BUG when panicking
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
2007-07-12 19:37 ` [patch 01/11] reiserfs: fix up lockdep warnings jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 03/11] reiserfs: use is_reusable to catch corruption jeffm
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-no-bug-on-panic.diff --]
[-- Type: text/plain, Size: 1105 bytes --]
This patch changes reiserfs_panic() to use panic() instead of BUG().
Using BUG() ignores the configurable panic behavior, so systems that
should be failing and rebooting are left hanging. This causes problems
in active/standby HA scenarios.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/reiserfs/prints.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
--- a/fs/reiserfs/prints.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/prints.c 2007-06-11 14:50:11.000000000 -0400
@@ -356,13 +356,8 @@ extern struct tree_balance *cur_tb;
void reiserfs_panic(struct super_block *sb, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
- printk(KERN_EMERG "REISERFS: panic (device %s): %s\n",
+ panic(KERN_EMERG "REISERFS: panic (device %s): %s\n",
reiserfs_bdevname(sb), error_buf);
- BUG();
-
- /* this is not actually called, but makes reiserfs_panic() "noreturn" */
- panic("REISERFS: panic (device %s): %s\n",
- reiserfs_bdevname(sb), error_buf);
}
void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 03/11] reiserfs: use is_reusable to catch corruption
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
2007-07-12 19:37 ` [patch 01/11] reiserfs: fix up lockdep warnings jeffm
2007-07-12 19:37 ` [patch 02/11] reiserfs: dont use BUG when panicking jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 04/11] reiserfs: make bitmap use cached first zero bit jeffm
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-use-is_reusable.diff --]
[-- Type: text/plain, Size: 2275 bytes --]
This patch builds in is_reusable() unconditionally and uses it to catch
corruption before it reaches the block freeing paths.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
--
fs/reiserfs/bitmap.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
--- a/fs/reiserfs/bitmap.c 2007-06-13 11:51:51.000000000 -0400
+++ b/fs/reiserfs/bitmap.c 2007-06-13 11:54:53.000000000 -0400
@@ -56,7 +56,6 @@ static inline void get_bit_address(struc
*offset = block & ((s->s_blocksize << 3) - 1);
}
-#ifdef CONFIG_REISERFS_CHECK
int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
{
int bmap, offset;
@@ -106,7 +105,6 @@ int is_reusable(struct super_block *s, b
return 1;
}
-#endif /* CONFIG_REISERFS_CHECK */
/* searches in journal structures for a given block number (bmap, off). If block
is found in reiserfs journal it suggests next free block candidate to test. */
@@ -434,12 +432,19 @@ void reiserfs_free_block(struct reiserfs
int for_unformatted)
{
struct super_block *s = th->t_super;
-
BUG_ON(!th->t_trans_id);
RFALSE(!s, "vs-4061: trying to free block on nonexistent device");
- RFALSE(is_reusable(s, block, 1) == 0,
- "vs-4071: can not free such block");
+ if (!is_reusable(s, block, 1))
+ return;
+
+ if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
+ reiserfs_panic(th->t_super, "bitmap-4072",
+ "Trying to free block outside file system "
+ "boundaries (%lu > %lu)",
+ block, sb_block_count(REISERFS_SB(s)->s_rs));
+ return;
+ }
/* mark it before we clear it, just in case */
journal_mark_freed(th, s, block);
_reiserfs_free_block(th, inode, block, for_unformatted);
@@ -449,11 +454,11 @@ void reiserfs_free_block(struct reiserfs
static void reiserfs_free_prealloc_block(struct reiserfs_transaction_handle *th,
struct inode *inode, b_blocknr_t block)
{
+ BUG_ON(!th->t_trans_id);
RFALSE(!th->t_super,
"vs-4060: trying to free block on nonexistent device");
- RFALSE(is_reusable(th->t_super, block, 1) == 0,
- "vs-4070: can not free such block");
- BUG_ON(!th->t_trans_id);
+ if (!is_reusable(th->t_super, block, 1))
+ return;
_reiserfs_free_block(th, inode, block, 1);
}
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 04/11] reiserfs: make bitmap use cached first zero bit
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (2 preceding siblings ...)
2007-07-12 19:37 ` [patch 03/11] reiserfs: use is_reusable to catch corruption jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 05/11] reiserfs: use more consistent printk formatting jeffm
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-bitmap-use-first-zero-hint.diff --]
[-- Type: text/plain, Size: 1105 bytes --]
Currently, the bitmap code uses half of the hinting data gathered and cached
and wastes the other half. We'll skip completely full bitmaps, but start
scanning in bitmaps at locations where if we consulted the zero bit hint,
we'd know there aren't any free bits available.
This patch uses the first zero hint to bump the beginning of the search
window to where we know there is at least one zero bit.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/reiserfs/bitmap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/fs/reiserfs/bitmap.c 2007-06-11 14:49:32.000000000 -0400
+++ b/fs/reiserfs/bitmap.c 2007-06-11 14:50:10.000000000 -0400
@@ -166,7 +166,10 @@ static int scan_bitmap_block(struct reis
return 0; // No free blocks in this bitmap
}
- /* search for a first zero bit -- beggining of a window */
+ if (*beg < bi->first_zero_hint)
+ *beg = bi->first_zero_hint;
+
+ /* search for a first zero bit -- beginning of a window */
*beg = reiserfs_find_next_zero_le_bit
((unsigned long *)(bh->b_data), boundary, *beg);
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 05/11] reiserfs: use more consistent printk formatting
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (3 preceding siblings ...)
2007-07-12 19:37 ` [patch 04/11] reiserfs: make bitmap use cached first zero bit jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 06/11] reiserfs: make some warnings informational jeffm
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-consistent-messages.diff --]
[-- Type: text/plain, Size: 2585 bytes --]
The output format between a warning/error/panic/info/etc changes with
which one is used.
The following patch makes the messages more internally consistent, but also
more consistent with other Linux filesystems.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
--
fs/reiserfs/prints.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
--- a/fs/reiserfs/prints.c 2007-06-11 14:49:31.000000000 -0400
+++ b/fs/reiserfs/prints.c 2007-06-11 14:50:10.000000000 -0400
@@ -268,10 +268,10 @@ void reiserfs_warning(struct super_block
{
do_reiserfs_warning(fmt);
if (sb)
- printk(KERN_WARNING "ReiserFS: %s: warning: %s\n",
- reiserfs_bdevname(sb), error_buf);
+ printk(KERN_WARNING "REISERFS warning (device %s): %s\n",
+ sb->s_id, error_buf);
else
- printk(KERN_WARNING "ReiserFS: warning: %s\n", error_buf);
+ printk(KERN_WARNING "REISERFS warning: %s\n", error_buf);
}
/* No newline.. reiserfs_info calls can be followed by printk's */
@@ -279,10 +279,10 @@ void reiserfs_info(struct super_block *s
{
do_reiserfs_warning(fmt);
if (sb)
- printk(KERN_NOTICE "ReiserFS: %s: %s",
- reiserfs_bdevname(sb), error_buf);
+ printk(KERN_NOTICE "REISERFS (device %s): %s",
+ sb->s_id, error_buf);
else
- printk(KERN_NOTICE "ReiserFS: %s", error_buf);
+ printk(KERN_NOTICE "REISERFS %s:", error_buf);
}
/* No newline.. reiserfs_printk calls can be followed by printk's */
@@ -297,10 +297,10 @@ void reiserfs_debug(struct super_block *
#ifdef CONFIG_REISERFS_CHECK
do_reiserfs_warning(fmt);
if (s)
- printk(KERN_DEBUG "ReiserFS: %s: %s\n",
- reiserfs_bdevname(s), error_buf);
+ printk(KERN_DEBUG "REISERFS debug (device %s): %s\n",
+ s->s_id, error_buf);
else
- printk(KERN_DEBUG "ReiserFS: %s\n", error_buf);
+ printk(KERN_DEBUG "REISERFS debug: %s\n", error_buf);
#endif
}
@@ -365,15 +365,15 @@ void reiserfs_abort(struct super_block *
do_reiserfs_warning(fmt);
if (reiserfs_error_panic(sb)) {
- panic(KERN_CRIT "REISERFS: panic (device %s): %s\n",
- reiserfs_bdevname(sb), error_buf);
+ panic(KERN_CRIT "REISERFS panic (device %s): %s\n", sb->s_id,
+ error_buf);
}
- if (sb->s_flags & MS_RDONLY)
+ if (reiserfs_is_journal_aborted(SB_JOURNAL(sb)))
return;
- printk(KERN_CRIT "REISERFS: abort (device %s): %s\n",
- reiserfs_bdevname(sb), error_buf);
+ printk(KERN_CRIT "REISERFS abort (device %s): %s\n", sb->s_id,
+ error_buf);
sb->s_flags |= MS_RDONLY;
reiserfs_journal_abort(sb, errno);
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 06/11] reiserfs: make some warnings informational
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (4 preceding siblings ...)
2007-07-12 19:37 ` [patch 05/11] reiserfs: use more consistent printk formatting jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 07/11] reiserfs: rework reiserfs_warning jeffm
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-reiserfs_info.diff --]
[-- Type: text/plain, Size: 3061 bytes --]
In several places, reiserfs_warning is used when there is no warning, just
a notice. This patch changes some of them to indicate that the message
is merely informational.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
--
fs/reiserfs/bitmap.c | 4 ++--
fs/reiserfs/super.c | 14 ++++++--------
fs/reiserfs/xattr.c | 10 ++++------
3 files changed, 12 insertions(+), 16 deletions(-)
--- a/fs/reiserfs/bitmap.c 2007-06-11 14:49:32.000000000 -0400
+++ b/fs/reiserfs/bitmap.c 2007-06-11 14:50:10.000000000 -0400
@@ -40,7 +40,7 @@
#define SET_OPTION(optname) \
do { \
- reiserfs_warning(s, "reiserfs: option \"%s\" is set", #optname); \
+ reiserfs_info(s, "block allocator option \"%s\" is set", #optname); \
set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \
} while(0)
#define TEST_OPTION(optname, s) \
@@ -633,7 +633,7 @@ int reiserfs_parse_alloc_options(struct
return 1;
}
- reiserfs_warning(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
+ reiserfs_info(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
return 0;
}
--- a/fs/reiserfs/super.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/super.c 2007-06-11 14:50:10.000000000 -0400
@@ -1308,13 +1308,11 @@ static int read_super_block(struct super
/* magic is of non-standard journal filesystem, look at s_version to
find which format is in use */
if (sb_version(rs) == REISERFS_VERSION_2)
- reiserfs_warning(s,
- "read_super_block: found reiserfs format \"3.6\""
- " with non-standard journal");
+ reiserfs_info(s, "found reiserfs format \"3.6\""
+ " with non-standard journal\n");
else if (sb_version(rs) == REISERFS_VERSION_1)
- reiserfs_warning(s,
- "read_super_block: found reiserfs format \"3.5\""
- " with non-standard journal");
+ reiserfs_info(s, "found reiserfs format \"3.5\""
+ " with non-standard journal\n");
else {
reiserfs_warning(s,
"sh-2012: read_super_block: found unknown "
@@ -1393,8 +1391,8 @@ static __u32 find_hash_out(struct super_
if (reiserfs_rupasov_hash(s)) {
hash = YURA_HASH;
}
- reiserfs_warning(s, "FS seems to be empty, autodetect "
- "is using the default hash");
+ reiserfs_info(s, "FS seems to be empty, autodetect "
+ "is using the default hash\n");
break;
}
r5hash = GET_HASH_VALUE(r5_hash(de.de_name, de.de_namelen));
--- a/fs/reiserfs/xattr.c 2007-06-11 14:49:31.000000000 -0400
+++ b/fs/reiserfs/xattr.c 2007-06-11 14:50:10.000000000 -0400
@@ -1227,12 +1227,10 @@ int reiserfs_xattr_init(struct super_blo
}
if (dentry && dentry->d_inode)
- reiserfs_warning(s,
- "Created %s on %s - reserved for "
- "xattr storage.",
- PRIVROOT_NAME,
- reiserfs_bdevname
- (inode->i_sb));
+ reiserfs_info(s, "Created %s - "
+ "reserved for xattr "
+ "storage.\n",
+ PRIVROOT_NAME);
} else if (!dentry->d_inode) {
dput(dentry);
dentry = NULL;
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 07/11] reiserfs: rework reiserfs_warning
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (5 preceding siblings ...)
2007-07-12 19:37 ` [patch 06/11] reiserfs: make some warnings informational jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 08/11] reiserfs: rework reiserfs_panic jeffm
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-reiserfs-warning.diff --]
[-- Type: text/plain, Size: 86526 bytes --]
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>
--
fs/reiserfs/bitmap.c | 50 ++++----
fs/reiserfs/do_balan.c | 39 +++---
fs/reiserfs/file.c | 11 +
fs/reiserfs/fix_node.c | 14 +-
fs/reiserfs/inode.c | 63 +++++------
fs/reiserfs/item_ops.c | 60 +++++-----
fs/reiserfs/journal.c | 168 +++++++++++++++--------------
fs/reiserfs/lbalance.c | 12 +-
fs/reiserfs/namei.c | 45 +++----
fs/reiserfs/objectid.c | 5
fs/reiserfs/prints.c | 11 +
fs/reiserfs/procfs.c | 5
fs/reiserfs/stree.c | 107 ++++++++----------
fs/reiserfs/super.c | 240 ++++++++++++++++++++++--------------------
fs/reiserfs/tail_conversion.c | 6 -
fs/reiserfs/xattr.c | 21 ++-
include/linux/reiserfs_fs.h | 9 +
17 files changed, 444 insertions(+), 422 deletions(-)
--- a/fs/reiserfs/bitmap.c 2007-06-11 14:49:33.000000000 -0400
+++ b/fs/reiserfs/bitmap.c 2007-06-11 14:50:08.000000000 -0400
@@ -61,8 +61,8 @@ int is_reusable(struct super_block *s, b
int bmap, offset;
if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
- reiserfs_warning(s,
- "vs-4010: is_reusable: block number is out of range %lu (%u)",
+ reiserfs_warning(s, "vs-4010",
+ "block number is out of range %lu (%u)",
block, SB_BLOCK_COUNT(s));
return 0;
}
@@ -75,30 +75,29 @@ int is_reusable(struct super_block *s, b
&(REISERFS_SB(s)->s_properties)))) {
b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1;
if (block >= bmap1 && block <= bmap1 + SB_BMAP_NR(s)) {
- reiserfs_warning(s, "vs: 4019: is_reusable: "
- "bitmap block %lu(%u) can't be freed or reused",
+ reiserfs_warning(s, "vs-4019", "bitmap block "
+ "%lu(%u) can't be freed or reused",
block, SB_BMAP_NR(s));
return 0;
}
} else {
if (offset == 0) {
- reiserfs_warning(s, "vs: 4020: is_reusable: "
- "bitmap block %lu(%u) can't be freed or reused",
+ reiserfs_warning(s, "vs-4020", "bitmap block "
+ "%lu(%u) can't be freed or reused",
block, SB_BMAP_NR(s));
return 0;
}
}
if (bmap >= SB_BMAP_NR(s)) {
- reiserfs_warning(s,
- "vs-4030: is_reusable: there is no so many bitmap blocks: "
- "block=%lu, bitmap_nr=%d", block, bmap);
+ reiserfs_warning(s, "vs-4030", "there is no so many "
+ "bitmap blocks: block=%lu, bitmap_nr=%d",
+ block, bmap);
return 0;
}
if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) {
- reiserfs_warning(s,
- "vs-4050: is_reusable: this is root block (%u), "
+ reiserfs_warning(s, "vs-4050", "this is root block (%u), "
"it must be busy", SB_ROOT_BLOCK(s));
return 0;
}
@@ -150,8 +149,8 @@ static int scan_bitmap_block(struct reis
/* - I mean `a window of zero bits' as in description of this function - Zam. */
if (!bi) {
- reiserfs_warning(s, "NULL bitmap info pointer for bitmap %d",
- bmap_n);
+ reiserfs_warning(s, "jdm-4055", "NULL bitmap info pointer "
+ "for bitmap %d", bmap_n);
return 0;
}
@@ -399,9 +398,8 @@ static void _reiserfs_free_block(struct
get_bit_address(s, block, &nr, &offset);
if (nr >= sb_bmap_nr(rs)) {
- reiserfs_warning(s, "vs-4075: reiserfs_free_block: "
- "block %lu is out of range on %s",
- block, reiserfs_bdevname(s));
+ reiserfs_warning(s, "vs-4075",
+ "block %lu is out of range", block);
return;
}
@@ -413,9 +411,8 @@ static void _reiserfs_free_block(struct
/* clear bit for the given block in bit map */
if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) {
- reiserfs_warning(s, "vs-4080: reiserfs_free_block: "
- "free_block (%s:%lu)[dev:blocknr]: bit already cleared",
- reiserfs_bdevname(s), block);
+ reiserfs_warning(s, "vs-4080",
+ "block %lu: bit already cleared", block);
}
apbi[nr].free_count++;
journal_mark_dirty(th, s, bmbh);
@@ -474,9 +471,8 @@ static void __discard_prealloc(struct re
BUG_ON(!th->t_trans_id);
#ifdef CONFIG_REISERFS_CHECK
if (ei->i_prealloc_count < 0)
- reiserfs_warning(th->t_super,
- "zam-4001:%s: inode has negative prealloc blocks count.",
- __FUNCTION__);
+ reiserfs_warning(th->t_super, "zam-4001",
+ "inode has negative prealloc blocks count.");
#endif
while (ei->i_prealloc_count > 0) {
reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
@@ -512,9 +508,9 @@ void reiserfs_discard_all_prealloc(struc
i_prealloc_list);
#ifdef CONFIG_REISERFS_CHECK
if (!ei->i_prealloc_count) {
- reiserfs_warning(th->t_super,
- "zam-4001:%s: inode is in prealloc list but has no preallocated blocks.",
- __FUNCTION__);
+ reiserfs_warning(th->t_super, "zam-4001",
+ "inode is in prealloc list but has "
+ "no preallocated blocks.");
}
#endif
__discard_prealloc(th, ei);
@@ -628,8 +624,8 @@ int reiserfs_parse_alloc_options(struct
continue;
}
- reiserfs_warning(s, "zam-4001: %s : unknown option - %s",
- __FUNCTION__, this_char);
+ reiserfs_warning(s, "zam-4001", "unknown option - %s",
+ this_char);
return 1;
}
--- a/fs/reiserfs/do_balan.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/do_balan.c 2007-06-11 14:50:09.000000000 -0400
@@ -1755,15 +1755,15 @@ static void store_thrown(struct tree_bal
int i;
if (buffer_dirty(bh))
- reiserfs_warning(tb->tb_sb,
- "store_thrown deals with dirty buffer");
+ reiserfs_warning(tb->tb_sb, "reiserfs-12320",
+ "called with dirty buffer");
for (i = 0; i < ARRAY_SIZE(tb->thrown); i++)
if (!tb->thrown[i]) {
tb->thrown[i] = bh;
get_bh(bh); /* free_thrown puts this */
return;
}
- reiserfs_warning(tb->tb_sb, "store_thrown: too many thrown buffers");
+ reiserfs_warning(tb->tb_sb, "reiserfs-12321", "too many thrown buffers");
}
static void free_thrown(struct tree_balance *tb)
@@ -1774,8 +1774,8 @@ static void free_thrown(struct tree_bala
if (tb->thrown[i]) {
blocknr = tb->thrown[i]->b_blocknr;
if (buffer_dirty(tb->thrown[i]))
- reiserfs_warning(tb->tb_sb,
- "free_thrown deals with dirty buffer %d",
+ reiserfs_warning(tb->tb_sb, "reiserfs-12322",
+ "called with dirty buffer %d",
blocknr);
brelse(tb->thrown[i]); /* incremented in store_thrown */
reiserfs_free_block(tb->transaction_handle, NULL,
@@ -1880,13 +1880,12 @@ static void check_internal_node(struct s
}
}
-static int locked_or_not_in_tree(struct buffer_head *bh, char *which)
+static int locked_or_not_in_tree(struct tree_balance *tb,
+ struct buffer_head *bh, char *which)
{
if ((!buffer_journal_prepared(bh) && buffer_locked(bh)) ||
!B_IS_IN_TREE(bh)) {
- reiserfs_warning(NULL,
- "vs-12339: locked_or_not_in_tree: %s (%b)",
- which, bh);
+ reiserfs_warning(tb->tb_sb, "vs-12339", "%s (%b)", which, bh);
return 1;
}
return 0;
@@ -1905,18 +1904,19 @@ static int check_before_balancing(struct
/* double check that buffers that we will modify are unlocked. (fix_nodes should already have
prepped all of these for us). */
if (tb->lnum[0]) {
- retval |= locked_or_not_in_tree(tb->L[0], "L[0]");
- retval |= locked_or_not_in_tree(tb->FL[0], "FL[0]");
- retval |= locked_or_not_in_tree(tb->CFL[0], "CFL[0]");
+ retval |= locked_or_not_in_tree(tb, tb->L[0], "L[0]");
+ retval |= locked_or_not_in_tree(tb, tb->FL[0], "FL[0]");
+ retval |= locked_or_not_in_tree(tb, tb->CFL[0], "CFL[0]");
check_leaf(tb->L[0]);
}
if (tb->rnum[0]) {
- retval |= locked_or_not_in_tree(tb->R[0], "R[0]");
- retval |= locked_or_not_in_tree(tb->FR[0], "FR[0]");
- retval |= locked_or_not_in_tree(tb->CFR[0], "CFR[0]");
+ retval |= locked_or_not_in_tree(tb, tb->R[0], "R[0]");
+ retval |= locked_or_not_in_tree(tb, tb->FR[0], "FR[0]");
+ retval |= locked_or_not_in_tree(tb, tb->CFR[0], "CFR[0]");
check_leaf(tb->R[0]);
}
- retval |= locked_or_not_in_tree(PATH_PLAST_BUFFER(tb->tb_path), "S[0]");
+ retval |= locked_or_not_in_tree(tb, PATH_PLAST_BUFFER(tb->tb_path),
+ "S[0]");
check_leaf(PATH_PLAST_BUFFER(tb->tb_path));
return retval;
@@ -1955,7 +1955,7 @@ static void check_after_balance_leaf(str
PATH_H_POSITION(tb->tb_path,
1))));
print_cur_tb("12223");
- reiserfs_warning(tb->tb_sb,
+ reiserfs_warning(tb->tb_sb, "reiserfs-12363",
"B_FREE_SPACE (PATH_H_PBUFFER(tb->tb_path,0)) = %d; "
"MAX_CHILD_SIZE (%d) - dc_size( %y, %d ) [%d] = %d",
left,
@@ -2107,9 +2107,8 @@ void do_balance(struct tree_balance *tb,
}
/* if we have no real work to do */
if (!tb->insert_size[0]) {
- reiserfs_warning(tb->tb_sb,
- "PAP-12350: do_balance: insert_size == 0, mode == %c",
- flag);
+ reiserfs_warning(tb->tb_sb, "PAP-12350",
+ "insert_size == 0, mode == %c", flag);
unfix_nodes(tb);
return;
}
--- a/fs/reiserfs/file.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/file.c 2007-06-11 14:50:09.000000000 -0400
@@ -76,7 +76,7 @@ static int reiserfs_file_release(struct
* and let the admin know what is going on.
*/
igrab(inode);
- reiserfs_warning(inode->i_sb,
+ reiserfs_warning(inode->i_sb, "clm-9001",
"pinning inode %lu because the "
"preallocation can't be freed",
inode->i_ino);
@@ -397,7 +397,8 @@ static int reiserfs_allocate_blocks_for_
if (res != -ENOSPC) {
reiserfs_warning(inode->
i_sb,
- "green-9008: search_by_key (%K) returned %d",
+ "green-9008",
+ "search_by_key (%K) returned %d",
&key,
res);
}
@@ -599,7 +600,8 @@ static int reiserfs_allocate_blocks_for_
occured, we need to warn user and return error */
if (res != -ENOSPC) {
reiserfs_warning(inode->i_sb,
- "green-9009: search_by_key (%K) "
+ "green-9009",
+ "search_by_key (%K) "
"returned %d", &key,
res);
}
@@ -1015,8 +1017,7 @@ static int reiserfs_prepare_file_region_
int item_pos = -1; /* Position in indirect item */
if (num_pages < 1) {
- reiserfs_warning(inode->i_sb,
- "green-9001: reiserfs_prepare_file_region_for_write "
+ reiserfs_warning(inode->i_sb, "green-9001",
"called with zero number of pages to process");
return -EFAULT;
}
--- a/fs/reiserfs/fix_node.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/fix_node.c 2007-06-11 14:50:09.000000000 -0400
@@ -496,8 +496,8 @@ static int get_num_ver(int mode, struct
snum012[needed_nodes - 1 + 3] = units;
if (needed_nodes > 2)
- reiserfs_warning(tb->tb_sb, "vs-8111: get_num_ver: "
- "split_item_position is out of boundary");
+ reiserfs_warning(tb->tb_sb, "vs-8111",
+ "split_item_position is out of range");
snum012[needed_nodes - 1]++;
split_item_positions[needed_nodes - 1] = i;
needed_nodes++;
@@ -533,8 +533,8 @@ static int get_num_ver(int mode, struct
if (vn->vn_vi[split_item_num].vi_index != TYPE_DIRENTRY &&
vn->vn_vi[split_item_num].vi_index != TYPE_INDIRECT)
- reiserfs_warning(tb->tb_sb, "vs-8115: get_num_ver: not "
- "directory or indirect item");
+ reiserfs_warning(tb->tb_sb, "vs-8115",
+ "not directory or indirect item");
}
/* now we know S2bytes, calculate S1bytes */
@@ -2266,9 +2266,9 @@ static int wait_tb_buffers_until_unlocke
#ifdef CONFIG_REISERFS_CHECK
repeat_counter++;
if ((repeat_counter % 10000) == 0) {
- reiserfs_warning(p_s_tb->tb_sb,
- "wait_tb_buffers_until_released(): too many "
- "iterations waiting for buffer to unlock "
+ reiserfs_warning(p_s_tb->tb_sb, "reiserfs-8200",
+ "too many iterations waiting "
+ "for buffer to unlock "
"(%b)", locked);
/* Don't loop forever. Try to recover from possible error. */
--- a/fs/reiserfs/inode.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/inode.c 2007-06-11 14:50:09.000000000 -0400
@@ -838,7 +838,8 @@ int reiserfs_get_block(struct inode *ino
if (retval) {
if (retval != -ENOSPC)
reiserfs_warning(inode->i_sb,
- "clm-6004: convert tail failed inode %lu, error %d",
+ "clm-6004",
+ "convert tail failed inode %lu, error %d",
inode->i_ino,
retval);
if (allocated_block_nr) {
@@ -1002,8 +1003,7 @@ int reiserfs_get_block(struct inode *ino
goto failure;
}
if (retval == POSITION_FOUND) {
- reiserfs_warning(inode->i_sb,
- "vs-825: reiserfs_get_block: "
+ reiserfs_warning(inode->i_sb, "vs-825",
"%K should not be found", &key);
retval = -EEXIST;
if (allocated_block_nr)
@@ -1328,9 +1328,9 @@ void reiserfs_update_sd_size(struct reis
/* look for the object's stat data */
retval = search_item(inode->i_sb, &key, &path);
if (retval == IO_ERROR) {
- reiserfs_warning(inode->i_sb,
- "vs-13050: reiserfs_update_sd: "
- "i/o failure occurred trying to update %K stat data",
+ reiserfs_warning(inode->i_sb, "vs-13050",
+ "i/o failure occurred trying to "
+ "update %K stat data",
&key);
return;
}
@@ -1341,9 +1341,9 @@ void reiserfs_update_sd_size(struct reis
/*reiserfs_warning (inode->i_sb, "vs-13050: reiserfs_update_sd: i_nlink == 0, stat data not found"); */
return;
}
- reiserfs_warning(inode->i_sb,
- "vs-13060: reiserfs_update_sd: "
- "stat data of object %k (nlink == %d) not found (pos %d)",
+ reiserfs_warning(inode->i_sb, "vs-13060",
+ "stat data of object %k (nlink == %d) "
+ "not found (pos %d)",
INODE_PKEY(inode), inode->i_nlink,
pos);
reiserfs_check_path(&path);
@@ -1420,10 +1420,9 @@ void reiserfs_read_locked_inode(struct i
/* look for the object's stat data */
retval = search_item(inode->i_sb, &key, &path_to_sd);
if (retval == IO_ERROR) {
- reiserfs_warning(inode->i_sb,
- "vs-13070: reiserfs_read_locked_inode: "
- "i/o failure occurred trying to find stat data of %K",
- &key);
+ reiserfs_warning(inode->i_sb, "vs-13070",
+ "i/o failure occurred trying to find "
+ "stat data of %K", &key);
reiserfs_make_bad_inode(inode);
return;
}
@@ -1453,8 +1452,7 @@ void reiserfs_read_locked_inode(struct i
during mount (fs/reiserfs/super.c:finish_unfinished()). */
if ((inode->i_nlink == 0) &&
!REISERFS_SB(inode->i_sb)->s_is_unlinked_ok) {
- reiserfs_warning(inode->i_sb,
- "vs-13075: reiserfs_read_locked_inode: "
+ reiserfs_warning(inode->i_sb, "vs-13075",
"dead inode read from disk %K. "
"This is likely to be race with knfsd. Ignore",
&key);
@@ -1564,9 +1562,9 @@ struct dentry *reiserfs_decode_fh(struct
*/
if (fhtype > len) {
if (fhtype != 6 || len != 5)
- reiserfs_warning(sb,
- "nfsd/reiserfs, fhtype=%d, len=%d - odd",
- fhtype, len);
+ reiserfs_warning(sb, "reiserfs-13077",
+ "nfsd/reiserfs, fhtype=%d, "
+ "len=%d - odd", fhtype, len);
fhtype = 5;
}
@@ -1693,13 +1691,13 @@ static int reiserfs_new_directory(struct
/* look for place in the tree for new item */
retval = search_item(sb, &key, path);
if (retval == IO_ERROR) {
- reiserfs_warning(sb, "vs-13080: reiserfs_new_directory: "
+ reiserfs_warning(sb, "vs-13080",
"i/o failure occurred creating new directory");
return -EIO;
}
if (retval == ITEM_FOUND) {
pathrelse(path);
- reiserfs_warning(sb, "vs-13070: reiserfs_new_directory: "
+ reiserfs_warning(sb, "vs-13070",
"object with this key exists (%k)",
&(ih->ih_key));
return -EEXIST;
@@ -1733,13 +1731,13 @@ static int reiserfs_new_symlink(struct r
/* look for place in the tree for new item */
retval = search_item(sb, &key, path);
if (retval == IO_ERROR) {
- reiserfs_warning(sb, "vs-13080: reiserfs_new_symlinik: "
+ reiserfs_warning(sb, "vs-13080",
"i/o failure occurred creating new symlink");
return -EIO;
}
if (retval == ITEM_FOUND) {
pathrelse(path);
- reiserfs_warning(sb, "vs-13080: reiserfs_new_symlink: "
+ reiserfs_warning(sb, "vs-13080",
"object with this key exists (%k)",
&(ih->ih_key));
return -EEXIST;
@@ -1936,7 +1934,8 @@ int reiserfs_new_inode(struct reiserfs_t
goto out_inserted_sd;
}
} else if (inode->i_sb->s_flags & MS_POSIXACL) {
- reiserfs_warning(inode->i_sb, "ACLs aren't enabled in the fs, "
+ reiserfs_warning(inode->i_sb, "jdm-13090",
+ "ACLs aren't enabled in the fs, "
"but vfs thinks they are!");
} else if (is_reiserfs_priv_object(dir)) {
reiserfs_mark_inode_private(inode);
@@ -2053,8 +2052,8 @@ static int grab_tail_page(struct inode *
** I've screwed up the code to find the buffer, or the code to
** call prepare_write
*/
- reiserfs_warning(p_s_inode->i_sb,
- "clm-6000: error reading block %lu on dev %s",
+ reiserfs_warning(p_s_inode->i_sb, "clm-6000",
+ "error reading block %lu on dev %s",
bh->b_blocknr,
reiserfs_bdevname(p_s_inode->i_sb));
error = -EIO;
@@ -2098,8 +2097,8 @@ int reiserfs_truncate_file(struct inode
// and get_block_create_0 could not find a block to read in,
// which is ok.
if (error != -ENOENT)
- reiserfs_warning(p_s_inode->i_sb,
- "clm-6001: grab_tail_page failed %d",
+ reiserfs_warning(p_s_inode->i_sb, "clm-6001",
+ "grab_tail_page failed %d",
error);
page = NULL;
bh = NULL;
@@ -2217,9 +2216,8 @@ static int map_block_for_writepage(struc
/* we've found an unformatted node */
if (indirect_item_found(retval, ih)) {
if (bytes_copied > 0) {
- reiserfs_warning(inode->i_sb,
- "clm-6002: bytes_copied %d",
- bytes_copied);
+ reiserfs_warning(inode->i_sb, "clm-6002",
+ "bytes_copied %d", bytes_copied);
}
if (!get_block_num(item, pos_in_item)) {
/* crap, we are writing to a hole */
@@ -2276,9 +2274,8 @@ static int map_block_for_writepage(struc
goto research;
}
} else {
- reiserfs_warning(inode->i_sb,
- "clm-6003: bad item inode %lu, device %s",
- inode->i_ino, reiserfs_bdevname(inode->i_sb));
+ reiserfs_warning(inode->i_sb, "clm-6003",
+ "bad item inode %lu", inode->i_ino);
retval = -EIO;
goto out;
}
--- a/fs/reiserfs/item_ops.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/item_ops.c 2007-06-11 14:50:09.000000000 -0400
@@ -97,7 +97,8 @@ static int sd_unit_num(struct virtual_it
static void sd_print_vi(struct virtual_item *vi)
{
- reiserfs_warning(NULL, "STATDATA, index %d, type 0x%x, %h",
+ reiserfs_warning(NULL, "reiserfs-16100",
+ "STATDATA, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
@@ -190,7 +191,8 @@ static int direct_unit_num(struct virtua
static void direct_print_vi(struct virtual_item *vi)
{
- reiserfs_warning(NULL, "DIRECT, index %d, type 0x%x, %h",
+ reiserfs_warning(NULL, "reiserfs-16101",
+ "DIRECT, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
@@ -278,7 +280,7 @@ static void indirect_print_item(struct i
unp = (__le32 *) item;
if (ih_item_len(ih) % UNFM_P_SIZE)
- reiserfs_warning(NULL, "indirect_print_item: invalid item len");
+ reiserfs_warning(NULL, "reiserfs-16102", "invalid item len");
printk("%d pointers\n[ ", (int)I_UNFM_NUM(ih));
for (j = 0; j < I_UNFM_NUM(ih); j++) {
@@ -334,7 +336,8 @@ static int indirect_unit_num(struct virt
static void indirect_print_vi(struct virtual_item *vi)
{
- reiserfs_warning(NULL, "INDIRECT, index %d, type 0x%x, %h",
+ reiserfs_warning(NULL, "reiserfs-16103",
+ "INDIRECT, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
@@ -359,7 +362,7 @@ static struct item_operations indirect_o
static int direntry_bytes_number(struct item_head *ih, int block_size)
{
- reiserfs_warning(NULL, "vs-16090: direntry_bytes_number: "
+ reiserfs_warning(NULL, "vs-16090",
"bytes number is asked for direntry");
return 0;
}
@@ -614,7 +617,8 @@ static void direntry_print_vi(struct vir
int i;
struct direntry_uarea *dir_u = vi->vi_uarea;
- reiserfs_warning(NULL, "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x",
+ reiserfs_warning(NULL, "reiserfs-16104",
+ "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x",
vi->vi_index, vi->vi_type, vi->vi_ih, dir_u->flags);
printk("%d entries: ", dir_u->entry_count);
for (i = 0; i < dir_u->entry_count; i++)
@@ -642,43 +646,43 @@ static struct item_operations direntry_o
//
static int errcatch_bytes_number(struct item_head *ih, int block_size)
{
- reiserfs_warning(NULL,
- "green-16001: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16001",
+ "Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_decrement_key(struct cpu_key *key)
{
- reiserfs_warning(NULL,
- "green-16002: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16002",
+ "Invalid item type observed, run fsck ASAP");
}
static int errcatch_is_left_mergeable(struct reiserfs_key *key,
unsigned long bsize)
{
- reiserfs_warning(NULL,
- "green-16003: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16003",
+ "Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_print_item(struct item_head *ih, char *item)
{
- reiserfs_warning(NULL,
- "green-16004: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16004",
+ "Invalid item type observed, run fsck ASAP");
}
static void errcatch_check_item(struct item_head *ih, char *item)
{
- reiserfs_warning(NULL,
- "green-16005: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16005",
+ "Invalid item type observed, run fsck ASAP");
}
static int errcatch_create_vi(struct virtual_node *vn,
struct virtual_item *vi,
int is_affected, int insert_size)
{
- reiserfs_warning(NULL,
- "green-16006: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16006",
+ "Invalid item type observed, run fsck ASAP");
return 0; // We might return -1 here as well, but it won't help as create_virtual_node() from where
// this operation is called from is of return type void.
}
@@ -686,36 +690,36 @@ static int errcatch_create_vi(struct vir
static int errcatch_check_left(struct virtual_item *vi, int free,
int start_skip, int end_skip)
{
- reiserfs_warning(NULL,
- "green-16007: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16007",
+ "Invalid item type observed, run fsck ASAP");
return -1;
}
static int errcatch_check_right(struct virtual_item *vi, int free)
{
- reiserfs_warning(NULL,
- "green-16008: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16008",
+ "Invalid item type observed, run fsck ASAP");
return -1;
}
static int errcatch_part_size(struct virtual_item *vi, int first, int count)
{
- reiserfs_warning(NULL,
- "green-16009: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16009",
+ "Invalid item type observed, run fsck ASAP");
return 0;
}
static int errcatch_unit_num(struct virtual_item *vi)
{
- reiserfs_warning(NULL,
- "green-16010: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16010",
+ "Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_print_vi(struct virtual_item *vi)
{
- reiserfs_warning(NULL,
- "green-16011: Invalid item type observed, run fsck ASAP");
+ reiserfs_warning(NULL, "green-16011",
+ "Invalid item type observed, run fsck ASAP");
}
static struct item_operations errcatch_ops = {
--- a/fs/reiserfs/journal.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/journal.c 2007-06-11 14:50:09.000000000 -0400
@@ -301,8 +301,8 @@ int reiserfs_allocate_list_bitmaps(struc
jb->journal_list = NULL;
jb->bitmaps = vmalloc(mem);
if (!jb->bitmaps) {
- reiserfs_warning(p_s_sb,
- "clm-2000, unable to allocate bitmaps for journal lists");
+ reiserfs_warning(p_s_sb, "clm-2000", "unable to "
+ "allocate bitmaps for journal lists");
failed = 1;
break;
}
@@ -620,8 +620,8 @@ static void reiserfs_end_buffer_io_sync(
char b[BDEVNAME_SIZE];
if (buffer_journaled(bh)) {
- reiserfs_warning(NULL,
- "clm-2084: pinned buffer %lu:%s sent to disk",
+ reiserfs_warning(NULL, "clm-2084",
+ "pinned buffer %lu:%s sent to disk",
bh->b_blocknr, bdevname(bh->b_bdev, b));
}
if (uptodate)
@@ -1096,7 +1096,8 @@ static int flush_commit_list(struct supe
sync_dirty_buffer(tbh);
if (unlikely(!buffer_uptodate(tbh))) {
#ifdef CONFIG_REISERFS_CHECK
- reiserfs_warning(s, "journal-601, buffer write failed");
+ reiserfs_warning(s, "journal-601",
+ "buffer write failed");
#endif
retval = -EIO;
}
@@ -1128,14 +1129,14 @@ static int flush_commit_list(struct supe
* up propagating the write error out to the filesystem. */
if (unlikely(!buffer_uptodate(jl->j_commit_bh))) {
#ifdef CONFIG_REISERFS_CHECK
- reiserfs_warning(s, "journal-615: buffer write failed");
+ reiserfs_warning(s, "journal-615", "buffer write failed");
#endif
retval = -EIO;
}
bforget(jl->j_commit_bh);
if (journal->j_last_commit_id != 0 &&
(jl->j_trans_id - journal->j_last_commit_id) != 1) {
- reiserfs_warning(s, "clm-2200: last commit %lu, current %lu",
+ reiserfs_warning(s, "clm-2200", "last commit %lu, current %lu",
journal->j_last_commit_id, jl->j_trans_id);
}
journal->j_last_commit_id = jl->j_trans_id;
@@ -1224,7 +1225,7 @@ static void remove_all_from_journal_list
while (cn) {
if (cn->blocknr != 0) {
if (debug) {
- reiserfs_warning(p_s_sb,
+ reiserfs_warning(p_s_sb, "reiserfs-2201",
"block %u, bh is %d, state %ld",
cn->blocknr, cn->bh ? 1 : 0,
cn->state);
@@ -1262,8 +1263,8 @@ static int _update_journal_header_block(
wait_on_buffer((journal->j_header_bh));
if (unlikely(!buffer_uptodate(journal->j_header_bh))) {
#ifdef CONFIG_REISERFS_CHECK
- reiserfs_warning(p_s_sb,
- "journal-699: buffer write failed");
+ reiserfs_warning(p_s_sb, "journal-699",
+ "buffer write failed");
#endif
return -EIO;
}
@@ -1293,8 +1294,8 @@ static int _update_journal_header_block(
sync_dirty_buffer(journal->j_header_bh);
}
if (!buffer_uptodate(journal->j_header_bh)) {
- reiserfs_warning(p_s_sb,
- "journal-837: IO error during journal replay");
+ reiserfs_warning(p_s_sb, "journal-837",
+ "IO error during journal replay");
return -EIO;
}
}
@@ -1375,8 +1376,7 @@ static int flush_journal_list(struct sup
BUG_ON(j_len_saved <= 0);
if (atomic_read(&journal->j_wcount) != 0) {
- reiserfs_warning(s,
- "clm-2048: flush_journal_list called with wcount %d",
+ reiserfs_warning(s, "clm-2048", "called with wcount %d",
atomic_read(&journal->j_wcount));
}
BUG_ON(jl->j_trans_id == 0);
@@ -1484,8 +1484,8 @@ static int flush_journal_list(struct sup
** is not marked JDirty_wait
*/
if ((!was_jwait) && !buffer_locked(saved_bh)) {
- reiserfs_warning(s,
- "journal-813: BAD! buffer %llu %cdirty %cjwait, "
+ reiserfs_warning(s, "journal-813",
+ "BAD! buffer %llu %cdirty %cjwait, "
"not in a newer tranasction",
(unsigned long long)saved_bh->
b_blocknr, was_dirty ? ' ' : '!',
@@ -1503,8 +1503,8 @@ static int flush_journal_list(struct sup
unlock_buffer(saved_bh);
count++;
} else {
- reiserfs_warning(s,
- "clm-2082: Unable to flush buffer %llu in %s",
+ reiserfs_warning(s, "clm-2082",
+ "Unable to flush buffer %llu in %s",
(unsigned long long)saved_bh->
b_blocknr, __FUNCTION__);
}
@@ -1515,8 +1515,8 @@ static int flush_journal_list(struct sup
/* we incremented this to keep others from taking the buffer head away */
put_bh(saved_bh);
if (atomic_read(&(saved_bh->b_count)) < 0) {
- reiserfs_warning(s,
- "journal-945: saved_bh->b_count < 0");
+ reiserfs_warning(s, "journal-945",
+ "saved_bh->b_count < 0");
}
}
}
@@ -1535,8 +1535,8 @@ static int flush_journal_list(struct sup
}
if (unlikely(!buffer_uptodate(cn->bh))) {
#ifdef CONFIG_REISERFS_CHECK
- reiserfs_warning(s,
- "journal-949: buffer write failed\n");
+ reiserfs_warning(s, "journal-949",
+ "buffer write failed");
#endif
err = -EIO;
}
@@ -1596,7 +1596,7 @@ static int flush_journal_list(struct sup
if (journal->j_last_flush_id != 0 &&
(jl->j_trans_id - journal->j_last_flush_id) != 1) {
- reiserfs_warning(s, "clm-2201: last flush %lu, current %lu",
+ reiserfs_warning(s, "clm-2201", "last flush %lu, current %lu",
journal->j_last_flush_id, jl->j_trans_id);
}
journal->j_last_flush_id = jl->j_trans_id;
@@ -2031,8 +2031,9 @@ static int journal_transaction_is_valid(
return -1;
}
if (get_desc_trans_len(desc) > SB_JOURNAL(p_s_sb)->j_trans_max) {
- reiserfs_warning(p_s_sb,
- "journal-2018: Bad transaction length %d encountered, ignoring transaction",
+ reiserfs_warning(p_s_sb, "journal-2018",
+ "Bad transaction length %d "
+ "encountered, ignoring transaction",
get_desc_trans_len(desc));
return -1;
}
@@ -2168,8 +2169,8 @@ static int journal_read_transaction(stru
brelse(d_bh);
kfree(log_blocks);
kfree(real_blocks);
- reiserfs_warning(p_s_sb,
- "journal-1169: kmalloc failed, unable to mount FS");
+ reiserfs_warning(p_s_sb, "journal-1169",
+ "kmalloc failed, unable to mount FS");
return -1;
}
/* get all the buffer heads */
@@ -2191,15 +2192,18 @@ static int journal_read_transaction(stru
j_realblock[i - trans_half]));
}
if (real_blocks[i]->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) {
- reiserfs_warning(p_s_sb,
- "journal-1207: REPLAY FAILURE fsck required! Block to replay is outside of filesystem");
+ reiserfs_warning(p_s_sb, "journal-1207",
+ "REPLAY FAILURE fsck required! "
+ "Block to replay is outside of "
+ "filesystem");
goto abort_replay;
}
/* make sure we don't try to replay onto log or reserved area */
if (is_block_in_log_or_reserved_area
(p_s_sb, real_blocks[i]->b_blocknr)) {
- reiserfs_warning(p_s_sb,
- "journal-1204: REPLAY FAILURE fsck required! Trying to replay onto a log block");
+ reiserfs_warning(p_s_sb, "journal-1204",
+ "REPLAY FAILURE fsck required! "
+ "Trying to replay onto a log block");
abort_replay:
brelse_array(log_blocks, i);
brelse_array(real_blocks, i);
@@ -2215,8 +2219,9 @@ static int journal_read_transaction(stru
for (i = 0; i < get_desc_trans_len(desc); i++) {
wait_on_buffer(log_blocks[i]);
if (!buffer_uptodate(log_blocks[i])) {
- reiserfs_warning(p_s_sb,
- "journal-1212: REPLAY FAILURE fsck required! buffer write failed");
+ reiserfs_warning(p_s_sb, "journal-1212",
+ "REPLAY FAILURE fsck required! "
+ "buffer write failed");
brelse_array(log_blocks + i,
get_desc_trans_len(desc) - i);
brelse_array(real_blocks, get_desc_trans_len(desc));
@@ -2239,8 +2244,9 @@ static int journal_read_transaction(stru
for (i = 0; i < get_desc_trans_len(desc); i++) {
wait_on_buffer(real_blocks[i]);
if (!buffer_uptodate(real_blocks[i])) {
- reiserfs_warning(p_s_sb,
- "journal-1226: REPLAY FAILURE, fsck required! buffer write failed");
+ reiserfs_warning(p_s_sb, "journal-1226",
+ "REPLAY FAILURE, fsck required! "
+ "buffer write failed");
brelse_array(real_blocks + i,
get_desc_trans_len(desc) - i);
brelse(c_bh);
@@ -2390,8 +2396,8 @@ static int journal_read(struct super_blo
}
if (continue_replay && bdev_read_only(p_s_sb->s_bdev)) {
- reiserfs_warning(p_s_sb,
- "clm-2076: device is readonly, unable to replay log");
+ reiserfs_warning(p_s_sb, "clm-2076",
+ "device is readonly, unable to replay log");
return -1;
}
@@ -2554,9 +2560,8 @@ static int release_journal_dev(struct su
}
if (result != 0) {
- reiserfs_warning(super,
- "sh-457: release_journal_dev: Cannot release journal device: %i",
- result);
+ reiserfs_warning(super, "sh-457",
+ "Cannot release journal device: %i", result);
}
return result;
}
@@ -2586,7 +2591,7 @@ static int journal_init_dev(struct super
if (IS_ERR(journal->j_dev_bd)) {
result = PTR_ERR(journal->j_dev_bd);
journal->j_dev_bd = NULL;
- reiserfs_warning(super, "sh-458: journal_init_dev: "
+ reiserfs_warning(super, "sh-458",
"cannot init journal device '%s': %i",
__bdevname(jdev, b), result);
return result;
@@ -2599,7 +2604,7 @@ static int journal_init_dev(struct super
if (!IS_ERR(journal->j_dev_file)) {
struct inode *jdev_inode = journal->j_dev_file->f_mapping->host;
if (!S_ISBLK(jdev_inode->i_mode)) {
- reiserfs_warning(super, "journal_init_dev: '%s' is "
+ reiserfs_warning(super, "reiserfs-459", "'%s' is "
"not a block device", jdev_name);
result = -ENOTBLK;
release_journal_dev(super, journal);
@@ -2614,8 +2619,7 @@ static int journal_init_dev(struct super
} else {
result = PTR_ERR(journal->j_dev_file);
journal->j_dev_file = NULL;
- reiserfs_warning(super,
- "journal_init_dev: Cannot open '%s': %i",
+ reiserfs_warning(super, "reiserfs-460", "Cannot open '%s': %i",
jdev_name, result);
}
return result;
@@ -2637,8 +2641,8 @@ int journal_init(struct super_block *p_s
journal = SB_JOURNAL(p_s_sb) = vmalloc(sizeof(struct reiserfs_journal));
if (!journal) {
- reiserfs_warning(p_s_sb,
- "journal-1256: unable to get memory for journal structure");
+ reiserfs_warning(p_s_sb, "journal-1256",
+ "unable to get memory for journal structure");
return 1;
}
memset(journal, 0, sizeof(struct reiserfs_journal));
@@ -2667,9 +2671,9 @@ int journal_init(struct super_block *p_s
if (!SB_ONDISK_JOURNAL_DEVICE(p_s_sb) &&
(SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb) +
SB_ONDISK_JOURNAL_SIZE(p_s_sb) > p_s_sb->s_blocksize * 8)) {
- reiserfs_warning(p_s_sb,
- "journal-1393: journal does not fit for area "
- "addressed by first of bitmap blocks. It starts at "
+ reiserfs_warning(p_s_sb, "journal-1393",
+ "journal does not fit for area addressed "
+ "by first of bitmap blocks. It starts at "
"%u and its size is %u. Block size %ld",
SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb),
SB_ONDISK_JOURNAL_SIZE(p_s_sb),
@@ -2678,8 +2682,8 @@ int journal_init(struct super_block *p_s
}
if (journal_init_dev(p_s_sb, journal, j_dev_name) != 0) {
- reiserfs_warning(p_s_sb,
- "sh-462: unable to initialize jornal device");
+ reiserfs_warning(p_s_sb, "sh-462",
+ "unable to initialize jornal device");
goto free_and_return;
}
@@ -2690,8 +2694,8 @@ int journal_init(struct super_block *p_s
SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) +
SB_ONDISK_JOURNAL_SIZE(p_s_sb));
if (!bhjh) {
- reiserfs_warning(p_s_sb,
- "sh-459: unable to read journal header");
+ reiserfs_warning(p_s_sb, "sh-459",
+ "unable to read journal header");
goto free_and_return;
}
jh = (struct reiserfs_journal_header *)(bhjh->b_data);
@@ -2700,10 +2704,10 @@ int journal_init(struct super_block *p_s
if (is_reiserfs_jr(rs)
&& (le32_to_cpu(jh->jh_journal.jp_journal_magic) !=
sb_jp_journal_magic(rs))) {
- reiserfs_warning(p_s_sb,
- "sh-460: journal header magic %x "
- "(device %s) does not match to magic found in super "
- "block %x", jh->jh_journal.jp_journal_magic,
+ reiserfs_warning(p_s_sb, "sh-460",
+ "journal header magic %x (device %s) does "
+ "not match to magic found in super block %x",
+ jh->jh_journal.jp_journal_magic,
bdevname(journal->j_dev_bd, b),
sb_jp_journal_magic(rs));
brelse(bhjh);
@@ -2736,8 +2740,9 @@ int journal_init(struct super_block *p_s
JOURNAL_TRANS_MIN_DEFAULT / ratio;
if (journal->j_trans_max != initial)
- reiserfs_warning(p_s_sb,
- "sh-461: journal_init: wrong transaction max size (%u). Changed to %u",
+ reiserfs_warning(p_s_sb, "sh-461",
+ "wrong transaction max size (%u). "
+ "Changed to %u",
initial, journal->j_trans_max);
journal->j_max_batch = journal->j_trans_max *
@@ -2811,7 +2816,7 @@ int journal_init(struct super_block *p_s
journal->j_must_wait = 0;
if (journal->j_cnode_free == 0) {
- reiserfs_warning(p_s_sb, "journal-2004: Journal cnode memory "
+ reiserfs_warning(p_s_sb, "journal-2004", "Journal cnode memory "
"allocation failed (%ld bytes). Journal is "
"too large for available memory. Usually "
"this is due to a journal that is too large.",
@@ -2823,12 +2828,13 @@ int journal_init(struct super_block *p_s
jl = journal->j_current_jl;
jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl);
if (!jl->j_list_bitmap) {
- reiserfs_warning(p_s_sb,
- "journal-2005, get_list_bitmap failed for journal list 0");
+ reiserfs_warning(p_s_sb, "journal-2005",
+ "get_list_bitmap failed for journal list 0");
goto free_and_return;
}
if (journal_read(p_s_sb) < 0) {
- reiserfs_warning(p_s_sb, "Replay Failure, unable to mount");
+ reiserfs_warning(p_s_sb, "reiserfs-2006",
+ "Replay Failure, unable to mount");
goto free_and_return;
}
@@ -3155,16 +3161,17 @@ int journal_begin(struct reiserfs_transa
cur_th->t_refcount++;
memcpy(th, cur_th, sizeof(*th));
if (th->t_refcount <= 1)
- reiserfs_warning(p_s_sb,
- "BAD: refcount <= 1, but journal_info != 0");
+ reiserfs_warning(p_s_sb, "reiserfs-2005",
+ "BAD: refcount <= 1, but "
+ "journal_info != 0");
return 0;
} else {
/* we've ended up with a handle from a different filesystem.
** save it and restore on journal_end. This should never
** really happen...
*/
- reiserfs_warning(p_s_sb,
- "clm-2100: nesting info a different FS");
+ reiserfs_warning(p_s_sb, "clm-2100",
+ "nesting info a different FS");
th->t_handle_save = current->journal_info;
current->journal_info = th;
}
@@ -3225,7 +3232,8 @@ int journal_mark_dirty(struct reiserfs_t
** could get to disk too early. NOT GOOD.
*/
if (!prepared || buffer_dirty(bh)) {
- reiserfs_warning(p_s_sb, "journal-1777: buffer %llu bad state "
+ reiserfs_warning(p_s_sb, "journal-1777",
+ "buffer %llu bad state "
"%cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT",
(unsigned long long)bh->b_blocknr,
prepared ? ' ' : '!',
@@ -3235,8 +3243,8 @@ int journal_mark_dirty(struct reiserfs_t
}
if (atomic_read(&(journal->j_wcount)) <= 0) {
- reiserfs_warning(p_s_sb,
- "journal-1409: journal_mark_dirty returning because j_wcount was %d",
+ reiserfs_warning(p_s_sb, "journal-1409",
+ "returning because j_wcount was %d",
atomic_read(&(journal->j_wcount)));
return 1;
}
@@ -3301,8 +3309,8 @@ int journal_end(struct reiserfs_transact
struct super_block *p_s_sb, unsigned long nblocks)
{
if (!current->journal_info && th->t_refcount > 1)
- reiserfs_warning(p_s_sb, "REISER-NESTING: th NULL, refcount %d",
- th->t_refcount);
+ reiserfs_warning(p_s_sb, "REISER-NESTING",
+ "th NULL, refcount %d", th->t_refcount);
if (!th->t_trans_id) {
WARN_ON(1);
@@ -3372,8 +3380,8 @@ static int remove_from_transaction(struc
clear_buffer_journal_test(bh);
put_bh(bh);
if (atomic_read(&(bh->b_count)) < 0) {
- reiserfs_warning(p_s_sb,
- "journal-1752: remove from trans, b_count < 0");
+ reiserfs_warning(p_s_sb, "journal-1752",
+ "b_count < 0");
}
ret = 1;
}
@@ -3693,7 +3701,8 @@ int journal_mark_freed(struct reiserfs_t
if (atomic_read
(&(cn->bh->b_count)) < 0) {
reiserfs_warning(p_s_sb,
- "journal-2138: cn->bh->b_count < 0");
+ "journal-2138",
+ "cn->bh->b_count < 0");
}
}
if (cn->jlist) { /* since we are clearing the bh, we MUST dec nonzerolen */
@@ -3711,8 +3720,8 @@ int journal_mark_freed(struct reiserfs_t
if (bh) {
put_bh(bh); /* get_hash grabs the buffer */
if (atomic_read(&(bh->b_count)) < 0) {
- reiserfs_warning(p_s_sb,
- "journal-2165: bh->b_count < 0");
+ reiserfs_warning(p_s_sb, "journal-2165",
+ "bh->b_count < 0");
}
}
return 0;
@@ -4101,8 +4110,9 @@ static int do_journal_end(struct reiserf
clear_buffer_journaled(cn->bh);
} else {
/* JDirty cleared sometime during transaction. don't log this one */
- reiserfs_warning(p_s_sb,
- "journal-2048: do_journal_end: BAD, buffer in journal hash, but not JDirty!");
+ reiserfs_warning(p_s_sb, "journal-2048",
+ "BAD, buffer in journal hash, "
+ "but not JDirty!");
brelse(cn->bh);
}
next = cn->next;
--- a/fs/reiserfs/lbalance.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/lbalance.c 2007-06-11 14:50:09.000000000 -0400
@@ -1287,12 +1287,16 @@ void leaf_paste_entries(struct buffer_he
prev = (i != 0) ? deh_location(&(deh[i - 1])) : 0;
if (prev && prev <= deh_location(&(deh[i])))
- reiserfs_warning(NULL,
- "vs-10240: leaf_paste_entries: directory item (%h) corrupted (prev %a, cur(%d) %a)",
+ reiserfs_warning(NULL, "vs-10240",
+ "directory item (%h) "
+ "corrupted (prev %a, "
+ "cur(%d) %a)",
ih, deh + i - 1, i, deh + i);
if (next && next >= deh_location(&(deh[i])))
- reiserfs_warning(NULL,
- "vs-10250: leaf_paste_entries: directory item (%h) corrupted (cur(%d) %a, next %a)",
+ reiserfs_warning(NULL, "vs-10250",
+ "directory item (%h) "
+ "corrupted (cur(%d) %a, "
+ "next %a)",
ih, i, deh + i, deh + i + 1);
}
}
--- a/fs/reiserfs/namei.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/namei.c 2007-06-11 14:50:09.000000000 -0400
@@ -120,8 +120,8 @@ int search_by_entry_key(struct super_blo
switch (retval) {
case ITEM_NOT_FOUND:
if (!PATH_LAST_POSITION(path)) {
- reiserfs_warning(sb,
- "vs-7000: search_by_entry_key: search_by_key returned item position == 0");
+ reiserfs_warning(sb, "vs-7000", "search_by_key "
+ "returned item position == 0");
pathrelse(path);
return IO_ERROR;
}
@@ -135,8 +135,7 @@ int search_by_entry_key(struct super_blo
default:
pathrelse(path);
- reiserfs_warning(sb,
- "vs-7002: search_by_entry_key: no path to here");
+ reiserfs_warning(sb, "vs-7002", "no path to here");
return IO_ERROR;
}
@@ -300,8 +299,7 @@ static int reiserfs_find_entry(struct in
search_by_entry_key(dir->i_sb, &key_to_search,
path_to_entry, de);
if (retval == IO_ERROR) {
- reiserfs_warning(dir->i_sb, "zam-7001: io error in %s",
- __FUNCTION__);
+ reiserfs_warning(dir->i_sb, "zam-7001", "io error");
return IO_ERROR;
}
@@ -493,10 +491,9 @@ static int reiserfs_add_entry(struct rei
}
if (retval != NAME_FOUND) {
- reiserfs_warning(dir->i_sb,
- "zam-7002:%s: \"reiserfs_find_entry\" "
- "has returned unexpected value (%d)",
- __FUNCTION__, retval);
+ reiserfs_warning(dir->i_sb, "zam-7002",
+ "reiserfs_find_entry() returned "
+ "unexpected value (%d)", retval);
}
return -EEXIST;
@@ -507,8 +504,9 @@ static int reiserfs_add_entry(struct rei
MAX_GENERATION_NUMBER + 1);
if (gen_number > MAX_GENERATION_NUMBER) {
/* there is no free generation number */
- reiserfs_warning(dir->i_sb,
- "reiserfs_add_entry: Congratulations! we have got hash function screwed up");
+ reiserfs_warning(dir->i_sb, "reiserfs-7010",
+ "Congratulations! we have got hash function "
+ "screwed up");
if (buffer != small_buf)
kfree(buffer);
pathrelse(&path);
@@ -524,10 +522,9 @@ static int reiserfs_add_entry(struct rei
if (gen_number != 0) { /* we need to re-search for the insertion point */
if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) !=
NAME_NOT_FOUND) {
- reiserfs_warning(dir->i_sb,
- "vs-7032: reiserfs_add_entry: "
- "entry with this key (%K) already exists",
- &entry_key);
+ reiserfs_warning(dir->i_sb, "vs-7032",
+ "entry with this key (%K) already "
+ "exists", &entry_key);
if (buffer != small_buf)
kfree(buffer);
@@ -906,8 +903,9 @@ static int reiserfs_rmdir(struct inode *
goto end_rmdir;
if (inode->i_nlink != 2 && inode->i_nlink != 1)
- reiserfs_warning(inode->i_sb, "%s: empty directory has nlink "
- "!= 2 (%d)", __FUNCTION__, inode->i_nlink);
+ reiserfs_warning(inode->i_sb, "reiserfs-7040",
+ "empty directory has nlink != 2 (%d)",
+ inode->i_nlink);
clear_nlink(inode);
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
@@ -983,10 +981,9 @@ static int reiserfs_unlink(struct inode
}
if (!inode->i_nlink) {
- reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file "
- "(%s:%lu), %d", __FUNCTION__,
- reiserfs_bdevname(inode->i_sb), inode->i_ino,
- inode->i_nlink);
+ reiserfs_warning(inode->i_sb, "reiserfs-7042",
+ "deleting nonexistent file (%lu), %d",
+ inode->i_ino, inode->i_nlink);
inode->i_nlink = 1;
}
@@ -1500,8 +1497,8 @@ static int reiserfs_rename(struct inode
if (reiserfs_cut_from_item
(&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
0) < 0)
- reiserfs_warning(old_dir->i_sb,
- "vs-7060: reiserfs_rename: couldn't not cut old name. Fsck later?");
+ reiserfs_warning(old_dir->i_sb, "vs-7060",
+ "couldn't not cut old name. Fsck later?");
old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
--- a/fs/reiserfs/objectid.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/objectid.c 2007-06-11 14:50:09.000000000 -0400
@@ -61,7 +61,7 @@ __u32 reiserfs_get_unused_objectid(struc
/* comment needed -Hans */
unused_objectid = le32_to_cpu(map[1]);
if (unused_objectid == U32_MAX) {
- reiserfs_warning(s, "%s: no more object ids", __FUNCTION__);
+ reiserfs_warning(s, "reiserfs-15100", "no more object ids");
reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s));
return 0;
}
@@ -161,8 +161,7 @@ void reiserfs_release_objectid(struct re
i += 2;
}
- reiserfs_warning(s,
- "vs-15011: reiserfs_release_objectid: tried to free free object id (%lu)",
+ reiserfs_warning(s, "vs-15011", "tried to free free object id (%lu)",
(long unsigned)objectid_to_release);
}
--- a/fs/reiserfs/prints.c 2007-06-11 14:49:33.000000000 -0400
+++ b/fs/reiserfs/prints.c 2007-06-11 14:50:09.000000000 -0400
@@ -264,14 +264,17 @@ static void prepare_error_buf(const char
va_end( args );\
}
-void reiserfs_warning(struct super_block *sb, const char *fmt, ...)
+void __reiserfs_warning(struct super_block *sb, const char *id,
+ const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
if (sb)
- printk(KERN_WARNING "REISERFS warning (device %s): %s\n",
- sb->s_id, error_buf);
+ printk(KERN_WARNING "REISERFS warning (device %s): %s%s%s: %s\n",
+ sb->s_id, id ? id : "", id ? " " : "",
+ function, error_buf);
else
- printk(KERN_WARNING "REISERFS warning: %s\n", error_buf);
+ printk(KERN_WARNING "REISERFS warning: %s%s%s: %s\n",
+ id ? id : "", id ? " " : "", function, error_buf);
}
/* No newline.. reiserfs_info calls can be followed by printk's */
--- a/fs/reiserfs/procfs.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/procfs.c 2007-06-11 14:50:04.000000000 -0400
@@ -514,7 +514,7 @@ int reiserfs_proc_info_init(struct super
add_file(sb, "journal", show_journal);
return 0;
}
- reiserfs_warning(sb, "reiserfs: cannot create /proc/%s/%s",
+ reiserfs_warning(sb, "cannot create /proc/%s/%s",
proc_info_root_name, b);
return 1;
}
@@ -570,8 +570,7 @@ int reiserfs_proc_info_global_init(void)
if (proc_info_root) {
proc_info_root->owner = THIS_MODULE;
} else {
- reiserfs_warning(NULL,
- "reiserfs: cannot create /proc/%s",
+ reiserfs_warning(NULL, "cannot create /proc/%s",
proc_info_root_name);
return 1;
}
--- a/fs/reiserfs/stree.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/stree.c 2007-06-11 14:50:09.000000000 -0400
@@ -444,23 +444,24 @@ static int is_leaf(char *buf, int blocks
blkh = (struct block_head *)buf;
if (blkh_level(blkh) != DISK_LEAF_NODE_LEVEL) {
- reiserfs_warning(NULL,
- "is_leaf: this should be caught earlier");
+ reiserfs_warning(NULL, "reiserfs-5080",
+ "this should be caught earlier");
return 0;
}
nr = blkh_nr_item(blkh);
if (nr < 1 || nr > ((blocksize - BLKH_SIZE) / (IH_SIZE + MIN_ITEM_LEN))) {
/* item number is too big or too small */
- reiserfs_warning(NULL, "is_leaf: nr_item seems wrong: %z", bh);
+ reiserfs_warning(NULL, "reiserfs-5081",
+ "nr_item seems wrong: %z", bh);
return 0;
}
ih = (struct item_head *)(buf + BLKH_SIZE) + nr - 1;
used_space = BLKH_SIZE + IH_SIZE * nr + (blocksize - ih_location(ih));
if (used_space != blocksize - blkh_free_space(blkh)) {
/* free space does not match to calculated amount of use space */
- reiserfs_warning(NULL, "is_leaf: free space seems wrong: %z",
- bh);
+ reiserfs_warning(NULL, "reiserfs-5082",
+ "free space seems wrong: %z", bh);
return 0;
}
// FIXME: it is_leaf will hit performance too much - we may have
@@ -471,29 +472,29 @@ static int is_leaf(char *buf, int blocks
prev_location = blocksize;
for (i = 0; i < nr; i++, ih++) {
if (le_ih_k_type(ih) == TYPE_ANY) {
- reiserfs_warning(NULL,
- "is_leaf: wrong item type for item %h",
+ reiserfs_warning(NULL, "reiserfs-5083",
+ "wrong item type for item %h",
ih);
return 0;
}
if (ih_location(ih) >= blocksize
|| ih_location(ih) < IH_SIZE * nr) {
- reiserfs_warning(NULL,
- "is_leaf: item location seems wrong: %h",
+ reiserfs_warning(NULL, "reiserfs-5084",
+ "item location seems wrong: %h",
ih);
return 0;
}
if (ih_item_len(ih) < 1
|| ih_item_len(ih) > MAX_ITEM_LEN(blocksize)) {
- reiserfs_warning(NULL,
- "is_leaf: item length seems wrong: %h",
+ reiserfs_warning(NULL, "reiserfs-5085",
+ "item length seems wrong: %h",
ih);
return 0;
}
if (prev_location - ih_location(ih) != ih_item_len(ih)) {
- reiserfs_warning(NULL,
- "is_leaf: item location seems wrong (second one): %h",
- ih);
+ reiserfs_warning(NULL, "reiserfs-5086",
+ "item location seems wrong "
+ "(second one): %h", ih);
return 0;
}
prev_location = ih_location(ih);
@@ -514,24 +515,23 @@ static int is_internal(char *buf, int bl
nr = blkh_level(blkh);
if (nr <= DISK_LEAF_NODE_LEVEL || nr > MAX_HEIGHT) {
/* this level is not possible for internal nodes */
- reiserfs_warning(NULL,
- "is_internal: this should be caught earlier");
+ reiserfs_warning(NULL, "reiserfs-5087",
+ "this should be caught earlier");
return 0;
}
nr = blkh_nr_item(blkh);
if (nr > (blocksize - BLKH_SIZE - DC_SIZE) / (KEY_SIZE + DC_SIZE)) {
/* for internal which is not root we might check min number of keys */
- reiserfs_warning(NULL,
- "is_internal: number of key seems wrong: %z",
- bh);
+ reiserfs_warning(NULL, "reiserfs-5088",
+ "number of key seems wrong: %z", bh);
return 0;
}
used_space = BLKH_SIZE + KEY_SIZE * nr + DC_SIZE * (nr + 1);
if (used_space != blocksize - blkh_free_space(blkh)) {
- reiserfs_warning(NULL,
- "is_internal: free space seems wrong: %z", bh);
+ reiserfs_warning(NULL, "reiserfs-5089",
+ "free space seems wrong: %z", bh);
return 0;
}
// one may imagine much more checks
@@ -543,8 +543,8 @@ static int is_internal(char *buf, int bl
static int is_tree_node(struct buffer_head *bh, int level)
{
if (B_LEVEL(bh) != level) {
- reiserfs_warning(NULL,
- "is_tree_node: node level %d does not match to the expected one %d",
+ reiserfs_warning(NULL, "reiserfs-5090", "node level %d does "
+ "not match to the expected one %d",
B_LEVEL(bh), level);
return 0;
}
@@ -645,9 +645,9 @@ int search_by_key(struct super_block *p_
#ifdef CONFIG_REISERFS_CHECK
if (!(++n_repeat_counter % 50000))
- reiserfs_warning(p_s_sb, "PAP-5100: search_by_key: %s:"
- "there were %d iterations of while loop "
- "looking for key %K",
+ reiserfs_warning(p_s_sb, "PAP-5100",
+ "%s: there were %d iterations of "
+ "while loop looking for key %K",
current->comm, n_repeat_counter,
p_s_key);
#endif
@@ -721,9 +721,9 @@ int search_by_key(struct super_block *p_
// make sure, that the node contents look like a node of
// certain level
if (!is_tree_node(p_s_bh, expected_level)) {
- reiserfs_warning(p_s_sb, "vs-5150: search_by_key: "
- "invalid format found in block %ld. Fsck?",
- p_s_bh->b_blocknr);
+ reiserfs_warning(p_s_sb, "vs-5150",
+ "invalid format found in block %ld. "
+ "Fsck?", p_s_bh->b_blocknr);
pathrelse(p_s_search_path);
return IO_ERROR;
}
@@ -1226,8 +1226,7 @@ int reiserfs_delete_item(struct reiserfs
if (n_ret_value == IO_ERROR)
break;
if (n_ret_value == FILE_NOT_FOUND) {
- reiserfs_warning(p_s_sb,
- "vs-5340: reiserfs_delete_item: "
+ reiserfs_warning(p_s_sb, "vs-5340",
"no items of the file %K found",
p_s_item_key);
break;
@@ -1337,10 +1336,9 @@ void reiserfs_delete_solid_item(struct r
while (1) {
retval = search_item(th->t_super, &cpu_key, &path);
if (retval == IO_ERROR) {
- reiserfs_warning(th->t_super,
- "vs-5350: reiserfs_delete_solid_item: "
- "i/o failure occurred trying to delete %K",
- &cpu_key);
+ reiserfs_warning(th->t_super, "vs-5350",
+ "i/o failure occurred trying "
+ "to delete %K", &cpu_key);
break;
}
if (retval != ITEM_FOUND) {
@@ -1354,9 +1352,8 @@ void reiserfs_delete_solid_item(struct r
GET_GENERATION_NUMBER(le_key_k_offset
(le_key_version(key),
key)) == 1))
- reiserfs_warning(th->t_super,
- "vs-5355: reiserfs_delete_solid_item: %k not found",
- key);
+ reiserfs_warning(th->t_super, "vs-5355",
+ "%k not found", key);
break;
}
if (!tb_init) {
@@ -1388,8 +1385,7 @@ void reiserfs_delete_solid_item(struct r
break;
}
// IO_ERROR, NO_DISK_SPACE, etc
- reiserfs_warning(th->t_super,
- "vs-5360: reiserfs_delete_solid_item: "
+ reiserfs_warning(th->t_super, "vs-5360",
"could not delete %K due to fix_nodes failure",
&cpu_key);
unfix_nodes(&tb);
@@ -1536,8 +1532,9 @@ static void indirect_to_direct_roll_back
set_cpu_key_k_offset(&tail_key,
cpu_key_k_offset(&tail_key) - removed);
}
- reiserfs_warning(inode->i_sb,
- "indirect_to_direct_roll_back: indirect_to_direct conversion has been rolled back due to lack of disk space");
+ reiserfs_warning(inode->i_sb, "reiserfs-5091", "indirect_to_direct "
+ "conversion has been rolled back due to "
+ "lack of disk space");
//mark_file_without_tail (inode);
mark_inode_dirty(inode);
}
@@ -1642,8 +1639,7 @@ int reiserfs_cut_from_item(struct reiser
if (n_ret_value == POSITION_FOUND)
continue;
- reiserfs_warning(p_s_sb,
- "PAP-5610: reiserfs_cut_from_item: item %K not found",
+ reiserfs_warning(p_s_sb, "PAP-5610", "item %K not found",
p_s_item_key);
unfix_nodes(&s_cut_balance);
return (n_ret_value == IO_ERROR) ? -EIO : -ENOENT;
@@ -1657,7 +1653,8 @@ int reiserfs_cut_from_item(struct reiser
indirect_to_direct_roll_back(th, p_s_inode, p_s_path);
}
if (n_ret_value == NO_DISK_SPACE)
- reiserfs_warning(p_s_sb, "NO_DISK_SPACE");
+ reiserfs_warning(p_s_sb, "reiserfs-5092",
+ "NO_DISK_SPACE");
unfix_nodes(&s_cut_balance);
return -EIO;
}
@@ -1746,8 +1743,7 @@ static void truncate_directory(struct re
{
BUG_ON(!th->t_trans_id);
if (inode->i_nlink)
- reiserfs_warning(inode->i_sb,
- "vs-5655: truncate_directory: link count != 0");
+ reiserfs_warning(inode->i_sb, "vs-5655", "link count != 0");
set_le_key_k_offset(KEY_FORMAT_3_5, INODE_PKEY(inode), DOT_OFFSET);
set_le_key_k_type(KEY_FORMAT_3_5, INODE_PKEY(inode), TYPE_DIRENTRY);
@@ -1800,16 +1796,14 @@ int reiserfs_do_truncate(struct reiserfs
search_for_position_by_key(p_s_inode->i_sb, &s_item_key,
&s_search_path);
if (retval == IO_ERROR) {
- reiserfs_warning(p_s_inode->i_sb,
- "vs-5657: reiserfs_do_truncate: "
+ reiserfs_warning(p_s_inode->i_sb, "vs-5657",
"i/o failure occurred trying to truncate %K",
&s_item_key);
err = -EIO;
goto out;
}
if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) {
- reiserfs_warning(p_s_inode->i_sb,
- "PAP-5660: reiserfs_do_truncate: "
+ reiserfs_warning(p_s_inode->i_sb, "PAP-5660",
"wrong result %d of search for %K", retval,
&s_item_key);
@@ -1853,8 +1847,8 @@ int reiserfs_do_truncate(struct reiserfs
reiserfs_cut_from_item(th, &s_search_path, &s_item_key,
p_s_inode, page, n_new_file_size);
if (n_deleted < 0) {
- reiserfs_warning(p_s_inode->i_sb,
- "vs-5665: reiserfs_do_truncate: reiserfs_cut_from_item failed");
+ reiserfs_warning(p_s_inode->i_sb, "vs-5665",
+ "reiserfs_cut_from_item failed");
reiserfs_check_path(&s_search_path);
return 0;
}
@@ -2003,8 +1997,8 @@ int reiserfs_paste_into_item(struct reis
goto error_out;
}
if (retval == POSITION_FOUND) {
- reiserfs_warning(inode->i_sb,
- "PAP-5710: reiserfs_paste_into_item: entry or pasted byte (%K) exists",
+ reiserfs_warning(inode->i_sb, "PAP-5710",
+ "entry or pasted byte (%K) exists",
p_s_key);
retval = -EEXIST;
goto error_out;
@@ -2090,8 +2084,7 @@ int reiserfs_insert_item(struct reiserfs
goto error_out;
}
if (retval == ITEM_FOUND) {
- reiserfs_warning(th->t_super,
- "PAP-5760: reiserfs_insert_item: "
+ reiserfs_warning(th->t_super, "PAP-5760",
"key %K already exists in the tree",
key);
retval = -EEXIST;
--- a/fs/reiserfs/super.c 2007-06-11 14:49:33.000000000 -0400
+++ b/fs/reiserfs/super.c 2007-06-11 14:50:08.000000000 -0400
@@ -178,9 +178,9 @@ static int finish_unfinished(struct supe
if (REISERFS_SB(s)->s_qf_names[i]) {
int ret = reiserfs_quota_on_mount(s, i);
if (ret < 0)
- reiserfs_warning(s,
- "reiserfs: cannot turn on journalled quota: error %d",
- ret);
+ reiserfs_warning(s, "reiserfs-2500",
+ "cannot turn on journalled "
+ "quota: error %d", ret);
}
}
#endif
@@ -190,8 +190,8 @@ static int finish_unfinished(struct supe
while (!retval) {
retval = search_item(s, &max_cpu_key, &path);
if (retval != ITEM_NOT_FOUND) {
- reiserfs_warning(s,
- "vs-2140: finish_unfinished: search_by_key returned %d",
+ reiserfs_warning(s, "vs-2140",
+ "search_by_key returned %d",
retval);
break;
}
@@ -199,8 +199,8 @@ static int finish_unfinished(struct supe
bh = get_last_bh(&path);
item_pos = get_item_pos(&path);
if (item_pos != B_NR_ITEMS(bh)) {
- reiserfs_warning(s,
- "vs-2060: finish_unfinished: wrong position found");
+ reiserfs_warning(s, "vs-2060",
+ "wrong position found");
break;
}
item_pos--;
@@ -230,8 +230,7 @@ static int finish_unfinished(struct supe
if (!inode) {
/* the unlink almost completed, it just did not manage to remove
"save" link and release objectid */
- reiserfs_warning(s,
- "vs-2180: finish_unfinished: iget failed for %K",
+ reiserfs_warning(s, "vs-2180", "iget failed for %K",
&obj_key);
retval = remove_save_link_only(s, &save_link_key, 1);
continue;
@@ -239,8 +238,8 @@ static int finish_unfinished(struct supe
if (!truncate && inode->i_nlink) {
/* file is not unlinked */
- reiserfs_warning(s,
- "vs-2185: finish_unfinished: file %K is not unlinked",
+ reiserfs_warning(s, "vs-2185",
+ "file %K is not unlinked",
&obj_key);
retval = remove_save_link_only(s, &save_link_key, 0);
continue;
@@ -252,8 +251,9 @@ static int finish_unfinished(struct supe
The only imaginable way is to execute unfinished truncate request
then boot into old kernel, remove the file and create dir with
the same key. */
- reiserfs_warning(s,
- "green-2101: impossible truncate on a directory %k. Please report",
+ reiserfs_warning(s, "green-2101",
+ "impossible truncate on a "
+ "directory %k. Please report",
INODE_PKEY(inode));
retval = remove_save_link_only(s, &save_link_key, 0);
truncate = 0;
@@ -345,8 +345,9 @@ void add_save_link(struct reiserfs_trans
} else {
/* truncate */
if (S_ISDIR(inode->i_mode))
- reiserfs_warning(inode->i_sb,
- "green-2102: Adding a truncate savelink for a directory %k! Please report",
+ reiserfs_warning(inode->i_sb, "green-2102",
+ "Adding a truncate savelink for "
+ "a directory %k! Please report",
INODE_PKEY(inode));
set_cpu_key_k_offset(&key, 1);
set_cpu_key_k_type(&key, TYPE_INDIRECT);
@@ -361,7 +362,7 @@ void add_save_link(struct reiserfs_trans
retval = search_item(inode->i_sb, &key, &path);
if (retval != ITEM_NOT_FOUND) {
if (retval != -ENOSPC)
- reiserfs_warning(inode->i_sb, "vs-2100: add_save_link:"
+ reiserfs_warning(inode->i_sb, "vs-2100",
"search_by_key (%K) returned %d", &key,
retval);
pathrelse(&path);
@@ -376,9 +377,8 @@ void add_save_link(struct reiserfs_trans
reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link);
if (retval) {
if (retval != -ENOSPC)
- reiserfs_warning(inode->i_sb,
- "vs-2120: add_save_link: insert_item returned %d",
- retval);
+ reiserfs_warning(inode->i_sb, "vs-2120",
+ "insert_item returned %d", retval);
} else {
if (truncate)
REISERFS_I(inode)->i_flags |=
@@ -477,8 +477,7 @@ static void reiserfs_put_super(struct su
print_statistics(s);
if (REISERFS_SB(s)->reserved_blocks != 0) {
- reiserfs_warning(s,
- "green-2005: reiserfs_put_super: reserved blocks left %d",
+ reiserfs_warning(s, "green-2005", "reserved blocks left %d",
REISERFS_SB(s)->reserved_blocks);
}
@@ -544,8 +543,8 @@ static void reiserfs_dirty_inode(struct
int err = 0;
if (inode->i_sb->s_flags & MS_RDONLY) {
- reiserfs_warning(inode->i_sb,
- "clm-6006: writing inode %lu on readonly FS",
+ reiserfs_warning(inode->i_sb, "clm-6006",
+ "writing inode %lu on readonly FS",
inode->i_ino);
return;
}
@@ -776,13 +775,15 @@ static int reiserfs_getopt(struct super_
if (bit_flags) {
if (opt->clrmask ==
(1 << REISERFS_UNSUPPORTED_OPT))
- reiserfs_warning(s, "%s not supported.",
+ reiserfs_warning(s, "super-6500",
+ "%s not supported.\n",
p);
else
*bit_flags &= ~opt->clrmask;
if (opt->setmask ==
(1 << REISERFS_UNSUPPORTED_OPT))
- reiserfs_warning(s, "%s not supported.",
+ reiserfs_warning(s, "super-6501",
+ "%s not supported.\n",
p);
else
*bit_flags |= opt->setmask;
@@ -791,7 +792,8 @@ static int reiserfs_getopt(struct super_
}
}
if (!opt->option_name) {
- reiserfs_warning(s, "unknown mount option \"%s\"", p);
+ reiserfs_warning(s, "super-6502",
+ "unknown mount option \"%s\"", p);
return -1;
}
@@ -799,8 +801,9 @@ static int reiserfs_getopt(struct super_
switch (*p) {
case '=':
if (!opt->arg_required) {
- reiserfs_warning(s,
- "the option \"%s\" does not require an argument",
+ reiserfs_warning(s, "super-6503",
+ "the option \"%s\" does not "
+ "require an argument\n",
opt->option_name);
return -1;
}
@@ -808,14 +811,15 @@ static int reiserfs_getopt(struct super_
case 0:
if (opt->arg_required) {
- reiserfs_warning(s,
- "the option \"%s\" requires an argument",
- opt->option_name);
+ reiserfs_warning(s, "super-6504",
+ "the option \"%s\" requires an "
+ "argument\n", opt->option_name);
return -1;
}
break;
default:
- reiserfs_warning(s, "head of option \"%s\" is only correct",
+ reiserfs_warning(s, "super-6505",
+ "head of option \"%s\" is only correct\n",
opt->option_name);
return -1;
}
@@ -827,7 +831,8 @@ static int reiserfs_getopt(struct super_
&& !(opt->arg_required & (1 << REISERFS_OPT_ALLOWEMPTY))
&& !strlen(p)) {
/* this catches "option=," if not allowed */
- reiserfs_warning(s, "empty argument for \"%s\"",
+ reiserfs_warning(s, "super-6506",
+ "empty argument for \"%s\"\n",
opt->option_name);
return -1;
}
@@ -849,7 +854,8 @@ static int reiserfs_getopt(struct super_
}
}
- reiserfs_warning(s, "bad value \"%s\" for option \"%s\"", p,
+ reiserfs_warning(s, "super-6506",
+ "bad value \"%s\" for option \"%s\"\n", p,
opt->option_name);
return -1;
}
@@ -937,9 +943,9 @@ static int reiserfs_parse_options(struct
*blocks = simple_strtoul(arg, &p, 0);
if (*p != '\0') {
/* NNN does not look like a number */
- reiserfs_warning(s,
- "reiserfs_parse_options: bad value %s",
- arg);
+ reiserfs_warning(s, "super-6507",
+ "bad value %s for "
+ "-oresize\n", arg);
return 0;
}
}
@@ -950,8 +956,8 @@ static int reiserfs_parse_options(struct
unsigned long val = simple_strtoul(arg, &p, 0);
/* commit=NNN (time in seconds) */
if (*p != '\0' || val >= (unsigned int)-1) {
- reiserfs_warning(s,
- "reiserfs_parse_options: bad value %s",
+ reiserfs_warning(s, "super-6508",
+ "bad value %s for -ocommit\n",
arg);
return 0;
}
@@ -959,16 +965,17 @@ static int reiserfs_parse_options(struct
}
if (c == 'w') {
- reiserfs_warning(s, "reiserfs: nolargeio option is no longer supported");
+ reiserfs_warning(s, "super-6509", "nolargeio option is no longer supported");
return 0;
}
if (c == 'j') {
if (arg && *arg && jdev_name) {
if (*jdev_name) { //Hm, already assigned?
- reiserfs_warning(s,
- "reiserfs_parse_options: journal device was already specified to be %s",
- *jdev_name);
+ reiserfs_warning(s, "super-6510",
+ "journal device was "
+ "already specified to "
+ "be %s", *jdev_name);
return 0;
}
*jdev_name = arg;
@@ -979,29 +986,34 @@ static int reiserfs_parse_options(struct
int qtype = c == 'u' ? USRQUOTA : GRPQUOTA;
if (sb_any_quota_enabled(s)) {
- reiserfs_warning(s,
- "reiserfs_parse_options: cannot change journalled quota options when quota turned on.");
+ reiserfs_warning(s, "super-6511",
+ "cannot change journalled "
+ "quota options when quota "
+ "turned on.");
return 0;
}
if (*arg) { /* Some filename specified? */
if (REISERFS_SB(s)->s_qf_names[qtype]
&& strcmp(REISERFS_SB(s)->s_qf_names[qtype],
arg)) {
- reiserfs_warning(s,
- "reiserfs_parse_options: %s quota file already specified.",
+ reiserfs_warning(s, "super-6512",
+ "%s quota file already specified.",
QTYPE2NAME(qtype));
return 0;
}
if (strchr(arg, '/')) {
- reiserfs_warning(s,
- "reiserfs_parse_options: quotafile must be on filesystem root.");
+ reiserfs_warning(s, "super-6513",
+ "quotafile must be "
+ "on filesystem root.");
return 0;
}
REISERFS_SB(s)->s_qf_names[qtype] =
kmalloc(strlen(arg) + 1, GFP_KERNEL);
if (!REISERFS_SB(s)->s_qf_names[qtype]) {
- reiserfs_warning(s,
- "reiserfs_parse_options: not enough memory for storing quotafile name.");
+ reiserfs_warning(s, "reiserfs-2502",
+ "not enough memory "
+ "for storing "
+ "quotafile name.");
return 0;
}
strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg);
@@ -1017,15 +1029,16 @@ static int reiserfs_parse_options(struct
else if (!strcmp(arg, "vfsv0"))
REISERFS_SB(s)->s_jquota_fmt = QFMT_VFS_V0;
else {
- reiserfs_warning(s,
- "reiserfs_parse_options: unknown quota format specified.");
+ reiserfs_warning(s, "super-6514",
+ "unknown quota format "
+ "specified.");
return 0;
}
}
#else
if (c == 'u' || c == 'g' || c == 'f') {
- reiserfs_warning(s,
- "reiserfs_parse_options: journalled quota options not supported.");
+ reiserfs_warning(s, "reiserfs-2503", "journalled "
+ "quota options not supported.");
return 0;
}
#endif
@@ -1035,15 +1048,15 @@ static int reiserfs_parse_options(struct
if (!REISERFS_SB(s)->s_jquota_fmt
&& (REISERFS_SB(s)->s_qf_names[USRQUOTA]
|| REISERFS_SB(s)->s_qf_names[GRPQUOTA])) {
- reiserfs_warning(s,
- "reiserfs_parse_options: journalled quota format not specified.");
+ reiserfs_warning(s, "super-6515",
+ "journalled quota format not specified.");
return 0;
}
/* This checking is not precise wrt the quota type but for our purposes it is sufficient */
if (!(*mount_options & (1 << REISERFS_QUOTA))
&& sb_any_quota_enabled(s)) {
- reiserfs_warning(s,
- "reiserfs_parse_options: quota options must be present when quota is turned on.");
+ reiserfs_warning(s, "super-6516", "quota options must "
+ "be present when quota is turned on.");
return 0;
}
#endif
@@ -1103,14 +1116,15 @@ static void handle_attrs(struct super_bl
if (reiserfs_attrs(s)) {
if (old_format_only(s)) {
- reiserfs_warning(s,
- "reiserfs: cannot support attributes on 3.5.x disk format");
+ reiserfs_warning(s, "super-6517", "cannot support "
+ "attributes on 3.5.x disk format");
REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
return;
}
if (!(le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared)) {
- reiserfs_warning(s,
- "reiserfs: cannot support attributes until flag is set in super-block");
+ reiserfs_warning(s, "super-6518", "cannot support "
+ "attributes until flag is set in "
+ "super-block");
REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
}
}
@@ -1253,7 +1267,7 @@ static int read_super_block(struct super
bh = sb_bread(s, offset / s->s_blocksize);
if (!bh) {
- reiserfs_warning(s, "sh-2006: read_super_block: "
+ reiserfs_warning(s, "sh-2006",
"bread failed (dev %s, block %lu, size %lu)",
reiserfs_bdevname(s), offset / s->s_blocksize,
s->s_blocksize);
@@ -1274,8 +1288,8 @@ static int read_super_block(struct super
bh = sb_bread(s, offset / s->s_blocksize);
if (!bh) {
- reiserfs_warning(s, "sh-2007: read_super_block: "
- "bread failed (dev %s, block %lu, size %lu)\n",
+ reiserfs_warning(s, "sh-2007",
+ "bread failed (dev %s, block %lu, size %lu)",
reiserfs_bdevname(s), offset / s->s_blocksize,
s->s_blocksize);
return 1;
@@ -1283,8 +1297,8 @@ static int read_super_block(struct super
rs = (struct reiserfs_super_block *)bh->b_data;
if (sb_blocksize(rs) != s->s_blocksize) {
- reiserfs_warning(s, "sh-2011: read_super_block: "
- "can't find a reiserfs filesystem on (dev %s, block %Lu, size %lu)\n",
+ reiserfs_warning(s, "sh-2011", "can't find a reiserfs "
+ "filesystem on (dev %s, block %Lu, size %lu)",
reiserfs_bdevname(s),
(unsigned long long)bh->b_blocknr,
s->s_blocksize);
@@ -1294,9 +1308,10 @@ static int read_super_block(struct super
if (rs->s_v1.s_root_block == cpu_to_le32(-1)) {
brelse(bh);
- reiserfs_warning(s,
- "Unfinished reiserfsck --rebuild-tree run detected. Please run\n"
- "reiserfsck --rebuild-tree and wait for a completion. If that fails\n"
+ reiserfs_warning(s, "super-6519", "Unfinished reiserfsck "
+ "--rebuild-tree run detected. Please run\n"
+ "reiserfsck --rebuild-tree and wait for a "
+ "completion. If that fails\n"
"get newer reiserfsprogs package");
return 1;
}
@@ -1314,10 +1329,9 @@ static int read_super_block(struct super
reiserfs_info(s, "found reiserfs format \"3.5\""
" with non-standard journal\n");
else {
- reiserfs_warning(s,
- "sh-2012: read_super_block: found unknown "
- "format \"%u\" of reiserfs with non-standard magic",
- sb_version(rs));
+ reiserfs_warning(s, "sh-2012", "found unknown "
+ "format \"%u\" of reiserfs with "
+ "non-standard magic", sb_version(rs));
return 1;
}
} else
@@ -1347,8 +1361,7 @@ static int reread_meta_blocks(struct sup
ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s)));
wait_on_buffer(SB_BUFFER_WITH_SB(s));
if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
- reiserfs_warning(s,
- "reread_meta_blocks, error reading the super");
+ reiserfs_warning(s, "reiserfs-2504", "error reading the super");
return 1;
}
@@ -1412,10 +1425,10 @@ static __u32 find_hash_out(struct super_
&& (yurahash ==
GET_HASH_VALUE(deh_offset
(&(de.de_deh[de.de_entry_num])))))) {
- reiserfs_warning(s,
- "Unable to automatically detect hash function. "
- "Please mount with -o hash={tea,rupasov,r5}",
- reiserfs_bdevname(s));
+ reiserfs_warning(s, "reiserfs-2506", "Unable to "
+ "automatically detect hash function. "
+ "Please mount with -o "
+ "hash={tea,rupasov,r5}");
hash = UNSET_HASH;
break;
}
@@ -1429,7 +1442,8 @@ static __u32 find_hash_out(struct super_
(deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash)
hash = R5_HASH;
else {
- reiserfs_warning(s, "Unrecognised hash function");
+ reiserfs_warning(s, "reiserfs-2506",
+ "Unrecognised hash function");
hash = UNSET_HASH;
}
} while (0);
@@ -1457,17 +1471,20 @@ static int what_hash(struct super_block
** mount options
*/
if (reiserfs_rupasov_hash(s) && code != YURA_HASH) {
- reiserfs_warning(s, "Error, %s hash detected, "
+ reiserfs_warning(s, "reiserfs-2507",
+ "Error, %s hash detected, "
"unable to force rupasov hash",
reiserfs_hashname(code));
code = UNSET_HASH;
} else if (reiserfs_tea_hash(s) && code != TEA_HASH) {
- reiserfs_warning(s, "Error, %s hash detected, "
+ reiserfs_warning(s, "reiserfs-2508",
+ "Error, %s hash detected, "
"unable to force tea hash",
reiserfs_hashname(code));
code = UNSET_HASH;
} else if (reiserfs_r5_hash(s) && code != R5_HASH) {
- reiserfs_warning(s, "Error, %s hash detected, "
+ reiserfs_warning(s, "reiserfs-2509",
+ "Error, %s hash detected, "
"unable to force r5 hash",
reiserfs_hashname(code));
code = UNSET_HASH;
@@ -1526,9 +1543,9 @@ static int function2code(hashf_t func)
return 0;
}
-#define SWARN(silent, s, ...) \
+#define SWARN(silent, s, id, ...) \
if (!(silent)) \
- reiserfs_warning (s, __VA_ARGS__)
+ reiserfs_warning (s, id, __VA_ARGS__)
static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
{
@@ -1573,8 +1590,7 @@ static int reiserfs_fill_super(struct su
}
if (blocks) {
- SWARN(silent, s, "jmacd-7: reiserfs_fill_super: resize option "
- "for remount only");
+ SWARN(silent, s, "jmacd-7", "resize option for remount only");
goto error;
}
@@ -1583,8 +1599,7 @@ static int reiserfs_fill_super(struct su
old_format = 1;
/* try new format (64-th 1k block), which can contain reiserfs super block */
else if (read_super_block(s, REISERFS_DISK_OFFSET_IN_BYTES)) {
- SWARN(silent, s,
- "sh-2021: reiserfs_fill_super: can not find reiserfs on %s",
+ SWARN(silent, s, "sh-2021", "can not find reiserfs on %s",
reiserfs_bdevname(s));
goto error;
}
@@ -1596,13 +1611,12 @@ static int reiserfs_fill_super(struct su
if (s->s_bdev && s->s_bdev->bd_inode
&& i_size_read(s->s_bdev->bd_inode) <
sb_block_count(rs) * sb_blocksize(rs)) {
- SWARN(silent, s,
- "Filesystem on %s cannot be mounted because it is bigger than the device",
- reiserfs_bdevname(s));
- SWARN(silent, s,
- "You may need to run fsck or increase size of your LVM partition");
- SWARN(silent, s,
- "Or may be you forgot to reboot after fdisk when it told you to");
+ SWARN(silent, s, "", "Filesystem cannot be "
+ "mounted because it is bigger than the device");
+ SWARN(silent, s, "", "You may need to run fsck "
+ "or increase size of your LVM partition");
+ SWARN(silent, s, "", "Or may be you forgot to "
+ "reboot after fdisk when it told you to");
goto error;
}
@@ -1610,14 +1624,13 @@ static int reiserfs_fill_super(struct su
sbi->s_mount_state = REISERFS_VALID_FS;
if ((errval = reiserfs_init_bitmap_cache(s))) {
- SWARN(silent, s,
- "jmacd-8: reiserfs_fill_super: unable to read bitmap");
+ SWARN(silent, s, "jmacd-8", "unable to read bitmap");
goto error;
}
errval = -EINVAL;
#ifdef CONFIG_REISERFS_CHECK
- SWARN(silent, s, "CONFIG_REISERFS_CHECK is set ON");
- SWARN(silent, s, "- it is slow mode for debugging.");
+ SWARN(silent, s, "", "CONFIG_REISERFS_CHECK is set ON");
+ SWARN(silent, s, "", "- it is slow mode for debugging.");
#endif
/* make data=ordered the default */
@@ -1638,8 +1651,8 @@ static int reiserfs_fill_super(struct su
}
// set_device_ro(s->s_dev, 1) ;
if (journal_init(s, jdev_name, old_format, commit_max_age)) {
- SWARN(silent, s,
- "sh-2022: reiserfs_fill_super: unable to initialize journal space");
+ SWARN(silent, s, "sh-2022",
+ "unable to initialize journal space");
goto error;
} else {
jinit_done = 1; /* once this is set, journal_release must be called
@@ -1647,8 +1660,8 @@ static int reiserfs_fill_super(struct su
*/
}
if (reread_meta_blocks(s)) {
- SWARN(silent, s,
- "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init");
+ SWARN(silent, s, "jmacd-9",
+ "unable to reread meta blocks after journal init");
goto error;
}
@@ -1656,8 +1669,8 @@ static int reiserfs_fill_super(struct su
goto error;
if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {
- SWARN(silent, s,
- "clm-7000: Detected readonly device, marking FS readonly");
+ SWARN(silent, s, "clm-7000",
+ "Detected readonly device, marking FS readonly");
s->s_flags |= MS_RDONLY;
}
args.objectid = REISERFS_ROOT_OBJECTID;
@@ -1666,8 +1679,7 @@ static int reiserfs_fill_super(struct su
iget5_locked(s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor,
reiserfs_init_locked_inode, (void *)(&args));
if (!root_inode) {
- SWARN(silent, s,
- "jmacd-10: reiserfs_fill_super: get root inode failed");
+ SWARN(silent, s, "jmacd-10", "get root inode failed");
goto error;
}
@@ -1985,8 +1997,8 @@ static int reiserfs_quota_on(struct supe
}
/* We must not pack tails for quota files on reiserfs for quota IO to work */
if (!REISERFS_I(nd.dentry->d_inode)->i_flags & i_nopack_mask) {
- reiserfs_warning(sb,
- "reiserfs: Quota file must have tail packing disabled.");
+ reiserfs_warning(sb, "super-6520",
+ "Quota file must have tail packing disabled.");
path_release(&nd);
return -EINVAL;
}
@@ -1998,8 +2010,8 @@ static int reiserfs_quota_on(struct supe
}
/* Quotafile not of fs root? */
if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode)
- reiserfs_warning(sb,
- "reiserfs: Quota file not on filesystem root. "
+ reiserfs_warning(sb, "super-6521",
+ "Quota file not on filesystem root. "
"Journalled quota will not work.");
path_release(&nd);
return vfs_quota_on(sb, type, format_id, path);
--- a/fs/reiserfs/tail_conversion.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/tail_conversion.c 2007-06-11 14:50:09.000000000 -0400
@@ -48,9 +48,9 @@ int direct2indirect(struct reiserfs_tran
// FIXME: we could avoid this
if (search_for_position_by_key(sb, &end_key, path) == POSITION_FOUND) {
- reiserfs_warning(sb, "PAP-14030: direct2indirect: "
- "pasted or inserted byte exists in the tree %K. "
- "Use fsck to repair.", &end_key);
+ reiserfs_warning(sb, "PAP-14030",
+ "pasted or inserted byte exists in "
+ "the tree %K. Use fsck to repair.", &end_key);
pathrelse(path);
return -EIO;
}
--- a/fs/reiserfs/xattr.c 2007-06-11 14:49:33.000000000 -0400
+++ b/fs/reiserfs/xattr.c 2007-06-11 14:50:08.000000000 -0400
@@ -278,7 +278,8 @@ static int __xattr_readdir(struct file *
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);
@@ -619,7 +620,7 @@ reiserfs_xattr_get(const struct inode *i
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));
@@ -639,7 +640,7 @@ reiserfs_xattr_get(const struct inode *i
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;
@@ -673,7 +674,8 @@ __reiserfs_xattr_del(struct dentry *xadi
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,
@@ -779,7 +781,7 @@ int reiserfs_delete_xattrs(struct inode
reiserfs_write_unlock_xattrs(inode->i_sb);
dput(root);
} else {
- reiserfs_warning(inode->i_sb,
+ reiserfs_warning(inode->i_sb, "jdm-20004",
"Couldn't remove all entries in directory");
}
unlock_kernel();
@@ -1199,7 +1201,8 @@ int reiserfs_xattr_init(struct super_blo
} 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;
@@ -1246,8 +1249,10 @@ int reiserfs_xattr_init(struct super_blo
/* 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;
}
}
--- a/include/linux/reiserfs_fs.h 2007-06-11 14:49:05.000000000 -0400
+++ b/include/linux/reiserfs_fs.h 2007-06-11 14:50:09.000000000 -0400
@@ -77,7 +77,10 @@
*/
#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, __FUNCTION__, fmt, ##args)
/* assertions handling */
/** always check a condition and panic if it's false. */
@@ -538,7 +541,7 @@ static inline int uniqueness2type(__u32
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;
@@ -558,7 +561,7 @@ static inline __u32 type2uniqueness(int
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;
}
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 08/11] reiserfs: rework reiserfs_panic
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (6 preceding siblings ...)
2007-07-12 19:37 ` [patch 07/11] reiserfs: rework reiserfs_warning jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 09/11] reiserfs: rearrange journal abort jeffm
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-reiserfs_panic.diff --]
[-- Type: text/plain, Size: 40601 bytes --]
ReiserFS panics 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.
---
fs/reiserfs/do_balan.c | 60 ++++++++++++++++------------------
fs/reiserfs/file.c | 32 ++++++++++--------
fs/reiserfs/fix_node.c | 74 +++++++++++++++++++++---------------------
fs/reiserfs/ibalance.c | 12 +++---
fs/reiserfs/inode.c | 3 -
fs/reiserfs/item_ops.c | 8 ++--
fs/reiserfs/journal.c | 56 +++++++++++++++----------------
fs/reiserfs/lbalance.c | 27 ++++++++-------
fs/reiserfs/namei.c | 18 ++++------
fs/reiserfs/objectid.c | 3 -
fs/reiserfs/prints.c | 34 ++++++++++---------
fs/reiserfs/stree.c | 49 +++++++++++++--------------
fs/reiserfs/tail_conversion.c | 10 ++---
include/linux/reiserfs_fs.h | 23 ++++++++++---
14 files changed, 212 insertions(+), 197 deletions(-)
--- a/fs/reiserfs/do_balan.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/do_balan.c 2007-06-11 14:50:04.000000000 -0400
@@ -153,8 +153,8 @@ static int balance_leaf_when_delete(stru
default:
print_cur_tb("12040");
- reiserfs_panic(tb->tb_sb,
- "PAP-12040: balance_leaf_when_delete: unexpectable mode: %s(%d)",
+ reiserfs_panic(tb->tb_sb, "PAP-12040",
+ "unexpected mode: %s(%d)",
(flag ==
M_PASTE) ? "PASTE" : ((flag ==
M_INSERT) ? "INSERT" :
@@ -722,8 +722,8 @@ static int balance_leaf(struct tree_bala
}
break;
default: /* cases d and t */
- reiserfs_panic(tb->tb_sb,
- "PAP-12130: balance_leaf: lnum > 0: unexpectable mode: %s(%d)",
+ reiserfs_panic(tb->tb_sb, "PAP-12130",
+ "lnum > 0: unexpected mode: %s(%d)",
(flag ==
M_DELETE) ? "DELETE" : ((flag ==
M_CUT)
@@ -1136,8 +1136,8 @@ static int balance_leaf(struct tree_bala
}
break;
default: /* cases d and t */
- reiserfs_panic(tb->tb_sb,
- "PAP-12175: balance_leaf: rnum > 0: unexpectable mode: %s(%d)",
+ reiserfs_panic(tb->tb_sb, "PAP-12175",
+ "rnum > 0: unexpected mode: %s(%d)",
(flag ==
M_DELETE) ? "DELETE" : ((flag ==
M_CUT) ? "CUT"
@@ -1167,8 +1167,8 @@ static int balance_leaf(struct tree_bala
not set correctly */
if (tb->CFL[0]) {
if (!tb->CFR[0])
- reiserfs_panic(tb->tb_sb,
- "vs-12195: balance_leaf: CFR not initialized");
+ reiserfs_panic(tb->tb_sb, "vs-12195",
+ "CFR not initialized");
copy_key(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),
B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]));
do_balance_mark_internal_dirty(tb, tb->CFL[0], 0);
@@ -1475,7 +1475,8 @@ static int balance_leaf(struct tree_bala
&& (pos_in_item != ih_item_len(ih)
|| tb->insert_size[0] <= 0))
reiserfs_panic(tb->tb_sb,
- "PAP-12235: balance_leaf: pos_in_item must be equal to ih_item_len");
+ "PAP-12235",
+ "pos_in_item must be equal to ih_item_len");
#endif /* CONFIG_REISERFS_CHECK */
ret_val =
@@ -1535,8 +1536,8 @@ static int balance_leaf(struct tree_bala
}
break;
default: /* cases d and t */
- reiserfs_panic(tb->tb_sb,
- "PAP-12245: balance_leaf: blknum > 2: unexpectable mode: %s(%d)",
+ reiserfs_panic(tb->tb_sb, "PAP-12245",
+ "blknum > 2: unexpected mode: %s(%d)",
(flag ==
M_DELETE) ? "DELETE" : ((flag ==
M_CUT) ? "CUT"
@@ -1681,7 +1682,7 @@ static int balance_leaf(struct tree_bala
print_cur_tb("12285");
reiserfs_panic(tb->
tb_sb,
- "PAP-12285: balance_leaf: insert_size must be 0 (%d)",
+ "PAP-12285", "insert_size must be 0 (%d)",
tb->
insert_size
[0]);
@@ -1697,11 +1698,10 @@ static int balance_leaf(struct tree_bala
if (flag == M_PASTE && tb->insert_size[0]) {
print_cur_tb("12290");
reiserfs_panic(tb->tb_sb,
- "PAP-12290: balance_leaf: insert_size is still not 0 (%d)",
- tb->insert_size[0]);
+ "PAP-12290", "insert_size is still not 0 (%d)",
+ tb->insert_size[0]);
}
#endif /* CONFIG_REISERFS_CHECK */
-
return 0;
} /* Leaf level of the tree is balanced (end of balance_leaf) */
@@ -1732,8 +1732,7 @@ struct buffer_head *get_FEB(struct tree_
break;
if (i == MAX_FEB_SIZE)
- reiserfs_panic(tb->tb_sb,
- "vs-12300: get_FEB: FEB list is empty");
+ reiserfs_panic(tb->tb_sb, "vs-12300", "FEB list is empty");
bi.tb = tb;
bi.bi_bh = first_b = tb->FEB[i];
@@ -1776,7 +1775,7 @@ static void free_thrown(struct tree_bala
if (buffer_dirty(tb->thrown[i]))
reiserfs_warning(tb->tb_sb, "reiserfs-12322",
"called with dirty buffer %d",
- blocknr);
+ blocknr);
brelse(tb->thrown[i]); /* incremented in store_thrown */
reiserfs_free_block(tb->transaction_handle, NULL,
blocknr, 0);
@@ -1873,8 +1872,8 @@ static void check_internal_node(struct s
for (i = 0; i <= B_NR_ITEMS(bh); i++, dc++) {
if (!is_reusable(s, dc_block_number(dc), 1)) {
print_cur_tb(mes);
- reiserfs_panic(s,
- "PAP-12338: check_internal_node: invalid child pointer %y in %b",
+ reiserfs_panic(s, "PAP-12338",
+ "invalid child pointer %y in %b",
dc, bh);
}
}
@@ -1896,9 +1895,10 @@ static int check_before_balancing(struct
int retval = 0;
if (cur_tb) {
- reiserfs_panic(tb->tb_sb, "vs-12335: check_before_balancing: "
- "suspect that schedule occurred based on cur_tb not being null at this point in code. "
- "do_balance cannot properly handle schedule occurring while it runs.");
+ reiserfs_panic(tb->tb_sb, "vs-12335", "suspect that schedule "
+ "occurred based on cur_tb not being null at "
+ "this point in code. do_balance cannot properly "
+ "handle schedule occurring while it runs.");
}
/* double check that buffers that we will modify are unlocked. (fix_nodes should already have
@@ -1930,8 +1930,8 @@ static void check_after_balance_leaf(str
dc_size(B_N_CHILD
(tb->FL[0], get_left_neighbor_position(tb, 0)))) {
print_cur_tb("12221");
- reiserfs_panic(tb->tb_sb,
- "PAP-12355: check_after_balance_leaf: shift to left was incorrect");
+ reiserfs_panic(tb->tb_sb, "PAP-12355",
+ "shift to left was incorrect");
}
}
if (tb->rnum[0]) {
@@ -1940,8 +1940,8 @@ static void check_after_balance_leaf(str
dc_size(B_N_CHILD
(tb->FR[0], get_right_neighbor_position(tb, 0)))) {
print_cur_tb("12222");
- reiserfs_panic(tb->tb_sb,
- "PAP-12360: check_after_balance_leaf: shift to right was incorrect");
+ reiserfs_panic(tb->tb_sb, "PAP-12360",
+ "shift to right was incorrect");
}
}
if (PATH_H_PBUFFER(tb->tb_path, 1) &&
@@ -1966,8 +1966,7 @@ static void check_after_balance_leaf(str
(PATH_H_PBUFFER(tb->tb_path, 1),
PATH_H_POSITION(tb->tb_path, 1))),
right);
- reiserfs_panic(tb->tb_sb,
- "PAP-12365: check_after_balance_leaf: S is incorrect");
+ reiserfs_panic(tb->tb_sb, "PAP-12365", "S is incorrect");
}
}
@@ -2102,8 +2101,7 @@ void do_balance(struct tree_balance *tb,
tb->need_balance_dirty = 0;
if (FILESYSTEM_CHANGED_TB(tb)) {
- reiserfs_panic(tb->tb_sb,
- "clm-6000: do_balance, fs generation has changed\n");
+ reiserfs_panic(tb->tb_sb, "clm-6000", "fs generation has changed");
}
/* if we have no real work to do */
if (!tb->insert_size[0]) {
--- a/fs/reiserfs/file.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/file.c 2007-06-11 14:50:08.000000000 -0400
@@ -413,7 +413,8 @@ static int reiserfs_allocate_blocks_for_
(char *)zeros);
} else {
reiserfs_panic(inode->i_sb,
- "green-9011: Unexpected key type %K\n",
+ "green-9011",
+ "Unexpected key type %K",
&key);
}
if (res) {
@@ -615,9 +616,8 @@ static int reiserfs_allocate_blocks_for_
(char *)(allocated_blocks +
curr_block));
} else {
- reiserfs_panic(inode->i_sb,
- "green-9010: unexpected item type for key %K\n",
- &key);
+ reiserfs_panic(inode->i_sb, "green-9010",
+ "unexpected item type for key %K", &key);
}
}
// the caller is responsible for closing the transaction
@@ -642,15 +642,16 @@ static int reiserfs_allocate_blocks_for_
int block_start, block_end; // in-page offsets for buffers.
if (!page_buffers(page))
- reiserfs_panic(inode->i_sb,
- "green-9005: No buffers for prepared page???");
+ reiserfs_panic(inode->i_sb, "green-9005",
+ "No buffers for prepared page???");
/* For each buffer in page */
for (bh = head, block_start = 0; bh != head || !block_start;
block_start = block_end, bh = bh->b_this_page) {
if (!bh)
- reiserfs_panic(inode->i_sb,
- "green-9006: Allocated but absent buffer for a page?");
+ reiserfs_panic(inode->i_sb, "green-9006",
+ "Allocated but absent buffer "
+ "for a page?");
block_end = block_start + inode->i_sb->s_blocksize;
if (i == 0 && block_end <= from)
/* if this buffer is before requested data to map, skip it */
@@ -1091,8 +1092,9 @@ static int reiserfs_prepare_file_region_
for (bh = head, block_start = 0; bh != head || !block_start;
block_start = block_end, bh = bh->b_this_page) {
if (!bh)
- reiserfs_panic(inode->i_sb,
- "green-9002: Allocated but absent buffer for a page?");
+ reiserfs_panic(inode->i_sb, "green-9002",
+ "Allocated but absent "
+ "buffer for a page?");
/* Find where this buffer ends */
block_end = block_start + inode->i_sb->s_blocksize;
if (i == 0 && block_end <= from)
@@ -1178,8 +1180,9 @@ static int reiserfs_prepare_file_region_
block_start = block_end, bh = bh->b_this_page) {
if (!bh)
- reiserfs_panic(inode->i_sb,
- "green-9002: Allocated but absent buffer for a page?");
+ reiserfs_panic(inode->i_sb, "green-9002",
+ "Allocated but absent "
+ "buffer for a page?");
/* Find where this buffer ends */
block_end = block_start + inode->i_sb->s_blocksize;
if (block_end <= from)
@@ -1212,8 +1215,9 @@ static int reiserfs_prepare_file_region_
block_start = block_end, bh = bh->b_this_page) {
if (!bh)
- reiserfs_panic(inode->i_sb,
- "green-9002: Allocated but absent buffer for a page?");
+ reiserfs_panic(inode->i_sb, "green-9002",
+ "Allocated but absent "
+ "buffer for a page?");
/* Find where this buffer ends */
block_end = block_start + inode->i_sb->s_blocksize;
if (block_start >= to)
--- a/fs/reiserfs/fix_node.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/fix_node.c 2007-06-11 14:50:04.000000000 -0400
@@ -135,8 +135,7 @@ static void create_virtual_node(struct t
vn->vn_free_ptr +=
op_create_vi(vn, vi, is_affected, tb->insert_size[0]);
if (tb->vn_buf + tb->vn_buf_size < vn->vn_free_ptr)
- reiserfs_panic(tb->tb_sb,
- "vs-8030: create_virtual_node: "
+ reiserfs_panic(tb->tb_sb, "vs-8030",
"virtual node space consumed");
if (!is_affected)
@@ -186,8 +185,9 @@ static void create_virtual_node(struct t
&& I_ENTRY_COUNT(B_N_PITEM_HEAD(Sh, 0)) == 1)) {
/* node contains more than 1 item, or item is not directory item, or this item contains more than 1 entry */
print_block(Sh, 0, -1, -1);
- reiserfs_panic(tb->tb_sb,
- "vs-8045: create_virtual_node: rdkey %k, affected item==%d (mode==%c) Must be %c",
+ reiserfs_panic(tb->tb_sb, "vs-8045",
+ "rdkey %k, affected item==%d "
+ "(mode==%c) Must be %c",
key, vn->vn_affected_item_num,
vn->vn_mode, M_DELETE);
}
@@ -1253,8 +1253,8 @@ static int ip_check_balance(struct tree_
/* Calculate balance parameters for creating new root. */
if (!Sh) {
if (!h)
- reiserfs_panic(tb->tb_sb,
- "vs-8210: ip_check_balance: S[0] can not be 0");
+ reiserfs_panic(tb->tb_sb, "vs-8210",
+ "S[0] can not be 0");
switch (n_ret_value = get_empty_nodes(tb, h)) {
case CARRY_ON:
set_parameters(tb, h, 0, 0, 1, NULL, -1, -1);
@@ -1264,8 +1264,8 @@ static int ip_check_balance(struct tree_
case REPEAT_SEARCH:
return n_ret_value;
default:
- reiserfs_panic(tb->tb_sb,
- "vs-8215: ip_check_balance: incorrect return value of get_empty_nodes");
+ reiserfs_panic(tb->tb_sb, "vs-8215", "incorrect "
+ "return value of get_empty_nodes");
}
}
@@ -2093,38 +2093,38 @@ static void tb_buffer_sanity_check(struc
if (p_s_bh) {
if (atomic_read(&(p_s_bh->b_count)) <= 0) {
- reiserfs_panic(p_s_sb,
- "jmacd-1: tb_buffer_sanity_check(): negative or zero reference counter for buffer %s[%d] (%b)\n",
- descr, level, p_s_bh);
+ reiserfs_panic(p_s_sb, "jmacd-1", "negative or zero "
+ "reference counter for buffer %s[%d] "
+ "(%b)", descr, level, p_s_bh);
}
if (!buffer_uptodate(p_s_bh)) {
- reiserfs_panic(p_s_sb,
- "jmacd-2: tb_buffer_sanity_check(): buffer is not up to date %s[%d] (%b)\n",
+ reiserfs_panic(p_s_sb, "jmacd-2", "buffer is not up "
+ "to date %s[%d] (%b)",
descr, level, p_s_bh);
}
if (!B_IS_IN_TREE(p_s_bh)) {
- reiserfs_panic(p_s_sb,
- "jmacd-3: tb_buffer_sanity_check(): buffer is not in tree %s[%d] (%b)\n",
+ reiserfs_panic(p_s_sb, "jmacd-3", "buffer is not "
+ "in tree %s[%d] (%b)",
descr, level, p_s_bh);
}
if (p_s_bh->b_bdev != p_s_sb->s_bdev) {
- reiserfs_panic(p_s_sb,
- "jmacd-4: tb_buffer_sanity_check(): buffer has wrong device %s[%d] (%b)\n",
+ reiserfs_panic(p_s_sb, "jmacd-4", "buffer has wrong "
+ "device %s[%d] (%b)",
descr, level, p_s_bh);
}
if (p_s_bh->b_size != p_s_sb->s_blocksize) {
- reiserfs_panic(p_s_sb,
- "jmacd-5: tb_buffer_sanity_check(): buffer has wrong blocksize %s[%d] (%b)\n",
+ reiserfs_panic(p_s_sb, "jmacd-5", "buffer has wrong "
+ "blocksize %s[%d] (%b)",
descr, level, p_s_bh);
}
if (p_s_bh->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) {
- reiserfs_panic(p_s_sb,
- "jmacd-6: tb_buffer_sanity_check(): buffer block number too high %s[%d] (%b)\n",
+ reiserfs_panic(p_s_sb, "jmacd-6", "buffer block "
+ "number too high %s[%d] (%b)",
descr, level, p_s_bh);
}
}
@@ -2356,39 +2356,41 @@ int fix_nodes(int n_op_mode, struct tree
#ifdef CONFIG_REISERFS_CHECK
if (cur_tb) {
print_cur_tb("fix_nodes");
- reiserfs_panic(p_s_tb->tb_sb,
- "PAP-8305: fix_nodes: there is pending do_balance");
+ reiserfs_panic(p_s_tb->tb_sb, "PAP-8305",
+ "there is pending do_balance");
}
if (!buffer_uptodate(p_s_tbS0) || !B_IS_IN_TREE(p_s_tbS0)) {
- reiserfs_panic(p_s_tb->tb_sb,
- "PAP-8320: fix_nodes: S[0] (%b %z) is not uptodate "
- "at the beginning of fix_nodes or not in tree (mode %c)",
- p_s_tbS0, p_s_tbS0, n_op_mode);
+ reiserfs_panic(p_s_tb->tb_sb, "PAP-8320", "S[0] (%b %z) is "
+ "not uptodate at the beginning of fix_nodes "
+ "or not in tree (mode %c)",
+ p_s_tbS0, p_s_tbS0, n_op_mode);
}
/* Check parameters. */
switch (n_op_mode) {
case M_INSERT:
if (n_item_num <= 0 || n_item_num > B_NR_ITEMS(p_s_tbS0))
- reiserfs_panic(p_s_tb->tb_sb,
- "PAP-8330: fix_nodes: Incorrect item number %d (in S0 - %d) in case of insert",
- n_item_num, B_NR_ITEMS(p_s_tbS0));
+ reiserfs_panic(p_s_tb->tb_sb, "PAP-8330", "Incorrect "
+ "item number %d (in S0 - %d) in case "
+ "of insert", n_item_num,
+ B_NR_ITEMS(p_s_tbS0));
break;
case M_PASTE:
case M_DELETE:
case M_CUT:
if (n_item_num < 0 || n_item_num >= B_NR_ITEMS(p_s_tbS0)) {
print_block(p_s_tbS0, 0, -1, -1);
- reiserfs_panic(p_s_tb->tb_sb,
- "PAP-8335: fix_nodes: Incorrect item number(%d); mode = %c insert_size = %d\n",
- n_item_num, n_op_mode,
- p_s_tb->insert_size[0]);
+ reiserfs_panic(p_s_tb->tb_sb, "PAP-8335", "Incorrect "
+ "item number(%d); mode = %c "
+ "insert_size = %d",
+ n_item_num, n_op_mode,
+ p_s_tb->insert_size[0]);
}
break;
default:
- reiserfs_panic(p_s_tb->tb_sb,
- "PAP-8340: fix_nodes: Incorrect mode of operation");
+ reiserfs_panic(p_s_tb->tb_sb, "PAP-8340", "Incorrect mode "
+ "of operation");
}
#endif
--- a/fs/reiserfs/ibalance.c 2007-06-11 14:49:05.000000000 -0400
+++ b/fs/reiserfs/ibalance.c 2007-06-11 14:50:04.000000000 -0400
@@ -105,8 +105,8 @@ static void internal_define_dest_src_inf
break;
default:
- reiserfs_panic(tb->tb_sb,
- "internal_define_dest_src_infos: shift type is unknown (%d)",
+ reiserfs_panic(tb->tb_sb, "ibalance-1",
+ "shift type is unknown (%d)",
shift_mode);
}
}
@@ -702,8 +702,8 @@ static void balance_internal_when_delete
return;
}
- reiserfs_panic(tb->tb_sb,
- "balance_internal_when_delete: unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
+ reiserfs_panic(tb->tb_sb, "ibalance-2",
+ "unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
h, tb->lnum[h], h, tb->rnum[h]);
}
@@ -940,8 +940,8 @@ int balance_internal(struct tree_balance
struct block_head *blkh;
if (tb->blknum[h] != 1)
- reiserfs_panic(NULL,
- "balance_internal: One new node required for creating the new root");
+ reiserfs_panic(NULL, "ibalance-3", "One new node "
+ "required for creating the new root");
/* S[h] = empty buffer from the list FEB. */
tbSh = get_FEB(tb);
blkh = B_BLK_HEAD(tbSh);
--- a/fs/reiserfs/inode.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/inode.c 2007-06-11 14:50:08.000000000 -0400
@@ -1295,8 +1295,7 @@ static void update_stat_data(struct tree
ih = PATH_PITEM_HEAD(path);
if (!is_statdata_le_ih(ih))
- reiserfs_panic(inode->i_sb,
- "vs-13065: update_stat_data: key %k, found item %h",
+ reiserfs_panic(inode->i_sb, "vs-13065", "key %k, found item %h",
INODE_PKEY(inode), ih);
if (stat_data_v1(ih)) {
--- a/fs/reiserfs/item_ops.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/item_ops.c 2007-06-11 14:49:34.000000000 -0400
@@ -517,8 +517,9 @@ static int direntry_create_vi(struct vir
((is_affected
&& (vn->vn_mode == M_PASTE
|| vn->vn_mode == M_CUT)) ? insert_size : 0)) {
- reiserfs_panic(NULL,
- "vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item",
+ reiserfs_panic(NULL, "vs-8025", "(mode==%c, "
+ "insert_size==%d), invalid length of "
+ "directory item",
vn->vn_mode, insert_size);
}
}
@@ -549,7 +550,8 @@ static int direntry_check_left(struct vi
}
if (entries == dir_u->entry_count) {
- reiserfs_panic(NULL, "free space %d, entry_count %d\n", free,
+ reiserfs_panic(NULL, "item_ops-1",
+ "free space %d, entry_count %d", free,
dir_u->entry_count);
}
--- a/fs/reiserfs/journal.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/journal.c 2007-06-11 14:50:09.000000000 -0400
@@ -437,8 +437,8 @@ void reiserfs_check_lock_depth(struct su
{
#ifdef CONFIG_SMP
if (current->lock_depth < 0) {
- reiserfs_panic(sb, "%s called without kernel lock held",
- caller);
+ reiserfs_panic(sb, "journal-1", "%s called without kernel "
+ "lock held", caller);
}
#else
;
@@ -575,7 +575,7 @@ static inline void put_journal_list(stru
struct reiserfs_journal_list *jl)
{
if (jl->j_refcount < 1) {
- reiserfs_panic(s, "trans id %lu, refcount at %d",
+ reiserfs_panic(s, "journal-2", "trans id %lu, refcount at %d",
jl->j_trans_id, jl->j_refcount);
}
if (--jl->j_refcount == 0)
@@ -1390,8 +1390,7 @@ static int flush_journal_list(struct sup
count = 0;
if (j_len_saved > journal->j_trans_max) {
- reiserfs_panic(s,
- "journal-715: flush_journal_list, length is %lu, trans id %lu\n",
+ reiserfs_panic(s, "journal-715", "length is %lu, trans id %lu",
j_len_saved, jl->j_trans_id);
return 0;
}
@@ -1423,8 +1422,8 @@ static int flush_journal_list(struct sup
** or wait on a more recent transaction, or just ignore it
*/
if (atomic_read(&(journal->j_wcount)) != 0) {
- reiserfs_panic(s,
- "journal-844: panic journal list is flushing, wcount is not 0\n");
+ reiserfs_panic(s, "journal-844", "journal list is flushing, "
+ "wcount is not 0");
}
cn = jl->j_realblock;
while (cn) {
@@ -1525,13 +1524,13 @@ static int flush_journal_list(struct sup
while (cn) {
if (test_bit(BLOCK_NEEDS_FLUSH, &cn->state)) {
if (!cn->bh) {
- reiserfs_panic(s,
- "journal-1011: cn->bh is NULL\n");
+ reiserfs_panic(s, "journal-1011",
+ "cn->bh is NULL");
}
wait_on_buffer(cn->bh);
if (!cn->bh) {
- reiserfs_panic(s,
- "journal-1012: cn->bh is NULL\n");
+ reiserfs_panic(s, "journal-1012",
+ "cn->bh is NULL");
}
if (unlikely(!buffer_uptodate(cn->bh))) {
#ifdef CONFIG_REISERFS_CHECK
@@ -3212,8 +3211,8 @@ int journal_mark_dirty(struct reiserfs_t
PROC_INFO_INC(p_s_sb, journal.mark_dirty);
if (th->t_trans_id != journal->j_trans_id) {
- reiserfs_panic(th->t_super,
- "journal-1577: handle trans id %ld != current trans id %ld\n",
+ reiserfs_panic(th->t_super, "journal-1577",
+ "handle trans id %ld != current trans id %ld",
th->t_trans_id, journal->j_trans_id);
}
@@ -3252,8 +3251,8 @@ int journal_mark_dirty(struct reiserfs_t
** Nothing can be done here, except make the FS readonly or panic.
*/
if (journal->j_len >= journal->j_trans_max) {
- reiserfs_panic(th->t_super,
- "journal-1413: journal_mark_dirty: j_len (%lu) is too big\n",
+ reiserfs_panic(th->t_super, "journal-1413",
+ "j_len (%lu) is too big",
journal->j_len);
}
@@ -3273,7 +3272,7 @@ int journal_mark_dirty(struct reiserfs_t
if (!cn) {
cn = get_cnode(p_s_sb);
if (!cn) {
- reiserfs_panic(p_s_sb, "get_cnode failed!\n");
+ reiserfs_panic(p_s_sb, "journal-4", "get_cnode failed!");
}
if (th->t_blocks_logged == th->t_blocks_allocated) {
@@ -3541,8 +3540,8 @@ static int check_journal_end(struct reis
BUG_ON(!th->t_trans_id);
if (th->t_trans_id != journal->j_trans_id) {
- reiserfs_panic(th->t_super,
- "journal-1577: handle trans id %ld != current trans id %ld\n",
+ reiserfs_panic(th->t_super, "journal-1577",
+ "handle trans id %ld != current trans id %ld",
th->t_trans_id, journal->j_trans_id);
}
@@ -3621,8 +3620,8 @@ static int check_journal_end(struct reis
}
if (journal->j_start > SB_ONDISK_JOURNAL_SIZE(p_s_sb)) {
- reiserfs_panic(p_s_sb,
- "journal-003: journal_end: j_start (%ld) is too high\n",
+ reiserfs_panic(p_s_sb, "journal-003",
+ "j_start (%ld) is too high",
journal->j_start);
}
return 1;
@@ -3667,8 +3666,8 @@ int journal_mark_freed(struct reiserfs_t
/* set the bit for this block in the journal bitmap for this transaction */
jb = journal->j_current_jl->j_list_bitmap;
if (!jb) {
- reiserfs_panic(p_s_sb,
- "journal-1702: journal_mark_freed, journal_list_bitmap is NULL\n");
+ reiserfs_panic(p_s_sb, "journal-1702",
+ "journal_list_bitmap is NULL");
}
set_bit_in_list_bitmap(p_s_sb, blocknr, jb);
@@ -4028,8 +4027,8 @@ static int do_journal_end(struct reiserf
if (buffer_journaled(cn->bh)) {
jl_cn = get_cnode(p_s_sb);
if (!jl_cn) {
- reiserfs_panic(p_s_sb,
- "journal-1676, get_cnode returned NULL\n");
+ reiserfs_panic(p_s_sb, "journal-1676",
+ "get_cnode returned NULL");
}
if (i == 0) {
jl->j_realblock = jl_cn;
@@ -4045,8 +4044,9 @@ static int do_journal_end(struct reiserf
if (is_block_in_log_or_reserved_area
(p_s_sb, cn->bh->b_blocknr)) {
- reiserfs_panic(p_s_sb,
- "journal-2332: Trying to log block %lu, which is a log block\n",
+ reiserfs_panic(p_s_sb, "journal-2332",
+ "Trying to log block %lu, "
+ "which is a log block",
cn->bh->b_blocknr);
}
jl_cn->blocknr = cn->bh->b_blocknr;
@@ -4230,8 +4230,8 @@ static int do_journal_end(struct reiserf
get_list_bitmap(p_s_sb, journal->j_current_jl);
if (!(journal->j_current_jl->j_list_bitmap)) {
- reiserfs_panic(p_s_sb,
- "journal-1996: do_journal_end, could not get a list bitmap\n");
+ reiserfs_panic(p_s_sb, "journal-1996",
+ "could not get a list bitmap");
}
atomic_set(&(journal->j_jlock), 0);
--- a/fs/reiserfs/lbalance.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/lbalance.c 2007-06-11 14:50:08.000000000 -0400
@@ -168,10 +168,11 @@ static int leaf_copy_boundary_item(struc
if (bytes_or_entries == ih_item_len(ih)
&& is_indirect_le_ih(ih))
if (get_ih_free_space(ih))
- reiserfs_panic(NULL,
- "vs-10020: leaf_copy_boundary_item: "
- "last unformatted node must be filled entirely (%h)",
- ih);
+ reiserfs_panic(sb_from_bi(dest_bi),
+ "vs-10020",
+ "last unformatted node "
+ "must be filled "
+ "entirely (%h)", ih);
}
#endif
@@ -622,9 +623,8 @@ static void leaf_define_dest_src_infos(i
break;
default:
- reiserfs_panic(NULL,
- "vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)",
- shift_mode);
+ reiserfs_panic(sb_from_bi(src_bi), "vs-10250",
+ "shift type is unknown (%d)", shift_mode);
}
RFALSE(src_bi->bi_bh == 0 || dest_bi->bi_bh == 0,
"vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
@@ -674,9 +674,9 @@ int leaf_shift_left(struct tree_balance
#ifdef CONFIG_REISERFS_CHECK
if (tb->tb_mode == M_PASTE || tb->tb_mode == M_INSERT) {
print_cur_tb("vs-10275");
- reiserfs_panic(tb->tb_sb,
- "vs-10275: leaf_shift_left: balance condition corrupted (%c)",
- tb->tb_mode);
+ reiserfs_panic(tb->tb_sb, "vs-10275",
+ "balance condition corrupted "
+ "(%c)", tb->tb_mode);
}
#endif
@@ -889,9 +889,12 @@ void leaf_paste_in_buffer(struct buffer_
#ifdef CONFIG_REISERFS_CHECK
if (zeros_number > paste_size) {
+ struct super_block *sb = NULL;
+ if (bi && bi->tb)
+ sb = bi->tb->tb_sb;
print_cur_tb("10177");
- reiserfs_panic(NULL,
- "vs-10177: leaf_paste_in_buffer: ero number == %d, paste_size == %d",
+ reiserfs_panic(sb, "vs-10177",
+ "zeros_number == %d, paste_size == %d",
zeros_number, paste_size);
}
#endif /* CONFIG_REISERFS_CHECK */
--- a/fs/reiserfs/namei.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/namei.c 2007-06-11 14:50:08.000000000 -0400
@@ -145,10 +145,9 @@ int search_by_entry_key(struct super_blo
if (!is_direntry_le_ih(de->de_ih) ||
COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) {
print_block(de->de_bh, 0, -1, -1);
- reiserfs_panic(sb,
- "vs-7005: search_by_entry_key: found item %h is not directory item or "
- "does not belong to the same directory as key %K",
- de->de_ih, key);
+ reiserfs_panic(sb, "vs-7005", "found item %h is not directory "
+ "item or does not belong to the same directory "
+ "as key %K", de->de_ih, key);
}
#endif /* CONFIG_REISERFS_CHECK */
@@ -1194,15 +1193,14 @@ static int entry_points_to_object(const
if (inode) {
if (!de_visible(de->de_deh + de->de_entry_num))
- reiserfs_panic(NULL,
- "vs-7042: entry_points_to_object: entry must be visible");
+ reiserfs_panic(inode->i_sb, "vs-7042",
+ "entry must be visible");
return (de->de_objectid == inode->i_ino) ? 1 : 0;
}
/* this must be added hidden entry */
if (de_visible(de->de_deh + de->de_entry_num))
- reiserfs_panic(NULL,
- "vs-7043: entry_points_to_object: entry must be visible");
+ reiserfs_panic(NULL, "vs-7043", "entry must be visible");
return 1;
}
@@ -1316,8 +1314,8 @@ static int reiserfs_rename(struct inode
new_dentry->d_name.len, old_inode, 0);
if (retval == -EEXIST) {
if (!new_dentry_inode) {
- reiserfs_panic(old_dir->i_sb,
- "vs-7050: new entry is found, new inode == 0\n");
+ reiserfs_panic(old_dir->i_sb, "vs-7050",
+ "new entry is found, new inode == 0");
}
} else if (retval) {
int err = journal_end(&th, old_dir->i_sb, jbegin_count);
--- a/fs/reiserfs/objectid.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/objectid.c 2007-06-11 14:50:08.000000000 -0400
@@ -18,8 +18,7 @@
static void check_objectid_map(struct super_block *s, __le32 * map)
{
if (le32_to_cpu(map[0]) != 1)
- reiserfs_panic(s,
- "vs-15010: check_objectid_map: map corrupted: %lx",
+ reiserfs_panic(s, "vs-15010", "map corrupted: %lx",
(long unsigned int)le32_to_cpu(map[0]));
// FIXME: add something else here
--- a/fs/reiserfs/prints.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/prints.c 2007-06-11 14:50:09.000000000 -0400
@@ -356,11 +356,21 @@ void reiserfs_debug(struct super_block *
extern struct tree_balance *cur_tb;
#endif
-void reiserfs_panic(struct super_block *sb, const char *fmt, ...)
+void __reiserfs_panic(struct super_block *sb, const char *id,
+ const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
- panic(KERN_EMERG "REISERFS: panic (device %s): %s\n",
- reiserfs_bdevname(sb), error_buf);
+
+#ifdef CONFIG_REISERFS_CHECK
+ dump_stack();
+#endif
+ if (sb)
+ panic(KERN_WARNING "REISERFS panic (device %s): %s%s%s: %s\n",
+ sb->s_id, id ? id : "", id ? " " : "",
+ function, error_buf);
+ else
+ panic(KERN_WARNING "REISERFS panic: %s%s%s: %s\n",
+ id ? id : "", id ? " " : "", function, error_buf);
}
void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
@@ -679,12 +689,10 @@ static void check_leaf_block_head(struct
blkh = B_BLK_HEAD(bh);
nr = blkh_nr_item(blkh);
if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE)
- reiserfs_panic(NULL,
- "vs-6010: check_leaf_block_head: invalid item number %z",
+ reiserfs_panic(NULL, "vs-6010", "invalid item number %z",
bh);
if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr)
- reiserfs_panic(NULL,
- "vs-6020: check_leaf_block_head: invalid free space %z",
+ reiserfs_panic(NULL, "vs-6020", "invalid free space %z",
bh);
}
@@ -695,21 +703,15 @@ static void check_internal_block_head(st
blkh = B_BLK_HEAD(bh);
if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT))
- reiserfs_panic(NULL,
- "vs-6025: check_internal_block_head: invalid level %z",
- bh);
+ reiserfs_panic(NULL, "vs-6025", "invalid level %z", bh);
if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE)
- reiserfs_panic(NULL,
- "vs-6030: check_internal_block_head: invalid item number %z",
- bh);
+ reiserfs_panic(NULL, "vs-6030", "invalid item number %z", bh);
if (B_FREE_SPACE(bh) !=
bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) -
DC_SIZE * (B_NR_ITEMS(bh) + 1))
- reiserfs_panic(NULL,
- "vs-6040: check_internal_block_head: invalid free space %z",
- bh);
+ reiserfs_panic(NULL, "vs-6040", "invalid free space %z", bh);
}
--- a/fs/reiserfs/stree.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/stree.c 2007-06-11 14:50:08.000000000 -0400
@@ -366,9 +366,8 @@ inline void decrement_bcount(struct buff
put_bh(p_s_bh);
return;
}
- reiserfs_panic(NULL,
- "PAP-5070: decrement_bcount: trying to free free buffer %b",
- p_s_bh);
+ reiserfs_panic(NULL, "PAP-5070",
+ "trying to free free buffer %b", p_s_bh);
}
}
@@ -713,8 +712,8 @@ int search_by_key(struct super_block *p_
#ifdef CONFIG_REISERFS_CHECK
if (cur_tb) {
print_cur_tb("5140");
- reiserfs_panic(p_s_sb,
- "PAP-5140: search_by_key: schedule occurred in do_balance!");
+ reiserfs_panic(p_s_sb, "PAP-5140",
+ "schedule occurred in do_balance!");
}
#endif
@@ -1514,8 +1513,8 @@ static void indirect_to_direct_roll_back
/* look for the last byte of the tail */
if (search_for_position_by_key(inode->i_sb, &tail_key, path) ==
POSITION_NOT_FOUND)
- reiserfs_panic(inode->i_sb,
- "vs-5615: indirect_to_direct_roll_back: found invalid item");
+ reiserfs_panic(inode->i_sb, "vs-5615",
+ "found invalid item");
RFALSE(path->pos_in_item !=
ih_item_len(PATH_PITEM_HEAD(path)) - 1,
"vs-5616: appended bytes found");
@@ -1615,8 +1614,8 @@ int reiserfs_cut_from_item(struct reiser
print_block(PATH_PLAST_BUFFER(p_s_path), 3,
PATH_LAST_POSITION(p_s_path) - 1,
PATH_LAST_POSITION(p_s_path) + 1);
- reiserfs_panic(p_s_sb,
- "PAP-5580: reiserfs_cut_from_item: item to convert does not exist (%K)",
+ reiserfs_panic(p_s_sb, "PAP-5580", "item to "
+ "convert does not exist (%K)",
p_s_item_key);
}
continue;
@@ -1696,22 +1695,20 @@ int reiserfs_cut_from_item(struct reiser
sure, that we exactly remove last unformatted node pointer
of the item */
if (!is_indirect_le_ih(le_ih))
- reiserfs_panic(p_s_sb,
- "vs-5652: reiserfs_cut_from_item: "
+ reiserfs_panic(p_s_sb, "vs-5652",
"item must be indirect %h", le_ih);
if (c_mode == M_DELETE && ih_item_len(le_ih) != UNFM_P_SIZE)
- reiserfs_panic(p_s_sb,
- "vs-5653: reiserfs_cut_from_item: "
- "completing indirect2direct conversion indirect item %h "
- "being deleted must be of 4 byte long",
- le_ih);
+ reiserfs_panic(p_s_sb, "vs-5653", "completing "
+ "indirect2direct conversion indirect "
+ "item %h being deleted must be of "
+ "4 byte long", le_ih);
if (c_mode == M_CUT
&& s_cut_balance.insert_size[0] != -UNFM_P_SIZE) {
- reiserfs_panic(p_s_sb,
- "vs-5654: reiserfs_cut_from_item: "
- "can not complete indirect2direct conversion of %h (CUT, insert_size==%d)",
+ reiserfs_panic(p_s_sb, "vs-5654", "can not complete "
+ "indirect2direct conversion of %h "
+ "(CUT, insert_size==%d)",
le_ih, s_cut_balance.insert_size[0]);
}
/* it would be useful to make sure, that right neighboring
@@ -1926,10 +1923,10 @@ static void check_research_for_paste(str
|| op_bytes_number(found_ih,
get_last_bh(path)->b_size) !=
pos_in_item(path))
- reiserfs_panic(NULL,
- "PAP-5720: check_research_for_paste: "
- "found direct item %h or position (%d) does not match to key %K",
- found_ih, pos_in_item(path), p_s_key);
+ reiserfs_panic(NULL, "PAP-5720", "found direct item "
+ "%h or position (%d) does not match "
+ "to key %K", found_ih,
+ pos_in_item(path), p_s_key);
}
if (is_indirect_le_ih(found_ih)) {
if (le_ih_k_offset(found_ih) +
@@ -1938,9 +1935,9 @@ static void check_research_for_paste(str
cpu_key_k_offset(p_s_key)
|| I_UNFM_NUM(found_ih) != pos_in_item(path)
|| get_ih_free_space(found_ih) != 0)
- reiserfs_panic(NULL,
- "PAP-5730: check_research_for_paste: "
- "found indirect item (%h) or position (%d) does not match to key (%K)",
+ reiserfs_panic(NULL, "PAP-5730", "found indirect "
+ "item (%h) or position (%d) does not "
+ "match to key (%K)",
found_ih, pos_in_item(path), p_s_key);
}
}
--- a/fs/reiserfs/tail_conversion.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/tail_conversion.c 2007-06-11 14:50:08.000000000 -0400
@@ -92,8 +92,7 @@ int direct2indirect(struct reiserfs_tran
last item of the file */
if (search_for_position_by_key(sb, &end_key, path) ==
POSITION_FOUND)
- reiserfs_panic(sb,
- "PAP-14050: direct2indirect: "
+ reiserfs_panic(sb, "PAP-14050",
"direct item (%K) not found", &end_key);
p_le_ih = PATH_PITEM_HEAD(path);
RFALSE(!is_direct_le_ih(p_le_ih),
@@ -214,8 +213,7 @@ int indirect2direct(struct reiserfs_tran
/* re-search indirect item */
if (search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path)
== POSITION_NOT_FOUND)
- reiserfs_panic(p_s_sb,
- "PAP-5520: indirect2direct: "
+ reiserfs_panic(p_s_sb, "PAP-5520",
"item to be converted %K does not exist",
p_s_item_key);
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
@@ -224,8 +222,8 @@ int indirect2direct(struct reiserfs_tran
(ih_item_len(&s_ih) / UNFM_P_SIZE -
1) * p_s_sb->s_blocksize;
if (pos != pos1)
- reiserfs_panic(p_s_sb, "vs-5530: indirect2direct: "
- "tail position changed while we were reading it");
+ reiserfs_panic(p_s_sb, "vs-5530", "tail position "
+ "changed while we were reading it");
#endif
}
--- a/include/linux/reiserfs_fs.h 2007-06-11 14:49:34.000000000 -0400
+++ b/include/linux/reiserfs_fs.h 2007-06-11 14:50:09.000000000 -0400
@@ -84,11 +84,11 @@ void __reiserfs_warning(struct super_blo
/* assertions handling */
/** always check a condition and panic if it's false. */
-#define RASSERT( cond, format, args... ) \
-if( !( cond ) ) \
- reiserfs_panic( NULL, "reiserfs[%i]: assertion " #cond " failed at " \
+#define RASSERT( cond, format, args... ) \
+if( !( cond ) ) \
+ reiserfs_panic( NULL, "assertion failure", "(" #cond ") at " \
__FILE__ ":%i:%s: " format "\n", \
- in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args )
+ __LINE__ , __FUNCTION__ , ##args )
#if defined( CONFIG_REISERFS_CHECK )
#define RFALSE( cond, format, args... ) RASSERT( !( cond ), format, ##args )
@@ -1431,6 +1431,16 @@ struct buffer_info {
int bi_position;
};
+static inline struct super_block *sb_from_tb(struct tree_balance *tb)
+{
+ return tb ? tb->tb_sb : NULL;
+}
+
+static inline struct super_block *sb_from_bi(struct buffer_info *bi)
+{
+ return bi ? sb_from_tb(bi->tb) : NULL;
+}
+
/* there are 4 types of items: stat data, directory item, indirect, direct.
+-------------------+------------+--------------+------------+
| | k_offset | k_uniqueness | mergeable? |
@@ -1977,8 +1987,11 @@ int fix_nodes(int n_op_mode, struct tree
void unfix_nodes(struct tree_balance *);
/* prints.c */
-void reiserfs_panic(struct super_block *s, const char *fmt, ...)
+void __reiserfs_panic(struct super_block *s, const char *id,
+ const char *function, const char *fmt, ...)
__attribute__ ((noreturn));
+#define reiserfs_panic(s, id, fmt, args...) \
+ __reiserfs_panic(s, id, __FUNCTION__, fmt, ##args)
void reiserfs_info(struct super_block *s, const char *fmt, ...);
void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
void print_indirect_item(struct buffer_head *bh, int item_num);
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 09/11] reiserfs: rearrange journal abort
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (7 preceding siblings ...)
2007-07-12 19:37 ` [patch 08/11] reiserfs: rework reiserfs_panic jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 10/11] reiserfs: introduce reiserfs_error() jeffm
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-rearrange-journal-abort.diff --]
[-- Type: text/plain, Size: 2904 bytes --]
This patch kills off reiserfs_journal_abort as it is never called, and
combines __reiserfs_journal_abort_{soft,hard} into one function called
reiserfs_abort_journal, which performs the same work. It is silent
as opposed to the old version, since the message was always issued
after a regular 'abort' message.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/reiserfs/journal.c | 23 ++++-------------------
fs/reiserfs/prints.c | 2 +-
include/linux/reiserfs_fs.h | 2 +-
3 files changed, 6 insertions(+), 21 deletions(-)
--- a/fs/reiserfs/journal.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/journal.c 2007-06-11 14:50:04.000000000 -0400
@@ -4256,14 +4256,15 @@ static int do_journal_end(struct reiserf
return journal->j_errno;
}
-static void __reiserfs_journal_abort_hard(struct super_block *sb)
+/* Send the file system read only and refuse new transactions */
+void reiserfs_abort_journal(struct super_block *sb, int errno)
{
struct reiserfs_journal *journal = SB_JOURNAL(sb);
if (test_bit(J_ABORTED, &journal->j_state))
return;
- printk(KERN_CRIT "REISERFS: Aborting journal for filesystem on %s\n",
- reiserfs_bdevname(sb));
+ if (!journal->j_errno)
+ journal->j_errno = errno;
sb->s_flags |= MS_RDONLY;
set_bit(J_ABORTED, &journal->j_state);
@@ -4273,19 +4274,3 @@ static void __reiserfs_journal_abort_har
#endif
}
-static void __reiserfs_journal_abort_soft(struct super_block *sb, int errno)
-{
- struct reiserfs_journal *journal = SB_JOURNAL(sb);
- if (test_bit(J_ABORTED, &journal->j_state))
- return;
-
- if (!journal->j_errno)
- journal->j_errno = errno;
-
- __reiserfs_journal_abort_hard(sb);
-}
-
-void reiserfs_journal_abort(struct super_block *sb, int errno)
-{
- return __reiserfs_journal_abort_soft(sb, errno);
-}
--- a/fs/reiserfs/prints.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/prints.c 2007-06-11 14:50:09.000000000 -0400
@@ -389,7 +389,7 @@ void reiserfs_abort(struct super_block *
error_buf);
sb->s_flags |= MS_RDONLY;
- reiserfs_journal_abort(sb, errno);
+ reiserfs_abort_journal(sb, errno);
}
/* this prints internal nodes (4 keys/items in line) (dc_number,
--- a/include/linux/reiserfs_fs.h 2007-06-11 14:49:34.000000000 -0400
+++ b/include/linux/reiserfs_fs.h 2007-06-11 14:50:09.000000000 -0400
@@ -1753,7 +1753,7 @@ int journal_begin(struct reiserfs_transa
struct super_block *p_s_sb, unsigned long);
int journal_join_abort(struct reiserfs_transaction_handle *,
struct super_block *p_s_sb, unsigned long);
-void reiserfs_journal_abort(struct super_block *sb, int errno);
+void reiserfs_abort_journal(struct super_block *sb, int errno);
void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
int reiserfs_allocate_list_bitmaps(struct super_block *s,
struct reiserfs_list_bitmap *, int);
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 10/11] reiserfs: introduce reiserfs_error()
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (8 preceding siblings ...)
2007-07-12 19:37 ` [patch 09/11] reiserfs: rearrange journal abort jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:37 ` [patch 11/11] reiserfs: use reiserfs_error() jeffm
2007-07-12 19:47 ` [patch 00/11] reiserfs fixups and error handling Jeff Mahoney
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-add-reiserfs_error.diff --]
[-- Type: text/plain, Size: 2336 bytes --]
Although reiserfs can currently handle severe errors such as journal failure,
it cannot handle less severe errors like metadata i/o failure. The following
patch adds a reiserfs_error() function akin to the one in ext3.
Subsequent patches will use this new error handler to handle errors more
gracefully in general.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
--
fs/reiserfs/prints.c | 23 +++++++++++++++++++++++
include/linux/reiserfs_fs.h | 3 +++
2 files changed, 26 insertions(+)
--- a/fs/reiserfs/prints.c 2007-06-11 14:49:34.000000000 -0400
+++ b/fs/reiserfs/prints.c 2007-06-11 14:50:04.000000000 -0400
@@ -373,6 +373,29 @@ void __reiserfs_panic(struct super_block
id ? id : "", id ? " " : "", function, error_buf);
}
+void __reiserfs_error(struct super_block *sb, const char *id,
+ const char *function, const char *fmt, ...)
+{
+ do_reiserfs_warning(fmt);
+
+ if (reiserfs_error_panic(sb))
+ __reiserfs_panic(sb, id, function, error_buf);
+
+ if (id && id[0])
+ printk(KERN_CRIT "REISERFS error (device %s): %s %s: %s\n",
+ sb->s_id, id, function, error_buf);
+ else
+ printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n",
+ sb->s_id, function, error_buf);
+
+ if (sb->s_flags & MS_RDONLY)
+ return;
+
+ reiserfs_info(sb, "Remounting filesystem read-only\n");
+ sb->s_flags |= MS_RDONLY;
+ reiserfs_abort_journal(sb, -EIO);
+}
+
void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
--- a/include/linux/reiserfs_fs.h 2007-06-11 14:49:35.000000000 -0400
+++ b/include/linux/reiserfs_fs.h 2007-06-11 14:50:08.000000000 -0400
@@ -1992,6 +1992,9 @@ void __reiserfs_panic(struct super_block
__attribute__ ((noreturn));
#define reiserfs_panic(s, id, fmt, args...) \
__reiserfs_panic(s, id, __FUNCTION__, fmt, ##args)
+void __reiserfs_error(struct super_block *s, const char *id, const char *function, const char *fmt, ...);
+#define reiserfs_error(s, id, fmt, args...) \
+ __reiserfs_error(s, id, __FUNCTION__, fmt, ##args)
void reiserfs_info(struct super_block *s, const char *fmt, ...);
void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
void print_indirect_item(struct buffer_head *bh, int item_num);
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [patch 11/11] reiserfs: use reiserfs_error()
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (9 preceding siblings ...)
2007-07-12 19:37 ` [patch 10/11] reiserfs: introduce reiserfs_error() jeffm
@ 2007-07-12 19:37 ` jeffm
2007-07-12 19:47 ` [patch 00/11] reiserfs fixups and error handling Jeff Mahoney
11 siblings, 0 replies; 13+ messages in thread
From: jeffm @ 2007-07-12 19:37 UTC (permalink / raw)
To: ReiserFS Development Mailing List, Vladimir Saveliev
[-- Attachment #1: reiserfs-use-reiserfs_error.diff --]
[-- Type: text/plain, Size: 24375 bytes --]
This patch makes many paths that are currently using warnings to handle
the error.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
--
fs/reiserfs/bitmap.c | 57 +++++++++++++++++-----------------
fs/reiserfs/file.c | 15 ++++-----
fs/reiserfs/inode.c | 43 ++++++++++++-------------
fs/reiserfs/lbalance.c | 20 ++++++------
fs/reiserfs/namei.c | 24 +++++++-------
fs/reiserfs/objectid.c | 4 +-
fs/reiserfs/stree.c | 70 +++++++++++++++++++++---------------------
fs/reiserfs/super.c | 15 ++++-----
fs/reiserfs/tail_conversion.c | 6 +--
fs/reiserfs/xattr.c | 21 ++++++------
10 files changed, 136 insertions(+), 139 deletions(-)
--- a/fs/reiserfs/bitmap.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/bitmap.c 2007-07-12 15:18:49.000000000 -0400
@@ -61,9 +61,9 @@ int is_reusable(struct super_block *s, b
int bmap, offset;
if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
- reiserfs_warning(s, "vs-4010",
- "block number is out of range %lu (%u)",
- block, SB_BLOCK_COUNT(s));
+ reiserfs_error(s, "vs-4010",
+ "block number is out of range %lu (%u)",
+ block, SB_BLOCK_COUNT(s));
return 0;
}
@@ -75,30 +75,30 @@ int is_reusable(struct super_block *s, b
&(REISERFS_SB(s)->s_properties)))) {
b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1;
if (block >= bmap1 && block <= bmap1 + SB_BMAP_NR(s)) {
- reiserfs_warning(s, "vs-4019", "bitmap block "
- "%lu(%u) can't be freed or reused",
- block, SB_BMAP_NR(s));
+ reiserfs_error(s, "vs-4019", "bitmap block "
+ "%lu(%u) can't be freed or reused",
+ block, SB_BMAP_NR(s));
return 0;
}
} else {
if (offset == 0) {
- reiserfs_warning(s, "vs-4020", "bitmap block "
- "%lu(%u) can't be freed or reused",
- block, SB_BMAP_NR(s));
+ reiserfs_error(s, "vs-4020", "bitmap block "
+ "%lu(%u) can't be freed or reused",
+ block, SB_BMAP_NR(s));
return 0;
}
}
if (bmap >= SB_BMAP_NR(s)) {
- reiserfs_warning(s, "vs-4030", "there is no so many "
- "bitmap blocks: block=%lu, bitmap_nr=%d",
- block, bmap);
+ reiserfs_error(s, "vs-4030", "there is no so many "
+ "bitmap blocks: block=%lu, bitmap_nr=%d",
+ block, bmap);
return 0;
}
if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) {
- reiserfs_warning(s, "vs-4050", "this is root block (%u), "
- "it must be busy", SB_ROOT_BLOCK(s));
+ reiserfs_error(s, "vs-4050", "this is root block (%u), "
+ "it must be busy", SB_ROOT_BLOCK(s));
return 0;
}
@@ -149,8 +149,8 @@ static int scan_bitmap_block(struct reis
/* - I mean `a window of zero bits' as in description of this function - Zam. */
if (!bi) {
- reiserfs_warning(s, "jdm-4055", "NULL bitmap info pointer "
- "for bitmap %d", bmap_n);
+ reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer "
+ "for bitmap %d", bmap_n);
return 0;
}
@@ -398,8 +398,8 @@ static void _reiserfs_free_block(struct
get_bit_address(s, block, &nr, &offset);
if (nr >= sb_bmap_nr(rs)) {
- reiserfs_warning(s, "vs-4075",
- "block %lu is out of range", block);
+ reiserfs_error(s, "vs-4075",
+ "block %lu is out of range", block);
return;
}
@@ -411,8 +411,8 @@ static void _reiserfs_free_block(struct
/* clear bit for the given block in bit map */
if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) {
- reiserfs_warning(s, "vs-4080",
- "block %lu: bit already cleared", block);
+ reiserfs_error(s, "vs-4080",
+ "block %lu: bit already cleared", block);
}
apbi[nr].free_count++;
journal_mark_dirty(th, s, bmbh);
@@ -439,7 +439,7 @@ void reiserfs_free_block(struct reiserfs
return;
if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
- reiserfs_panic(th->t_super, "bitmap-4072",
+ reiserfs_error(th->t_super, "bitmap-4072",
"Trying to free block outside file system "
"boundaries (%lu > %lu)",
block, sb_block_count(REISERFS_SB(s)->s_rs));
@@ -471,8 +471,8 @@ static void __discard_prealloc(struct re
BUG_ON(!th->t_trans_id);
#ifdef CONFIG_REISERFS_CHECK
if (ei->i_prealloc_count < 0)
- reiserfs_warning(th->t_super, "zam-4001",
- "inode has negative prealloc blocks count.");
+ reiserfs_error(th->t_super, "zam-4001",
+ "inode has negative prealloc blocks count.");
#endif
while (ei->i_prealloc_count > 0) {
reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
@@ -508,9 +508,9 @@ void reiserfs_discard_all_prealloc(struc
i_prealloc_list);
#ifdef CONFIG_REISERFS_CHECK
if (!ei->i_prealloc_count) {
- reiserfs_warning(th->t_super, "zam-4001",
- "inode is in prealloc list but has "
- "no preallocated blocks.");
+ reiserfs_error(th->t_super, "zam-4001",
+ "inode is in prealloc list but has "
+ "no preallocated blocks.");
}
#endif
__discard_prealloc(th, ei);
@@ -1287,8 +1287,9 @@ void reiserfs_cache_bitmap_metadata(stru
}
}
}
- /* The first bit must ALWAYS be 1 */
- BUG_ON(info->first_zero_hint == 0);
+ if (info->first_zero_hint == 0)
+ reiserfs_error(sb, "reiserfs-2025", "bitmap block %lu is "
+ "corrupted: first bit must be 1", bh->b_blocknr);
}
struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb,
--- a/fs/reiserfs/file.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/file.c 2007-07-12 15:25:36.000000000 -0400
@@ -395,7 +395,7 @@ static int reiserfs_allocate_blocks_for_
if (res != ITEM_NOT_FOUND) {
/* item should not exist, otherwise we have error */
if (res != -ENOSPC) {
- reiserfs_warning(inode->
+ reiserfs_error(inode->
i_sb,
"green-9008",
"search_by_key (%K) returned %d",
@@ -412,10 +412,11 @@ static int reiserfs_allocate_blocks_for_
inode,
(char *)zeros);
} else {
- reiserfs_panic(inode->i_sb,
+ reiserfs_error(inode->i_sb,
"green-9011",
"Unexpected key type %K",
&key);
+ res = -EIO;
}
if (res) {
kfree(zeros);
@@ -600,11 +601,11 @@ static int reiserfs_allocate_blocks_for_
/* Well, if we have found such item already, or some error
occured, we need to warn user and return error */
if (res != -ENOSPC) {
- reiserfs_warning(inode->i_sb,
- "green-9009",
- "search_by_key (%K) "
- "returned %d", &key,
- res);
+ reiserfs_error(inode->i_sb,
+ "green-9009",
+ "search_by_key (%K) "
+ "returned %d", &key,
+ res);
}
res = -EIO;
goto error_exit_free_blocks;
--- a/fs/reiserfs/inode.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/inode.c 2007-07-12 15:18:49.000000000 -0400
@@ -837,11 +837,11 @@ int reiserfs_get_block(struct inode *ino
tail_offset);
if (retval) {
if (retval != -ENOSPC)
- reiserfs_warning(inode->i_sb,
- "clm-6004",
- "convert tail failed inode %lu, error %d",
- inode->i_ino,
- retval);
+ reiserfs_error(inode->i_sb,
+ "clm-6004",
+ "convert tail failed inode %lu, error %d",
+ inode->i_ino,
+ retval);
if (allocated_block_nr) {
/* the bitmap, the super, and the stat data == 3 */
if (!th)
@@ -1327,10 +1327,9 @@ void reiserfs_update_sd_size(struct reis
/* look for the object's stat data */
retval = search_item(inode->i_sb, &key, &path);
if (retval == IO_ERROR) {
- reiserfs_warning(inode->i_sb, "vs-13050",
- "i/o failure occurred trying to "
- "update %K stat data",
- &key);
+ reiserfs_error(inode->i_sb, "vs-13050",
+ "i/o failure occurred trying to "
+ "update %K stat data", &key);
return;
}
if (retval == ITEM_NOT_FOUND) {
@@ -1419,9 +1418,9 @@ void reiserfs_read_locked_inode(struct i
/* look for the object's stat data */
retval = search_item(inode->i_sb, &key, &path_to_sd);
if (retval == IO_ERROR) {
- reiserfs_warning(inode->i_sb, "vs-13070",
- "i/o failure occurred trying to find "
- "stat data of %K", &key);
+ reiserfs_error(inode->i_sb, "vs-13070",
+ "i/o failure occurred trying to find "
+ "stat data of %K", &key);
reiserfs_make_bad_inode(inode);
return;
}
@@ -1690,8 +1689,8 @@ static int reiserfs_new_directory(struct
/* look for place in the tree for new item */
retval = search_item(sb, &key, path);
if (retval == IO_ERROR) {
- reiserfs_warning(sb, "vs-13080",
- "i/o failure occurred creating new directory");
+ reiserfs_error(sb, "vs-13080",
+ "i/o failure occurred creating new directory");
return -EIO;
}
if (retval == ITEM_FOUND) {
@@ -1730,8 +1729,8 @@ static int reiserfs_new_symlink(struct r
/* look for place in the tree for new item */
retval = search_item(sb, &key, path);
if (retval == IO_ERROR) {
- reiserfs_warning(sb, "vs-13080",
- "i/o failure occurred creating new symlink");
+ reiserfs_error(sb, "vs-13080",
+ "i/o failure occurred creating new symlink");
return -EIO;
}
if (retval == ITEM_FOUND) {
@@ -2051,10 +2050,8 @@ static int grab_tail_page(struct inode *
** I've screwed up the code to find the buffer, or the code to
** call prepare_write
*/
- reiserfs_warning(p_s_inode->i_sb, "clm-6000",
- "error reading block %lu on dev %s",
- bh->b_blocknr,
- reiserfs_bdevname(p_s_inode->i_sb));
+ reiserfs_error(p_s_inode->i_sb, "clm-6000",
+ "error reading block %lu", bh->b_blocknr);
error = -EIO;
goto unlock;
}
@@ -2096,9 +2093,9 @@ int reiserfs_truncate_file(struct inode
// and get_block_create_0 could not find a block to read in,
// which is ok.
if (error != -ENOENT)
- reiserfs_warning(p_s_inode->i_sb, "clm-6001",
- "grab_tail_page failed %d",
- error);
+ reiserfs_error(p_s_inode->i_sb, "clm-6001",
+ "grab_tail_page failed %d",
+ error);
page = NULL;
bh = NULL;
}
--- a/fs/reiserfs/lbalance.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/lbalance.c 2007-07-12 15:18:49.000000000 -0400
@@ -1290,17 +1290,17 @@ void leaf_paste_entries(struct buffer_he
prev = (i != 0) ? deh_location(&(deh[i - 1])) : 0;
if (prev && prev <= deh_location(&(deh[i])))
- reiserfs_warning(NULL, "vs-10240",
- "directory item (%h) "
- "corrupted (prev %a, "
- "cur(%d) %a)",
- ih, deh + i - 1, i, deh + i);
+ reiserfs_error(NULL, "vs-10240",
+ "directory item (%h) "
+ "corrupted (prev %a, "
+ "cur(%d) %a)",
+ ih, deh + i - 1, i, deh + i);
if (next && next >= deh_location(&(deh[i])))
- reiserfs_warning(NULL, "vs-10250",
- "directory item (%h) "
- "corrupted (cur(%d) %a, "
- "next %a)",
- ih, i, deh + i, deh + i + 1);
+ reiserfs_error(NULL, "vs-10250",
+ "directory item (%h) "
+ "corrupted (cur(%d) %a, "
+ "next %a)",
+ ih, i, deh + i, deh + i + 1);
}
}
#endif
--- a/fs/reiserfs/namei.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/namei.c 2007-07-12 15:18:49.000000000 -0400
@@ -120,8 +120,8 @@ int search_by_entry_key(struct super_blo
switch (retval) {
case ITEM_NOT_FOUND:
if (!PATH_LAST_POSITION(path)) {
- reiserfs_warning(sb, "vs-7000", "search_by_key "
- "returned item position == 0");
+ reiserfs_error(sb, "vs-7000", "search_by_key "
+ "returned item position == 0");
pathrelse(path);
return IO_ERROR;
}
@@ -135,7 +135,7 @@ int search_by_entry_key(struct super_blo
default:
pathrelse(path);
- reiserfs_warning(sb, "vs-7002", "no path to here");
+ reiserfs_error(sb, "vs-7002", "no path to here");
return IO_ERROR;
}
@@ -298,7 +298,7 @@ static int reiserfs_find_entry(struct in
search_by_entry_key(dir->i_sb, &key_to_search,
path_to_entry, de);
if (retval == IO_ERROR) {
- reiserfs_warning(dir->i_sb, "zam-7001", "io error");
+ reiserfs_error(dir->i_sb, "zam-7001", "io error");
return IO_ERROR;
}
@@ -490,9 +490,9 @@ static int reiserfs_add_entry(struct rei
}
if (retval != NAME_FOUND) {
- reiserfs_warning(dir->i_sb, "zam-7002",
- "reiserfs_find_entry() returned "
- "unexpected value (%d)", retval);
+ reiserfs_error(dir->i_sb, "zam-7002",
+ "reiserfs_find_entry() returned "
+ "unexpected value (%d)", retval);
}
return -EEXIST;
@@ -902,9 +902,9 @@ static int reiserfs_rmdir(struct inode *
goto end_rmdir;
if (inode->i_nlink != 2 && inode->i_nlink != 1)
- reiserfs_warning(inode->i_sb, "reiserfs-7040",
- "empty directory has nlink != 2 (%d)",
- inode->i_nlink);
+ reiserfs_error(inode->i_sb, "reiserfs-7040",
+ "empty directory has nlink != 2 (%d)",
+ inode->i_nlink);
clear_nlink(inode);
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
@@ -1495,8 +1495,8 @@ static int reiserfs_rename(struct inode
if (reiserfs_cut_from_item
(&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
0) < 0)
- reiserfs_warning(old_dir->i_sb, "vs-7060",
- "couldn't not cut old name. Fsck later?");
+ reiserfs_error(old_dir->i_sb, "vs-7060",
+ "couldn't not cut old name. Fsck later?");
old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
--- a/fs/reiserfs/objectid.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/objectid.c 2007-07-12 15:18:49.000000000 -0400
@@ -160,8 +160,8 @@ void reiserfs_release_objectid(struct re
i += 2;
}
- reiserfs_warning(s, "vs-15011", "tried to free free object id (%lu)",
- (long unsigned)objectid_to_release);
+ reiserfs_error(s, "vs-15011", "tried to free free object id (%lu)",
+ (long unsigned)objectid_to_release);
}
int reiserfs_convert_objectid_map_v1(struct super_block *s)
--- a/fs/reiserfs/stree.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/stree.c 2007-07-12 15:18:49.000000000 -0400
@@ -443,24 +443,24 @@ static int is_leaf(char *buf, int blocks
blkh = (struct block_head *)buf;
if (blkh_level(blkh) != DISK_LEAF_NODE_LEVEL) {
- reiserfs_warning(NULL, "reiserfs-5080",
- "this should be caught earlier");
+ reiserfs_error(NULL, "reiserfs-5080",
+ "this should be caught earlier");
return 0;
}
nr = blkh_nr_item(blkh);
if (nr < 1 || nr > ((blocksize - BLKH_SIZE) / (IH_SIZE + MIN_ITEM_LEN))) {
/* item number is too big or too small */
- reiserfs_warning(NULL, "reiserfs-5081",
- "nr_item seems wrong: %z", bh);
+ reiserfs_error(NULL, "reiserfs-5081",
+ "nr_item seems wrong: %z", bh);
return 0;
}
ih = (struct item_head *)(buf + BLKH_SIZE) + nr - 1;
used_space = BLKH_SIZE + IH_SIZE * nr + (blocksize - ih_location(ih));
if (used_space != blocksize - blkh_free_space(blkh)) {
/* free space does not match to calculated amount of use space */
- reiserfs_warning(NULL, "reiserfs-5082",
- "free space seems wrong: %z", bh);
+ reiserfs_error(NULL, "reiserfs-5082",
+ "free space seems wrong: %z", bh);
return 0;
}
// FIXME: it is_leaf will hit performance too much - we may have
@@ -471,28 +471,28 @@ static int is_leaf(char *buf, int blocks
prev_location = blocksize;
for (i = 0; i < nr; i++, ih++) {
if (le_ih_k_type(ih) == TYPE_ANY) {
- reiserfs_warning(NULL, "reiserfs-5083",
- "wrong item type for item %h",
+ reiserfs_error(NULL, "reiserfs-5083",
+ "wrong item type for item %h",
ih);
return 0;
}
if (ih_location(ih) >= blocksize
|| ih_location(ih) < IH_SIZE * nr) {
- reiserfs_warning(NULL, "reiserfs-5084",
- "item location seems wrong: %h",
+ reiserfs_error(NULL, "reiserfs-5084",
+ "item location seems wrong: %h",
ih);
return 0;
}
if (ih_item_len(ih) < 1
|| ih_item_len(ih) > MAX_ITEM_LEN(blocksize)) {
- reiserfs_warning(NULL, "reiserfs-5085",
- "item length seems wrong: %h",
+ reiserfs_error(NULL, "reiserfs-5085",
+ "item length seems wrong: %h",
ih);
return 0;
}
if (prev_location - ih_location(ih) != ih_item_len(ih)) {
- reiserfs_warning(NULL, "reiserfs-5086",
- "item location seems wrong "
+ reiserfs_error(NULL, "reiserfs-5086",
+ "item location seems wrong "
"(second one): %h", ih);
return 0;
}
@@ -514,23 +514,23 @@ static int is_internal(char *buf, int bl
nr = blkh_level(blkh);
if (nr <= DISK_LEAF_NODE_LEVEL || nr > MAX_HEIGHT) {
/* this level is not possible for internal nodes */
- reiserfs_warning(NULL, "reiserfs-5087",
- "this should be caught earlier");
+ reiserfs_error(NULL, "reiserfs-5087",
+ "this should be caught earlier");
return 0;
}
nr = blkh_nr_item(blkh);
if (nr > (blocksize - BLKH_SIZE - DC_SIZE) / (KEY_SIZE + DC_SIZE)) {
/* for internal which is not root we might check min number of keys */
- reiserfs_warning(NULL, "reiserfs-5088",
- "number of key seems wrong: %z", bh);
+ reiserfs_error(NULL, "reiserfs-5088",
+ "number of key seems wrong: %z", bh);
return 0;
}
used_space = BLKH_SIZE + KEY_SIZE * nr + DC_SIZE * (nr + 1);
if (used_space != blocksize - blkh_free_space(blkh)) {
- reiserfs_warning(NULL, "reiserfs-5089",
- "free space seems wrong: %z", bh);
+ reiserfs_error(NULL, "reiserfs-5089",
+ "free space seems wrong: %z", bh);
return 0;
}
// one may imagine much more checks
@@ -542,8 +542,8 @@ static int is_internal(char *buf, int bl
static int is_tree_node(struct buffer_head *bh, int level)
{
if (B_LEVEL(bh) != level) {
- reiserfs_warning(NULL, "reiserfs-5090", "node level %d does "
- "not match to the expected one %d",
+ reiserfs_error(NULL, "reiserfs-5090", "node level %d does "
+ "not match to the expected one %d",
B_LEVEL(bh), level);
return 0;
}
@@ -720,9 +720,9 @@ int search_by_key(struct super_block *p_
// make sure, that the node contents look like a node of
// certain level
if (!is_tree_node(p_s_bh, expected_level)) {
- reiserfs_warning(p_s_sb, "vs-5150",
- "invalid format found in block %ld. "
- "Fsck?", p_s_bh->b_blocknr);
+ reiserfs_error(p_s_sb, "vs-5150",
+ "invalid format found in block %ld. "
+ "Fsck?", p_s_bh->b_blocknr);
pathrelse(p_s_search_path);
return IO_ERROR;
}
@@ -1335,9 +1335,9 @@ void reiserfs_delete_solid_item(struct r
while (1) {
retval = search_item(th->t_super, &cpu_key, &path);
if (retval == IO_ERROR) {
- reiserfs_warning(th->t_super, "vs-5350",
- "i/o failure occurred trying "
- "to delete %K", &cpu_key);
+ reiserfs_error(th->t_super, "vs-5350",
+ "i/o failure occurred trying "
+ "to delete %K", &cpu_key);
break;
}
if (retval != ITEM_FOUND) {
@@ -1740,7 +1740,7 @@ static void truncate_directory(struct re
{
BUG_ON(!th->t_trans_id);
if (inode->i_nlink)
- reiserfs_warning(inode->i_sb, "vs-5655", "link count != 0");
+ reiserfs_error(inode->i_sb, "vs-5655", "link count != 0");
set_le_key_k_offset(KEY_FORMAT_3_5, INODE_PKEY(inode), DOT_OFFSET);
set_le_key_k_type(KEY_FORMAT_3_5, INODE_PKEY(inode), TYPE_DIRENTRY);
@@ -1793,16 +1793,16 @@ int reiserfs_do_truncate(struct reiserfs
search_for_position_by_key(p_s_inode->i_sb, &s_item_key,
&s_search_path);
if (retval == IO_ERROR) {
- reiserfs_warning(p_s_inode->i_sb, "vs-5657",
- "i/o failure occurred trying to truncate %K",
- &s_item_key);
+ reiserfs_error(p_s_inode->i_sb, "vs-5657",
+ "i/o failure occurred trying to truncate %K",
+ &s_item_key);
err = -EIO;
goto out;
}
if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) {
- reiserfs_warning(p_s_inode->i_sb, "PAP-5660",
- "wrong result %d of search for %K", retval,
- &s_item_key);
+ reiserfs_error(p_s_inode->i_sb, "PAP-5660",
+ "wrong result %d of search for %K", retval,
+ &s_item_key);
err = -EIO;
goto out;
--- a/fs/reiserfs/super.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/super.c 2007-07-12 15:18:49.000000000 -0400
@@ -190,9 +190,8 @@ static int finish_unfinished(struct supe
while (!retval) {
retval = search_item(s, &max_cpu_key, &path);
if (retval != ITEM_NOT_FOUND) {
- reiserfs_warning(s, "vs-2140",
- "search_by_key returned %d",
- retval);
+ reiserfs_error(s, "vs-2140",
+ "search_by_key returned %d", retval);
break;
}
@@ -362,9 +361,9 @@ void add_save_link(struct reiserfs_trans
retval = search_item(inode->i_sb, &key, &path);
if (retval != ITEM_NOT_FOUND) {
if (retval != -ENOSPC)
- reiserfs_warning(inode->i_sb, "vs-2100",
- "search_by_key (%K) returned %d", &key,
- retval);
+ reiserfs_error(inode->i_sb, "vs-2100",
+ "search_by_key (%K) returned %d", &key,
+ retval);
pathrelse(&path);
return;
}
@@ -377,8 +376,8 @@ void add_save_link(struct reiserfs_trans
reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link);
if (retval) {
if (retval != -ENOSPC)
- reiserfs_warning(inode->i_sb, "vs-2120",
- "insert_item returned %d", retval);
+ reiserfs_error(inode->i_sb, "vs-2120",
+ "insert_item returned %d", retval);
} else {
if (truncate)
REISERFS_I(inode)->i_flags |=
--- a/fs/reiserfs/tail_conversion.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/tail_conversion.c 2007-07-12 15:18:49.000000000 -0400
@@ -48,9 +48,9 @@ int direct2indirect(struct reiserfs_tran
// FIXME: we could avoid this
if (search_for_position_by_key(sb, &end_key, path) == POSITION_FOUND) {
- reiserfs_warning(sb, "PAP-14030",
- "pasted or inserted byte exists in "
- "the tree %K. Use fsck to repair.", &end_key);
+ reiserfs_error(sb, "PAP-14030",
+ "pasted or inserted byte exists in "
+ "the tree %K. Use fsck to repair.", &end_key);
pathrelse(path);
return -EIO;
}
--- a/fs/reiserfs/xattr.c 2007-07-12 15:18:46.000000000 -0400
+++ b/fs/reiserfs/xattr.c 2007-07-12 15:18:49.000000000 -0400
@@ -278,8 +278,8 @@ static int __xattr_readdir(struct file *
ih = de.de_ih;
if (!is_direntry_le_ih(ih)) {
- reiserfs_warning(inode->i_sb, "jdm-20000",
- "not direntry %h", ih);
+ reiserfs_error(inode->i_sb, "jdm-20000",
+ "not direntry %h", ih);
break;
}
copy_item_head(&tmp_ih, ih);
@@ -674,15 +674,14 @@ __reiserfs_xattr_del(struct dentry *xadi
goto out_file;
if (!is_reiserfs_priv_object(dentry->d_inode)) {
- 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,
- xadir->d_name.name, namelen, name,
- is_reiserfs_priv_object(xadir->
- d_inode) ? "" :
- "not ");
+ reiserfs_error(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,
+ xadir->d_name.name, namelen, name,
+ is_reiserfs_priv_object(xadir-> d_inode) ? "" :
+ "not ");
dput(dentry);
return -EIO;
}
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch 00/11] reiserfs fixups and error handling
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
` (10 preceding siblings ...)
2007-07-12 19:37 ` [patch 11/11] reiserfs: use reiserfs_error() jeffm
@ 2007-07-12 19:47 ` Jeff Mahoney
11 siblings, 0 replies; 13+ messages in thread
From: Jeff Mahoney @ 2007-07-12 19:47 UTC (permalink / raw)
Cc: ReiserFS Development Mailing List, Vladimir Saveliev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
jeffm@suse.com wrote:
> This is the first part of a series of patches I've been developing for
> reiserfs. I'm posting them now for review followed by submission to 2.6.23.
>
> The first 4 patches are small fixes:
> * Adding proper lockdep annotation to xattrs
> * Switching to panic() instead of BUG() in reiserfs_panic()
> * Making is_reusable bitmap sanity checking unconditional
> * Using the first zero hint in bitmap iteration
>
> The remaining 7 work to make reiserfs error handling more consistent
> and robust:
> * Use consistent message prefixes for all reiserfs log output
> * Add a reiserfs_info() call for multiline output that doesn't
> masquerade as a warning.
> * Make reiserfs_warning() calls more consistent, requiring an ID, and
> including the device and function where the warning is occuring.
> * Make reiserfs_panic() more consistent in the same manner.
> * Rearrange reiserfs_journal_abort() since it was modelled after jbd's
> call and doesn't need to be. There's several function calls that
> just get optimized out anyway.
>
> * Add a reiserfs_error() call to handle metadata errors by aborting
> the journal and marking the file system read-only.
> * Convert 50 reiserfs_warning(), 2 reiserfs_panic(), and one BUG_ON
> site to use the new reiserfs_error().,
>
> -Jeff
>
Apologies for the double post. I had the wrong to: address in the
headers, but gave the correct address to formail, so they got sent out
but any replies would be thrown into oblivion.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFGloVvLPWxlyuTD7IRAllBAJ9Fyn3JpICyNxh49hcPOx55VmM/OwCeOWy/
RWYW8hUaGdKYVOpSjDC9H9c=
=vFGK
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-07-12 19:47 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-12 19:37 [patch 00/11] reiserfs fixups and error handling jeffm
2007-07-12 19:37 ` [patch 01/11] reiserfs: fix up lockdep warnings jeffm
2007-07-12 19:37 ` [patch 02/11] reiserfs: dont use BUG when panicking jeffm
2007-07-12 19:37 ` [patch 03/11] reiserfs: use is_reusable to catch corruption jeffm
2007-07-12 19:37 ` [patch 04/11] reiserfs: make bitmap use cached first zero bit jeffm
2007-07-12 19:37 ` [patch 05/11] reiserfs: use more consistent printk formatting jeffm
2007-07-12 19:37 ` [patch 06/11] reiserfs: make some warnings informational jeffm
2007-07-12 19:37 ` [patch 07/11] reiserfs: rework reiserfs_warning jeffm
2007-07-12 19:37 ` [patch 08/11] reiserfs: rework reiserfs_panic jeffm
2007-07-12 19:37 ` [patch 09/11] reiserfs: rearrange journal abort jeffm
2007-07-12 19:37 ` [patch 10/11] reiserfs: introduce reiserfs_error() jeffm
2007-07-12 19:37 ` [patch 11/11] reiserfs: use reiserfs_error() jeffm
2007-07-12 19:47 ` [patch 00/11] reiserfs fixups and error handling Jeff Mahoney
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.