diff options
author | Jeff Mahoney <jeffm@suse.com> | 2009-03-30 14:02:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 15:16:36 -0400 |
commit | 45b03d5e8e674eb6555b767e1c8eb40b671ff892 (patch) | |
tree | d74acd1be7f5102143df960e8cd692aadcc437df /fs/reiserfs/item_ops.c | |
parent | 1d889d9958490888b3fad1d486145d9a03559cbc (diff) |
reiserfs: rework reiserfs_warning
ReiserFS warnings can be somewhat inconsistent.
In some cases:
* a unique identifier may be associated with it
* the function name may be included
* the device may be printed separately
This patch aims to make warnings more consistent. reiserfs_warning() prints
the device name, so printing it a second time is not required. The function
name for a warning is always helpful in debugging, so it is now automatically
inserted into the output. Hans has stated that every warning should have
a unique identifier. Some cases lack them, others really shouldn't have them.
reiserfs_warning() now expects an id associated with each message. In the
rare case where one isn't needed, "" will suffice.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs/item_ops.c')
-rw-r--r-- | fs/reiserfs/item_ops.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c index 9475557ab499..8a11cf39f57b 100644 --- a/fs/reiserfs/item_ops.c +++ b/fs/reiserfs/item_ops.c | |||
@@ -97,7 +97,8 @@ static int sd_unit_num(struct virtual_item *vi) | |||
97 | 97 | ||
98 | static void sd_print_vi(struct virtual_item *vi) | 98 | static void sd_print_vi(struct virtual_item *vi) |
99 | { | 99 | { |
100 | reiserfs_warning(NULL, "STATDATA, index %d, type 0x%x, %h", | 100 | reiserfs_warning(NULL, "reiserfs-16100", |
101 | "STATDATA, index %d, type 0x%x, %h", | ||
101 | vi->vi_index, vi->vi_type, vi->vi_ih); | 102 | vi->vi_index, vi->vi_type, vi->vi_ih); |
102 | } | 103 | } |
103 | 104 | ||
@@ -190,7 +191,8 @@ static int direct_unit_num(struct virtual_item *vi) | |||
190 | 191 | ||
191 | static void direct_print_vi(struct virtual_item *vi) | 192 | static void direct_print_vi(struct virtual_item *vi) |
192 | { | 193 | { |
193 | reiserfs_warning(NULL, "DIRECT, index %d, type 0x%x, %h", | 194 | reiserfs_warning(NULL, "reiserfs-16101", |
195 | "DIRECT, index %d, type 0x%x, %h", | ||
194 | vi->vi_index, vi->vi_type, vi->vi_ih); | 196 | vi->vi_index, vi->vi_type, vi->vi_ih); |
195 | } | 197 | } |
196 | 198 | ||
@@ -278,7 +280,7 @@ static void indirect_print_item(struct item_head *ih, char *item) | |||
278 | unp = (__le32 *) item; | 280 | unp = (__le32 *) item; |
279 | 281 | ||
280 | if (ih_item_len(ih) % UNFM_P_SIZE) | 282 | if (ih_item_len(ih) % UNFM_P_SIZE) |
281 | reiserfs_warning(NULL, "indirect_print_item: invalid item len"); | 283 | reiserfs_warning(NULL, "reiserfs-16102", "invalid item len"); |
282 | 284 | ||
283 | printk("%d pointers\n[ ", (int)I_UNFM_NUM(ih)); | 285 | printk("%d pointers\n[ ", (int)I_UNFM_NUM(ih)); |
284 | for (j = 0; j < I_UNFM_NUM(ih); j++) { | 286 | for (j = 0; j < I_UNFM_NUM(ih); j++) { |
@@ -334,7 +336,8 @@ static int indirect_unit_num(struct virtual_item *vi) | |||
334 | 336 | ||
335 | static void indirect_print_vi(struct virtual_item *vi) | 337 | static void indirect_print_vi(struct virtual_item *vi) |
336 | { | 338 | { |
337 | reiserfs_warning(NULL, "INDIRECT, index %d, type 0x%x, %h", | 339 | reiserfs_warning(NULL, "reiserfs-16103", |
340 | "INDIRECT, index %d, type 0x%x, %h", | ||
338 | vi->vi_index, vi->vi_type, vi->vi_ih); | 341 | vi->vi_index, vi->vi_type, vi->vi_ih); |
339 | } | 342 | } |
340 | 343 | ||
@@ -359,7 +362,7 @@ static struct item_operations indirect_ops = { | |||
359 | 362 | ||
360 | static int direntry_bytes_number(struct item_head *ih, int block_size) | 363 | static int direntry_bytes_number(struct item_head *ih, int block_size) |
361 | { | 364 | { |
362 | reiserfs_warning(NULL, "vs-16090: direntry_bytes_number: " | 365 | reiserfs_warning(NULL, "vs-16090", |
363 | "bytes number is asked for direntry"); | 366 | "bytes number is asked for direntry"); |
364 | return 0; | 367 | return 0; |
365 | } | 368 | } |
@@ -614,7 +617,8 @@ static void direntry_print_vi(struct virtual_item *vi) | |||
614 | int i; | 617 | int i; |
615 | struct direntry_uarea *dir_u = vi->vi_uarea; | 618 | struct direntry_uarea *dir_u = vi->vi_uarea; |
616 | 619 | ||
617 | reiserfs_warning(NULL, "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x", | 620 | reiserfs_warning(NULL, "reiserfs-16104", |
621 | "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x", | ||
618 | vi->vi_index, vi->vi_type, vi->vi_ih, dir_u->flags); | 622 | vi->vi_index, vi->vi_type, vi->vi_ih, dir_u->flags); |
619 | printk("%d entries: ", dir_u->entry_count); | 623 | printk("%d entries: ", dir_u->entry_count); |
620 | for (i = 0; i < dir_u->entry_count; i++) | 624 | for (i = 0; i < dir_u->entry_count; i++) |
@@ -642,43 +646,43 @@ static struct item_operations direntry_ops = { | |||
642 | // | 646 | // |
643 | static int errcatch_bytes_number(struct item_head *ih, int block_size) | 647 | static int errcatch_bytes_number(struct item_head *ih, int block_size) |
644 | { | 648 | { |
645 | reiserfs_warning(NULL, | 649 | reiserfs_warning(NULL, "green-16001", |
646 | "green-16001: Invalid item type observed, run fsck ASAP"); | 650 | "Invalid item type observed, run fsck ASAP"); |
647 | return 0; | 651 | return 0; |
648 | } | 652 | } |
649 | 653 | ||
650 | static void errcatch_decrement_key(struct cpu_key *key) | 654 | static void errcatch_decrement_key(struct cpu_key *key) |
651 | { | 655 | { |
652 | reiserfs_warning(NULL, | 656 | reiserfs_warning(NULL, "green-16002", |
653 | "green-16002: Invalid item type observed, run fsck ASAP"); | 657 | "Invalid item type observed, run fsck ASAP"); |
654 | } | 658 | } |
655 | 659 | ||
656 | static int errcatch_is_left_mergeable(struct reiserfs_key *key, | 660 | static int errcatch_is_left_mergeable(struct reiserfs_key *key, |
657 | unsigned long bsize) | 661 | unsigned long bsize) |
658 | { | 662 | { |
659 | reiserfs_warning(NULL, | 663 | reiserfs_warning(NULL, "green-16003", |
660 | "green-16003: Invalid item type observed, run fsck ASAP"); | 664 | "Invalid item type observed, run fsck ASAP"); |
661 | return 0; | 665 | return 0; |
662 | } | 666 | } |
663 | 667 | ||
664 | static void errcatch_print_item(struct item_head *ih, char *item) | 668 | static void errcatch_print_item(struct item_head *ih, char *item) |
665 | { | 669 | { |
666 | reiserfs_warning(NULL, | 670 | reiserfs_warning(NULL, "green-16004", |
667 | "green-16004: Invalid item type observed, run fsck ASAP"); | 671 | "Invalid item type observed, run fsck ASAP"); |
668 | } | 672 | } |
669 | 673 | ||
670 | static void errcatch_check_item(struct item_head *ih, char *item) | 674 | static void errcatch_check_item(struct item_head *ih, char *item) |
671 | { | 675 | { |
672 | reiserfs_warning(NULL, | 676 | reiserfs_warning(NULL, "green-16005", |
673 | "green-16005: Invalid item type observed, run fsck ASAP"); | 677 | "Invalid item type observed, run fsck ASAP"); |
674 | } | 678 | } |
675 | 679 | ||
676 | static int errcatch_create_vi(struct virtual_node *vn, | 680 | static int errcatch_create_vi(struct virtual_node *vn, |
677 | struct virtual_item *vi, | 681 | struct virtual_item *vi, |
678 | int is_affected, int insert_size) | 682 | int is_affected, int insert_size) |
679 | { | 683 | { |
680 | reiserfs_warning(NULL, | 684 | reiserfs_warning(NULL, "green-16006", |
681 | "green-16006: Invalid item type observed, run fsck ASAP"); | 685 | "Invalid item type observed, run fsck ASAP"); |
682 | return 0; // We might return -1 here as well, but it won't help as create_virtual_node() from where | 686 | return 0; // We might return -1 here as well, but it won't help as create_virtual_node() from where |
683 | // this operation is called from is of return type void. | 687 | // this operation is called from is of return type void. |
684 | } | 688 | } |
@@ -686,36 +690,36 @@ static int errcatch_create_vi(struct virtual_node *vn, | |||
686 | static int errcatch_check_left(struct virtual_item *vi, int free, | 690 | static int errcatch_check_left(struct virtual_item *vi, int free, |
687 | int start_skip, int end_skip) | 691 | int start_skip, int end_skip) |
688 | { | 692 | { |
689 | reiserfs_warning(NULL, | 693 | reiserfs_warning(NULL, "green-16007", |
690 | "green-16007: Invalid item type observed, run fsck ASAP"); | 694 | "Invalid item type observed, run fsck ASAP"); |
691 | return -1; | 695 | return -1; |
692 | } | 696 | } |
693 | 697 | ||
694 | static int errcatch_check_right(struct virtual_item *vi, int free) | 698 | static int errcatch_check_right(struct virtual_item *vi, int free) |
695 | { | 699 | { |
696 | reiserfs_warning(NULL, | 700 | reiserfs_warning(NULL, "green-16008", |
697 | "green-16008: Invalid item type observed, run fsck ASAP"); | 701 | "Invalid item type observed, run fsck ASAP"); |
698 | return -1; | 702 | return -1; |
699 | } | 703 | } |
700 | 704 | ||
701 | static int errcatch_part_size(struct virtual_item *vi, int first, int count) | 705 | static int errcatch_part_size(struct virtual_item *vi, int first, int count) |
702 | { | 706 | { |
703 | reiserfs_warning(NULL, | 707 | reiserfs_warning(NULL, "green-16009", |
704 | "green-16009: Invalid item type observed, run fsck ASAP"); | 708 | "Invalid item type observed, run fsck ASAP"); |
705 | return 0; | 709 | return 0; |
706 | } | 710 | } |
707 | 711 | ||
708 | static int errcatch_unit_num(struct virtual_item *vi) | 712 | static int errcatch_unit_num(struct virtual_item *vi) |
709 | { | 713 | { |
710 | reiserfs_warning(NULL, | 714 | reiserfs_warning(NULL, "green-16010", |
711 | "green-16010: Invalid item type observed, run fsck ASAP"); | 715 | "Invalid item type observed, run fsck ASAP"); |
712 | return 0; | 716 | return 0; |
713 | } | 717 | } |
714 | 718 | ||
715 | static void errcatch_print_vi(struct virtual_item *vi) | 719 | static void errcatch_print_vi(struct virtual_item *vi) |
716 | { | 720 | { |
717 | reiserfs_warning(NULL, | 721 | reiserfs_warning(NULL, "green-16011", |
718 | "green-16011: Invalid item type observed, run fsck ASAP"); | 722 | "Invalid item type observed, run fsck ASAP"); |
719 | } | 723 | } |
720 | 724 | ||
721 | static struct item_operations errcatch_ops = { | 725 | static struct item_operations errcatch_ops = { |