aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/prints.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:16:36 -0400
commitc3a9c2109f84882b9b3178f6b1838d550d3df0ec (patch)
tree08a502b8013eabb562f03be45622b0f63b1a34b9 /fs/reiserfs/prints.c
parent78b6513d2881f1a759fb9825a036d926392de084 (diff)
reiserfs: rework reiserfs_panic
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. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs/prints.c')
-rw-r--r--fs/reiserfs/prints.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c
index de71372f0dfe..1964acb6eb17 100644
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -353,14 +353,21 @@ void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...)
353extern struct tree_balance *cur_tb; 353extern struct tree_balance *cur_tb;
354#endif 354#endif
355 355
356void reiserfs_panic(struct super_block *sb, const char *fmt, ...) 356void __reiserfs_panic(struct super_block *sb, const char *id,
357 const char *function, const char *fmt, ...)
357{ 358{
358 do_reiserfs_warning(fmt); 359 do_reiserfs_warning(fmt);
359 360
361#ifdef CONFIG_REISERFS_CHECK
360 dump_stack(); 362 dump_stack();
361 363#endif
362 panic(KERN_EMERG "REISERFS: panic (device %s): %s\n", 364 if (sb)
363 reiserfs_bdevname(sb), error_buf); 365 panic(KERN_WARNING "REISERFS panic (device %s): %s%s%s: %s\n",
366 sb->s_id, id ? id : "", id ? " " : "",
367 function, error_buf);
368 else
369 panic(KERN_WARNING "REISERFS panic: %s%s%s: %s\n",
370 id ? id : "", id ? " " : "", function, error_buf);
364} 371}
365 372
366void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...) 373void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
@@ -681,12 +688,10 @@ static void check_leaf_block_head(struct buffer_head *bh)
681 blkh = B_BLK_HEAD(bh); 688 blkh = B_BLK_HEAD(bh);
682 nr = blkh_nr_item(blkh); 689 nr = blkh_nr_item(blkh);
683 if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE) 690 if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE)
684 reiserfs_panic(NULL, 691 reiserfs_panic(NULL, "vs-6010", "invalid item number %z",
685 "vs-6010: check_leaf_block_head: invalid item number %z",
686 bh); 692 bh);
687 if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr) 693 if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr)
688 reiserfs_panic(NULL, 694 reiserfs_panic(NULL, "vs-6020", "invalid free space %z",
689 "vs-6020: check_leaf_block_head: invalid free space %z",
690 bh); 695 bh);
691 696
692} 697}
@@ -697,21 +702,15 @@ static void check_internal_block_head(struct buffer_head *bh)
697 702
698 blkh = B_BLK_HEAD(bh); 703 blkh = B_BLK_HEAD(bh);
699 if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT)) 704 if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT))
700 reiserfs_panic(NULL, 705 reiserfs_panic(NULL, "vs-6025", "invalid level %z", bh);
701 "vs-6025: check_internal_block_head: invalid level %z",
702 bh);
703 706
704 if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE) 707 if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE)
705 reiserfs_panic(NULL, 708 reiserfs_panic(NULL, "vs-6030", "invalid item number %z", bh);
706 "vs-6030: check_internal_block_head: invalid item number %z",
707 bh);
708 709
709 if (B_FREE_SPACE(bh) != 710 if (B_FREE_SPACE(bh) !=
710 bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) - 711 bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) -
711 DC_SIZE * (B_NR_ITEMS(bh) + 1)) 712 DC_SIZE * (B_NR_ITEMS(bh) + 1))
712 reiserfs_panic(NULL, 713 reiserfs_panic(NULL, "vs-6040", "invalid free space %z", bh);
713 "vs-6040: check_internal_block_head: invalid free space %z",
714 bh);
715 714
716} 715}
717 716