aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/namei.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:16:36 -0400
commit45b03d5e8e674eb6555b767e1c8eb40b671ff892 (patch)
treed74acd1be7f5102143df960e8cd692aadcc437df /fs/reiserfs/namei.c
parent1d889d9958490888b3fad1d486145d9a03559cbc (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/namei.c')
-rw-r--r--fs/reiserfs/namei.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 738967f6c8ee..bb41c6e7c79b 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -120,8 +120,8 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
120 switch (retval) { 120 switch (retval) {
121 case ITEM_NOT_FOUND: 121 case ITEM_NOT_FOUND:
122 if (!PATH_LAST_POSITION(path)) { 122 if (!PATH_LAST_POSITION(path)) {
123 reiserfs_warning(sb, 123 reiserfs_warning(sb, "vs-7000", "search_by_key "
124 "vs-7000: search_by_entry_key: search_by_key returned item position == 0"); 124 "returned item position == 0");
125 pathrelse(path); 125 pathrelse(path);
126 return IO_ERROR; 126 return IO_ERROR;
127 } 127 }
@@ -135,8 +135,7 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
135 135
136 default: 136 default:
137 pathrelse(path); 137 pathrelse(path);
138 reiserfs_warning(sb, 138 reiserfs_warning(sb, "vs-7002", "no path to here");
139 "vs-7002: search_by_entry_key: no path to here");
140 return IO_ERROR; 139 return IO_ERROR;
141 } 140 }
142 141
@@ -300,8 +299,7 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
300 search_by_entry_key(dir->i_sb, &key_to_search, 299 search_by_entry_key(dir->i_sb, &key_to_search,
301 path_to_entry, de); 300 path_to_entry, de);
302 if (retval == IO_ERROR) { 301 if (retval == IO_ERROR) {
303 reiserfs_warning(dir->i_sb, "zam-7001: io error in %s", 302 reiserfs_warning(dir->i_sb, "zam-7001", "io error");
304 __func__);
305 return IO_ERROR; 303 return IO_ERROR;
306 } 304 }
307 305
@@ -484,10 +482,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
484 } 482 }
485 483
486 if (retval != NAME_FOUND) { 484 if (retval != NAME_FOUND) {
487 reiserfs_warning(dir->i_sb, 485 reiserfs_warning(dir->i_sb, "zam-7002",
488 "zam-7002:%s: \"reiserfs_find_entry\" " 486 "reiserfs_find_entry() returned "
489 "has returned unexpected value (%d)", 487 "unexpected value (%d)", retval);
490 __func__, retval);
491 } 488 }
492 489
493 return -EEXIST; 490 return -EEXIST;
@@ -498,8 +495,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
498 MAX_GENERATION_NUMBER + 1); 495 MAX_GENERATION_NUMBER + 1);
499 if (gen_number > MAX_GENERATION_NUMBER) { 496 if (gen_number > MAX_GENERATION_NUMBER) {
500 /* there is no free generation number */ 497 /* there is no free generation number */
501 reiserfs_warning(dir->i_sb, 498 reiserfs_warning(dir->i_sb, "reiserfs-7010",
502 "reiserfs_add_entry: Congratulations! we have got hash function screwed up"); 499 "Congratulations! we have got hash function "
500 "screwed up");
503 if (buffer != small_buf) 501 if (buffer != small_buf)
504 kfree(buffer); 502 kfree(buffer);
505 pathrelse(&path); 503 pathrelse(&path);
@@ -515,10 +513,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
515 if (gen_number != 0) { /* we need to re-search for the insertion point */ 513 if (gen_number != 0) { /* we need to re-search for the insertion point */
516 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) != 514 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) !=
517 NAME_NOT_FOUND) { 515 NAME_NOT_FOUND) {
518 reiserfs_warning(dir->i_sb, 516 reiserfs_warning(dir->i_sb, "vs-7032",
519 "vs-7032: reiserfs_add_entry: " 517 "entry with this key (%K) already "
520 "entry with this key (%K) already exists", 518 "exists", &entry_key);
521 &entry_key);
522 519
523 if (buffer != small_buf) 520 if (buffer != small_buf)
524 kfree(buffer); 521 kfree(buffer);
@@ -903,8 +900,9 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
903 goto end_rmdir; 900 goto end_rmdir;
904 901
905 if (inode->i_nlink != 2 && inode->i_nlink != 1) 902 if (inode->i_nlink != 2 && inode->i_nlink != 1)
906 reiserfs_warning(inode->i_sb, "%s: empty directory has nlink " 903 reiserfs_warning(inode->i_sb, "reiserfs-7040",
907 "!= 2 (%d)", __func__, inode->i_nlink); 904 "empty directory has nlink != 2 (%d)",
905 inode->i_nlink);
908 906
909 clear_nlink(inode); 907 clear_nlink(inode);
910 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 908 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
@@ -980,10 +978,9 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
980 } 978 }
981 979
982 if (!inode->i_nlink) { 980 if (!inode->i_nlink) {
983 reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file " 981 reiserfs_warning(inode->i_sb, "reiserfs-7042",
984 "(%s:%lu), %d", __func__, 982 "deleting nonexistent file (%lu), %d",
985 reiserfs_bdevname(inode->i_sb), inode->i_ino, 983 inode->i_ino, inode->i_nlink);
986 inode->i_nlink);
987 inode->i_nlink = 1; 984 inode->i_nlink = 1;
988 } 985 }
989 986
@@ -1499,8 +1496,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1499 if (reiserfs_cut_from_item 1496 if (reiserfs_cut_from_item
1500 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL, 1497 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
1501 0) < 0) 1498 0) < 0)
1502 reiserfs_warning(old_dir->i_sb, 1499 reiserfs_warning(old_dir->i_sb, "vs-7060",
1503 "vs-7060: reiserfs_rename: couldn't not cut old name. Fsck later?"); 1500 "couldn't not cut old name. Fsck later?");
1504 1501
1505 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen; 1502 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
1506 1503