1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: reiserfs: use reiserfs_error()
4 This patch makes many paths that are currently using warnings to handle
7 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
11 fs/reiserfs/bitmap.c | 56 +++++++++++++++++++++---------------------
12 fs/reiserfs/inode.c | 45 +++++++++++++++------------------
13 fs/reiserfs/lbalance.c | 20 +++++++--------
14 fs/reiserfs/namei.c | 24 +++++++++---------
15 fs/reiserfs/objectid.c | 4 +--
16 fs/reiserfs/stree.c | 26 +++++++++----------
17 fs/reiserfs/super.c | 15 +++++------
18 fs/reiserfs/tail_conversion.c | 6 ++--
19 fs/reiserfs/xattr.c | 21 +++++++--------
20 9 files changed, 107 insertions(+), 110 deletions(-)
22 --- a/fs/reiserfs/bitmap.c
23 +++ b/fs/reiserfs/bitmap.c
24 @@ -64,9 +64,9 @@ int is_reusable(struct super_block *s, b
25 unsigned int bmap_count = reiserfs_bmap_count(s);
27 if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
28 - reiserfs_warning(s, "vs-4010",
29 - "block number is out of range %lu (%u)",
30 - block, SB_BLOCK_COUNT(s));
31 + reiserfs_error(s, "vs-4010",
32 + "block number is out of range %lu (%u)",
33 + block, SB_BLOCK_COUNT(s));
37 @@ -79,30 +79,30 @@ int is_reusable(struct super_block *s, b
38 b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1;
40 block <= bmap1 + bmap_count) {
41 - reiserfs_warning(s, "vs-4019", "bitmap block %lu(%u) "
42 - "can't be freed or reused",
44 + reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) "
45 + "can't be freed or reused",
51 - reiserfs_warning(s, "vs-4020", "bitmap block %lu(%u) "
52 - "can't be freed or reused",
54 + reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) "
55 + "can't be freed or reused",
61 if (bmap >= bmap_count) {
62 - reiserfs_warning(s, "vs-4030", "bitmap for requested block "
63 - "is out of range: block=%lu, bitmap_nr=%u",
65 + reiserfs_error(s, "vs-4030", "bitmap for requested block "
66 + "is out of range: block=%lu, bitmap_nr=%u",
71 if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) {
72 - reiserfs_warning(s, "vs-4050", "this is root block (%u), "
73 - "it must be busy", SB_ROOT_BLOCK(s));
74 + reiserfs_error(s, "vs-4050", "this is root block (%u), "
75 + "it must be busy", SB_ROOT_BLOCK(s));
79 @@ -153,8 +153,8 @@ static int scan_bitmap_block(struct reis
80 /* - I mean `a window of zero bits' as in description of this function - Zam. */
83 - reiserfs_warning(s, "jdm-4055", "NULL bitmap info pointer "
84 - "for bitmap %d", bmap_n);
85 + reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer "
86 + "for bitmap %d", bmap_n);
90 @@ -399,8 +399,8 @@ static void _reiserfs_free_block(struct
91 get_bit_address(s, block, &nr, &offset);
93 if (nr >= reiserfs_bmap_count(s)) {
94 - reiserfs_warning(s, "vs-4075", "block %lu is out of range",
96 + reiserfs_error(s, "vs-4075", "block %lu is out of range",
101 @@ -412,8 +412,8 @@ static void _reiserfs_free_block(struct
103 /* clear bit for the given block in bit map */
104 if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) {
105 - reiserfs_warning(s, "vs-4080",
106 - "block %lu: bit already cleared", block);
107 + reiserfs_error(s, "vs-4080",
108 + "block %lu: bit already cleared", block);
110 apbi[nr].free_count++;
111 journal_mark_dirty(th, s, bmbh);
112 @@ -440,7 +440,7 @@ void reiserfs_free_block(struct reiserfs
115 if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
116 - reiserfs_panic(th->t_super, "bitmap-4072",
117 + reiserfs_error(th->t_super, "bitmap-4072",
118 "Trying to free block outside file system "
119 "boundaries (%lu > %lu)",
120 block, sb_block_count(REISERFS_SB(s)->s_rs));
121 @@ -472,8 +472,8 @@ static void __discard_prealloc(struct re
122 BUG_ON(!th->t_trans_id);
123 #ifdef CONFIG_REISERFS_CHECK
124 if (ei->i_prealloc_count < 0)
125 - reiserfs_warning(th->t_super, "zam-4001",
126 - "inode has negative prealloc blocks count.");
127 + reiserfs_error(th->t_super, "zam-4001",
128 + "inode has negative prealloc blocks count.");
130 while (ei->i_prealloc_count > 0) {
131 reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
132 @@ -509,9 +509,9 @@ void reiserfs_discard_all_prealloc(struc
134 #ifdef CONFIG_REISERFS_CHECK
135 if (!ei->i_prealloc_count) {
136 - reiserfs_warning(th->t_super, "zam-4001",
137 - "inode is in prealloc list but has "
138 - "no preallocated blocks.");
139 + reiserfs_error(th->t_super, "zam-4001",
140 + "inode is in prealloc list but has "
141 + "no preallocated blocks.");
144 __discard_prealloc(th, ei);
145 @@ -1214,7 +1214,9 @@ void reiserfs_cache_bitmap_metadata(stru
146 unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);
148 /* The first bit must ALWAYS be 1 */
149 - BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data));
150 + if (!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data))
151 + reiserfs_error(sb, "reiserfs-2025", "bitmap block %lu is "
152 + "corrupted: first bit must be 1", bh->b_blocknr);
154 info->free_count = 0;
156 --- a/fs/reiserfs/inode.c
157 +++ b/fs/reiserfs/inode.c
158 @@ -841,12 +841,12 @@ int reiserfs_get_block(struct inode *ino
161 if (retval != -ENOSPC)
162 - reiserfs_warning(inode->i_sb,
164 - "convert tail failed "
165 - "inode %lu, error %d",
168 + reiserfs_error(inode->i_sb,
170 + "convert tail failed "
171 + "inode %lu, error %d",
174 if (allocated_block_nr) {
175 /* the bitmap, the super, and the stat data == 3 */
177 @@ -1332,10 +1332,9 @@ void reiserfs_update_sd_size(struct reis
178 /* look for the object's stat data */
179 retval = search_item(inode->i_sb, &key, &path);
180 if (retval == IO_ERROR) {
181 - reiserfs_warning(inode->i_sb, "vs-13050",
182 - "i/o failure occurred trying to "
183 - "update %K stat data",
185 + reiserfs_error(inode->i_sb, "vs-13050",
186 + "i/o failure occurred trying to "
187 + "update %K stat data", &key);
190 if (retval == ITEM_NOT_FOUND) {
191 @@ -1424,9 +1423,9 @@ void reiserfs_read_locked_inode(struct i
192 /* look for the object's stat data */
193 retval = search_item(inode->i_sb, &key, &path_to_sd);
194 if (retval == IO_ERROR) {
195 - reiserfs_warning(inode->i_sb, "vs-13070",
196 - "i/o failure occurred trying to find "
197 - "stat data of %K", &key);
198 + reiserfs_error(inode->i_sb, "vs-13070",
199 + "i/o failure occurred trying to find "
200 + "stat data of %K", &key);
201 reiserfs_make_bad_inode(inode);
204 @@ -1687,8 +1686,8 @@ static int reiserfs_new_directory(struct
205 /* look for place in the tree for new item */
206 retval = search_item(sb, &key, path);
207 if (retval == IO_ERROR) {
208 - reiserfs_warning(sb, "vs-13080",
209 - "i/o failure occurred creating new directory");
210 + reiserfs_error(sb, "vs-13080",
211 + "i/o failure occurred creating new directory");
214 if (retval == ITEM_FOUND) {
215 @@ -1727,8 +1726,8 @@ static int reiserfs_new_symlink(struct r
216 /* look for place in the tree for new item */
217 retval = search_item(sb, &key, path);
218 if (retval == IO_ERROR) {
219 - reiserfs_warning(sb, "vs-13080",
220 - "i/o failure occurred creating new symlink");
221 + reiserfs_error(sb, "vs-13080",
222 + "i/o failure occurred creating new symlink");
225 if (retval == ITEM_FOUND) {
226 @@ -2048,10 +2047,8 @@ static int grab_tail_page(struct inode *
227 ** I've screwed up the code to find the buffer, or the code to
228 ** call prepare_write
230 - reiserfs_warning(p_s_inode->i_sb, "clm-6000",
231 - "error reading block %lu on dev %s",
233 - reiserfs_bdevname(p_s_inode->i_sb));
234 + reiserfs_error(p_s_inode->i_sb, "clm-6000",
235 + "error reading block %lu", bh->b_blocknr);
239 @@ -2093,9 +2090,9 @@ int reiserfs_truncate_file(struct inode
240 // and get_block_create_0 could not find a block to read in,
242 if (error != -ENOENT)
243 - reiserfs_warning(p_s_inode->i_sb, "clm-6001",
244 - "grab_tail_page failed %d",
246 + reiserfs_error(p_s_inode->i_sb, "clm-6001",
247 + "grab_tail_page failed %d",
252 --- a/fs/reiserfs/lbalance.c
253 +++ b/fs/reiserfs/lbalance.c
254 @@ -1291,17 +1291,17 @@ void leaf_paste_entries(struct buffer_in
255 prev = (i != 0) ? deh_location(&(deh[i - 1])) : 0;
257 if (prev && prev <= deh_location(&(deh[i])))
258 - reiserfs_warning(NULL, "vs-10240",
259 - "directory item (%h) "
260 - "corrupted (prev %a, "
262 - ih, deh + i - 1, i, deh + i);
263 + reiserfs_error(sb_from_bi(bi), "vs-10240",
264 + "directory item (%h) "
265 + "corrupted (prev %a, "
267 + ih, deh + i - 1, i, deh + i);
268 if (next && next >= deh_location(&(deh[i])))
269 - reiserfs_warning(NULL, "vs-10250",
270 - "directory item (%h) "
271 - "corrupted (cur(%d) %a, "
273 - ih, i, deh + i, deh + i + 1);
274 + reiserfs_error(sb_from_bi(bi), "vs-10250",
275 + "directory item (%h) "
276 + "corrupted (cur(%d) %a, "
278 + ih, i, deh + i, deh + i + 1);
282 --- a/fs/reiserfs/namei.c
283 +++ b/fs/reiserfs/namei.c
284 @@ -120,8 +120,8 @@ int search_by_entry_key(struct super_blo
287 if (!PATH_LAST_POSITION(path)) {
288 - reiserfs_warning(sb, "vs-7000", "search_by_key "
289 - "returned item position == 0");
290 + reiserfs_error(sb, "vs-7000", "search_by_key "
291 + "returned item position == 0");
295 @@ -135,7 +135,7 @@ int search_by_entry_key(struct super_blo
299 - reiserfs_warning(sb, "vs-7002", "no path to here");
300 + reiserfs_error(sb, "vs-7002", "no path to here");
304 @@ -298,7 +298,7 @@ static int reiserfs_find_entry(struct in
305 search_by_entry_key(dir->i_sb, &key_to_search,
307 if (retval == IO_ERROR) {
308 - reiserfs_warning(dir->i_sb, "zam-7001", "io error");
309 + reiserfs_error(dir->i_sb, "zam-7001", "io error");
313 @@ -490,9 +490,9 @@ static int reiserfs_add_entry(struct rei
316 if (retval != NAME_FOUND) {
317 - reiserfs_warning(dir->i_sb, "zam-7002",
318 - "reiserfs_find_entry() returned "
319 - "unexpected value (%d)", retval);
320 + reiserfs_error(dir->i_sb, "zam-7002",
321 + "reiserfs_find_entry() returned "
322 + "unexpected value (%d)", retval);
326 @@ -902,9 +902,9 @@ static int reiserfs_rmdir(struct inode *
329 if (inode->i_nlink != 2 && inode->i_nlink != 1)
330 - reiserfs_warning(inode->i_sb, "reiserfs-7040",
331 - "empty directory has nlink != 2 (%d)",
333 + reiserfs_error(inode->i_sb, "reiserfs-7040",
334 + "empty directory has nlink != 2 (%d)",
338 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
339 @@ -1495,8 +1495,8 @@ static int reiserfs_rename(struct inode
340 if (reiserfs_cut_from_item
341 (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
343 - reiserfs_warning(old_dir->i_sb, "vs-7060",
344 - "couldn't not cut old name. Fsck later?");
345 + reiserfs_error(old_dir->i_sb, "vs-7060",
346 + "couldn't not cut old name. Fsck later?");
348 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
350 --- a/fs/reiserfs/objectid.c
351 +++ b/fs/reiserfs/objectid.c
352 @@ -159,8 +159,8 @@ void reiserfs_release_objectid(struct re
356 - reiserfs_warning(s, "vs-15011", "tried to free free object id (%lu)",
357 - (long unsigned)objectid_to_release);
358 + reiserfs_error(s, "vs-15011", "tried to free free object id (%lu)",
359 + (long unsigned)objectid_to_release);
362 int reiserfs_convert_objectid_map_v1(struct super_block *s)
363 --- a/fs/reiserfs/stree.c
364 +++ b/fs/reiserfs/stree.c
365 @@ -720,9 +720,9 @@ int search_by_key(struct super_block *p_
366 // make sure, that the node contents look like a node of
368 if (!is_tree_node(p_s_bh, expected_level)) {
369 - reiserfs_warning(p_s_sb, "vs-5150",
370 - "invalid format found in block %ld. "
371 - "Fsck?", p_s_bh->b_blocknr);
372 + reiserfs_error(p_s_sb, "vs-5150",
373 + "invalid format found in block %ld. "
374 + "Fsck?", p_s_bh->b_blocknr);
375 pathrelse(p_s_search_path);
378 @@ -1336,9 +1336,9 @@ void reiserfs_delete_solid_item(struct r
380 retval = search_item(th->t_super, &cpu_key, &path);
381 if (retval == IO_ERROR) {
382 - reiserfs_warning(th->t_super, "vs-5350",
383 - "i/o failure occurred trying "
384 - "to delete %K", &cpu_key);
385 + reiserfs_error(th->t_super, "vs-5350",
386 + "i/o failure occurred trying "
387 + "to delete %K", &cpu_key);
390 if (retval != ITEM_FOUND) {
391 @@ -1737,7 +1737,7 @@ static void truncate_directory(struct re
393 BUG_ON(!th->t_trans_id);
395 - reiserfs_warning(inode->i_sb, "vs-5655", "link count != 0");
396 + reiserfs_error(inode->i_sb, "vs-5655", "link count != 0");
398 set_le_key_k_offset(KEY_FORMAT_3_5, INODE_PKEY(inode), DOT_OFFSET);
399 set_le_key_k_type(KEY_FORMAT_3_5, INODE_PKEY(inode), TYPE_DIRENTRY);
400 @@ -1790,16 +1790,16 @@ int reiserfs_do_truncate(struct reiserfs
401 search_for_position_by_key(p_s_inode->i_sb, &s_item_key,
403 if (retval == IO_ERROR) {
404 - reiserfs_warning(p_s_inode->i_sb, "vs-5657",
405 - "i/o failure occurred trying to truncate %K",
407 + reiserfs_error(p_s_inode->i_sb, "vs-5657",
408 + "i/o failure occurred trying to truncate %K",
413 if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) {
414 - reiserfs_warning(p_s_inode->i_sb, "PAP-5660",
415 - "wrong result %d of search for %K", retval,
417 + reiserfs_error(p_s_inode->i_sb, "PAP-5660",
418 + "wrong result %d of search for %K", retval,
423 --- a/fs/reiserfs/super.c
424 +++ b/fs/reiserfs/super.c
425 @@ -193,9 +193,8 @@ static int finish_unfinished(struct supe
427 retval = search_item(s, &max_cpu_key, &path);
428 if (retval != ITEM_NOT_FOUND) {
429 - reiserfs_warning(s, "vs-2140",
430 - "search_by_key returned %d",
432 + reiserfs_error(s, "vs-2140",
433 + "search_by_key returned %d", retval);
437 @@ -376,9 +375,9 @@ void add_save_link(struct reiserfs_trans
438 retval = search_item(inode->i_sb, &key, &path);
439 if (retval != ITEM_NOT_FOUND) {
440 if (retval != -ENOSPC)
441 - reiserfs_warning(inode->i_sb, "vs-2100",
442 - "search_by_key (%K) returned %d", &key,
444 + reiserfs_error(inode->i_sb, "vs-2100",
445 + "search_by_key (%K) returned %d", &key,
450 @@ -391,8 +390,8 @@ void add_save_link(struct reiserfs_trans
451 reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link);
453 if (retval != -ENOSPC)
454 - reiserfs_warning(inode->i_sb, "vs-2120",
455 - "insert_item returned %d", retval);
456 + reiserfs_error(inode->i_sb, "vs-2120",
457 + "insert_item returned %d", retval);
460 REISERFS_I(inode)->i_flags |=
461 --- a/fs/reiserfs/tail_conversion.c
462 +++ b/fs/reiserfs/tail_conversion.c
463 @@ -48,9 +48,9 @@ int direct2indirect(struct reiserfs_tran
465 // FIXME: we could avoid this
466 if (search_for_position_by_key(sb, &end_key, path) == POSITION_FOUND) {
467 - reiserfs_warning(sb, "PAP-14030",
468 - "pasted or inserted byte exists in "
469 - "the tree %K. Use fsck to repair.", &end_key);
470 + reiserfs_error(sb, "PAP-14030",
471 + "pasted or inserted byte exists in "
472 + "the tree %K. Use fsck to repair.", &end_key);
476 --- a/fs/reiserfs/xattr.c
477 +++ b/fs/reiserfs/xattr.c
478 @@ -259,8 +259,8 @@ static int __xattr_readdir(struct inode
481 if (!is_direntry_le_ih(ih)) {
482 - reiserfs_warning(inode->i_sb, "jdm-20000",
483 - "not direntry %h", ih);
484 + reiserfs_error(inode->i_sb, "jdm-20000",
485 + "not direntry %h", ih);
488 copy_item_head(&tmp_ih, ih);
489 @@ -653,15 +653,14 @@ __reiserfs_xattr_del(struct dentry *xadi
492 if (!is_reiserfs_priv_object(dentry->d_inode)) {
493 - reiserfs_warning(dir->i_sb, "jdm-20003",
494 - "OID %08x [%.*s/%.*s] doesn't have "
495 - "priv flag set [parent is %sset].",
496 - le32_to_cpu(INODE_PKEY(dentry->d_inode)->
497 - k_objectid), xadir->d_name.len,
498 - xadir->d_name.name, namelen, name,
499 - is_reiserfs_priv_object(xadir->
502 + reiserfs_error(dir->i_sb, "jdm-20003",
503 + "OID %08x [%.*s/%.*s] doesn't have "
504 + "priv flag set [parent is %sset].",
505 + le32_to_cpu(INODE_PKEY(dentry->d_inode)->
506 + k_objectid), xadir->d_name.len,
507 + xadir->d_name.name, namelen, name,
508 + is_reiserfs_priv_object(xadir->d_inode) ? "" :