]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.31/patches.suse/reiserfs-use-reiserfs_error.diff
Add a patch to fix Intel E100 wake-on-lan problems.
[ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.suse / reiserfs-use-reiserfs_error.diff
CommitLineData
6a930a95
BS
1From: Jeff Mahoney <jeffm@suse.com>
2Subject: reiserfs: use reiserfs_error()
3
4 This patch makes many paths that are currently using warnings to handle
5 the error.
6
7Signed-off-by: Jeff Mahoney <jeffm@suse.com>
8
9--
10
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(-)
21
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);
26
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));
34 return 0;
35 }
36
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;
39 if (block >= bmap1 &&
40 block <= bmap1 + bmap_count) {
41- reiserfs_warning(s, "vs-4019", "bitmap block %lu(%u) "
42- "can't be freed or reused",
43- block, bmap_count);
44+ reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) "
45+ "can't be freed or reused",
46+ block, bmap_count);
47 return 0;
48 }
49 } else {
50 if (offset == 0) {
51- reiserfs_warning(s, "vs-4020", "bitmap block %lu(%u) "
52- "can't be freed or reused",
53- block, bmap_count);
54+ reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) "
55+ "can't be freed or reused",
56+ block, bmap_count);
57 return 0;
58 }
59 }
60
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",
64- block, bmap);
65+ reiserfs_error(s, "vs-4030", "bitmap for requested block "
66+ "is out of range: block=%lu, bitmap_nr=%u",
67+ block, bmap);
68 return 0;
69 }
70
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));
76 return 0;
77 }
78
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. */
81
82 if (!bi) {
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);
87 return 0;
88 }
89
90@@ -399,8 +399,8 @@ static void _reiserfs_free_block(struct
91 get_bit_address(s, block, &nr, &offset);
92
93 if (nr >= reiserfs_bmap_count(s)) {
94- reiserfs_warning(s, "vs-4075", "block %lu is out of range",
95- block);
96+ reiserfs_error(s, "vs-4075", "block %lu is out of range",
97+ block);
98 return;
99 }
100
101@@ -412,8 +412,8 @@ static void _reiserfs_free_block(struct
102
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);
109 }
110 apbi[nr].free_count++;
111 journal_mark_dirty(th, s, bmbh);
112@@ -440,7 +440,7 @@ void reiserfs_free_block(struct reiserfs
113 return;
114
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.");
129 #endif
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
133 i_prealloc_list);
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.");
142 }
143 #endif
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);
147
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);
153
154 info->free_count = 0;
155
156--- a/fs/reiserfs/inode.c
157+++ b/fs/reiserfs/inode.c
158@@ -841,12 +841,12 @@ int reiserfs_get_block(struct inode *ino
159 tail_offset);
160 if (retval) {
161 if (retval != -ENOSPC)
162- reiserfs_warning(inode->i_sb,
163- "clm-6004",
164- "convert tail failed "
165- "inode %lu, error %d",
166- inode->i_ino,
167- retval);
168+ reiserfs_error(inode->i_sb,
169+ "clm-6004",
170+ "convert tail failed "
171+ "inode %lu, error %d",
172+ inode->i_ino,
173+ retval);
174 if (allocated_block_nr) {
175 /* the bitmap, the super, and the stat data == 3 */
176 if (!th)
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",
184- &key);
185+ reiserfs_error(inode->i_sb, "vs-13050",
186+ "i/o failure occurred trying to "
187+ "update %K stat data", &key);
188 return;
189 }
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);
202 return;
203 }
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");
212 return -EIO;
213 }
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");
223 return -EIO;
224 }
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
229 */
230- reiserfs_warning(p_s_inode->i_sb, "clm-6000",
231- "error reading block %lu on dev %s",
232- bh->b_blocknr,
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);
236 error = -EIO;
237 goto unlock;
238 }
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,
241 // which is ok.
242 if (error != -ENOENT)
243- reiserfs_warning(p_s_inode->i_sb, "clm-6001",
244- "grab_tail_page failed %d",
245- error);
246+ reiserfs_error(p_s_inode->i_sb, "clm-6001",
247+ "grab_tail_page failed %d",
248+ error);
249 page = NULL;
250 bh = NULL;
251 }
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;
256
257 if (prev && prev <= deh_location(&(deh[i])))
258- reiserfs_warning(NULL, "vs-10240",
259- "directory item (%h) "
260- "corrupted (prev %a, "
261- "cur(%d) %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, "
266+ "cur(%d) %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, "
272- "next %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, "
277+ "next %a)",
278+ ih, i, deh + i, deh + i + 1);
279 }
280 }
281 #endif
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
285 switch (retval) {
286 case ITEM_NOT_FOUND:
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");
292 pathrelse(path);
293 return IO_ERROR;
294 }
295@@ -135,7 +135,7 @@ int search_by_entry_key(struct super_blo
296
297 default:
298 pathrelse(path);
299- reiserfs_warning(sb, "vs-7002", "no path to here");
300+ reiserfs_error(sb, "vs-7002", "no path to here");
301 return IO_ERROR;
302 }
303
304@@ -298,7 +298,7 @@ static int reiserfs_find_entry(struct in
305 search_by_entry_key(dir->i_sb, &key_to_search,
306 path_to_entry, de);
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");
310 return IO_ERROR;
311 }
312
313@@ -490,9 +490,9 @@ static int reiserfs_add_entry(struct rei
314 }
315
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);
323 }
324
325 return -EEXIST;
326@@ -902,9 +902,9 @@ static int reiserfs_rmdir(struct inode *
327 goto end_rmdir;
328
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)",
332- inode->i_nlink);
333+ reiserfs_error(inode->i_sb, "reiserfs-7040",
334+ "empty directory has nlink != 2 (%d)",
335+ inode->i_nlink);
336
337 clear_nlink(inode);
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,
342 0) < 0)
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?");
347
348 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
349
350--- a/fs/reiserfs/objectid.c
351+++ b/fs/reiserfs/objectid.c
352@@ -159,8 +159,8 @@ void reiserfs_release_objectid(struct re
353 i += 2;
354 }
355
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);
360 }
361
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
367 // certain level
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);
376 return IO_ERROR;
377 }
378@@ -1336,9 +1336,9 @@ void reiserfs_delete_solid_item(struct r
379 while (1) {
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);
388 break;
389 }
390 if (retval != ITEM_FOUND) {
391@@ -1737,7 +1737,7 @@ static void truncate_directory(struct re
392 {
393 BUG_ON(!th->t_trans_id);
394 if (inode->i_nlink)
395- reiserfs_warning(inode->i_sb, "vs-5655", "link count != 0");
396+ reiserfs_error(inode->i_sb, "vs-5655", "link count != 0");
397
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,
402 &s_search_path);
403 if (retval == IO_ERROR) {
404- reiserfs_warning(p_s_inode->i_sb, "vs-5657",
405- "i/o failure occurred trying to truncate %K",
406- &s_item_key);
407+ reiserfs_error(p_s_inode->i_sb, "vs-5657",
408+ "i/o failure occurred trying to truncate %K",
409+ &s_item_key);
410 err = -EIO;
411 goto out;
412 }
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,
416- &s_item_key);
417+ reiserfs_error(p_s_inode->i_sb, "PAP-5660",
418+ "wrong result %d of search for %K", retval,
419+ &s_item_key);
420
421 err = -EIO;
422 goto out;
423--- a/fs/reiserfs/super.c
424+++ b/fs/reiserfs/super.c
425@@ -193,9 +193,8 @@ static int finish_unfinished(struct supe
426 while (!retval) {
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",
431- retval);
432+ reiserfs_error(s, "vs-2140",
433+ "search_by_key returned %d", retval);
434 break;
435 }
436
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,
443- retval);
444+ reiserfs_error(inode->i_sb, "vs-2100",
445+ "search_by_key (%K) returned %d", &key,
446+ retval);
447 pathrelse(&path);
448 return;
449 }
450@@ -391,8 +390,8 @@ void add_save_link(struct reiserfs_trans
451 reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link);
452 if (retval) {
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);
458 } else {
459 if (truncate)
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
464
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);
473 pathrelse(path);
474 return -EIO;
475 }
476--- a/fs/reiserfs/xattr.c
477+++ b/fs/reiserfs/xattr.c
478@@ -259,8 +259,8 @@ static int __xattr_readdir(struct inode
479 ih = de.de_ih;
480
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);
486 break;
487 }
488 copy_item_head(&tmp_ih, ih);
489@@ -653,15 +653,14 @@ __reiserfs_xattr_del(struct dentry *xadi
490 goto out_file;
491
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->
500- d_inode) ? "" :
501- "not ");
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) ? "" :
509+ "not ");
510 dput(dentry);
511 return -EIO;
512 }