]>
Commit | Line | Data |
---|---|---|
8f69975d BS |
1 | From: Jeff Mahoney <jeffm@suse.com> |
2 | Subject: reiserfs: rework reiserfs_panic | |
3 | ||
4 | ReiserFS panics can be somewhat inconsistent. | |
5 | In some cases: | |
6 | * a unique identifier may be associated with it | |
7 | * the function name may be included | |
8 | * the device may be printed separately | |
9 | ||
10 | This patch aims to make warnings more consistent. reiserfs_warning() prints | |
11 | the device name, so printing it a second time is not required. The function | |
12 | name for a warning is always helpful in debugging, so it is now automatically | |
13 | inserted into the output. Hans has stated that every warning should have | |
14 | a unique identifier. Some cases lack them, others really shouldn't have them. | |
15 | reiserfs_warning() now expects an id associated with each message. In the | |
16 | rare case where one isn't needed, "" will suffice. | |
17 | ||
18 | Signed-off-by: Jeff Mahoney <jeffm@suse.com> | |
19 | ||
20 | --- | |
21 | fs/reiserfs/do_balan.c | 67 +++++++++++++++++++++-------------------- | |
22 | fs/reiserfs/fix_node.c | 68 +++++++++++++++++++++--------------------- | |
23 | fs/reiserfs/ibalance.c | 12 +++---- | |
24 | fs/reiserfs/inode.c | 3 - | |
25 | fs/reiserfs/item_ops.c | 8 +++- | |
26 | fs/reiserfs/journal.c | 57 +++++++++++++++++------------------ | |
27 | fs/reiserfs/lbalance.c | 27 +++++++++------- | |
28 | fs/reiserfs/namei.c | 18 ++++------- | |
29 | fs/reiserfs/objectid.c | 3 - | |
30 | fs/reiserfs/prints.c | 33 +++++++++----------- | |
31 | fs/reiserfs/stree.c | 49 ++++++++++++++---------------- | |
32 | fs/reiserfs/tail_conversion.c | 10 ++---- | |
33 | include/linux/reiserfs_fs.h | 28 +++++++++++++---- | |
34 | 13 files changed, 200 insertions(+), 183 deletions(-) | |
35 | ||
36 | --- a/fs/reiserfs/do_balan.c | |
37 | +++ b/fs/reiserfs/do_balan.c | |
38 | @@ -153,8 +153,8 @@ static int balance_leaf_when_delete(stru | |
39 | ||
40 | default: | |
41 | print_cur_tb("12040"); | |
42 | - reiserfs_panic(tb->tb_sb, | |
43 | - "PAP-12040: balance_leaf_when_delete: unexpectable mode: %s(%d)", | |
44 | + reiserfs_panic(tb->tb_sb, "PAP-12040", | |
45 | + "unexpected mode: %s(%d)", | |
46 | (flag == | |
47 | M_PASTE) ? "PASTE" : ((flag == | |
48 | M_INSERT) ? "INSERT" : | |
49 | @@ -721,8 +721,9 @@ static int balance_leaf(struct tree_bala | |
50 | } | |
51 | break; | |
52 | default: /* cases d and t */ | |
53 | - reiserfs_panic(tb->tb_sb, | |
54 | - "PAP-12130: balance_leaf: lnum > 0: unexpectable mode: %s(%d)", | |
55 | + reiserfs_panic(tb->tb_sb, "PAP-12130", | |
56 | + "lnum > 0: unexpected mode: " | |
57 | + " %s(%d)", | |
58 | (flag == | |
59 | M_DELETE) ? "DELETE" : ((flag == | |
60 | M_CUT) | |
61 | @@ -1134,8 +1135,8 @@ static int balance_leaf(struct tree_bala | |
62 | } | |
63 | break; | |
64 | default: /* cases d and t */ | |
65 | - reiserfs_panic(tb->tb_sb, | |
66 | - "PAP-12175: balance_leaf: rnum > 0: unexpectable mode: %s(%d)", | |
67 | + reiserfs_panic(tb->tb_sb, "PAP-12175", | |
68 | + "rnum > 0: unexpected mode: %s(%d)", | |
69 | (flag == | |
70 | M_DELETE) ? "DELETE" : ((flag == | |
71 | M_CUT) ? "CUT" | |
72 | @@ -1165,8 +1166,8 @@ static int balance_leaf(struct tree_bala | |
73 | not set correctly */ | |
74 | if (tb->CFL[0]) { | |
75 | if (!tb->CFR[0]) | |
76 | - reiserfs_panic(tb->tb_sb, | |
77 | - "vs-12195: balance_leaf: CFR not initialized"); | |
78 | + reiserfs_panic(tb->tb_sb, "vs-12195", | |
79 | + "CFR not initialized"); | |
80 | copy_key(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), | |
81 | B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0])); | |
82 | do_balance_mark_internal_dirty(tb, tb->CFL[0], 0); | |
83 | @@ -1472,7 +1473,10 @@ static int balance_leaf(struct tree_bala | |
84 | && (pos_in_item != ih_item_len(ih_check) | |
85 | || tb->insert_size[0] <= 0)) | |
86 | reiserfs_panic(tb->tb_sb, | |
87 | - "PAP-12235: balance_leaf: pos_in_item must be equal to ih_item_len"); | |
88 | + "PAP-12235", | |
89 | + "pos_in_item " | |
90 | + "must be equal " | |
91 | + "to ih_item_len"); | |
92 | #endif /* CONFIG_REISERFS_CHECK */ | |
93 | ||
94 | leaf_mi = | |
95 | @@ -1532,8 +1536,8 @@ static int balance_leaf(struct tree_bala | |
96 | } | |
97 | break; | |
98 | default: /* cases d and t */ | |
99 | - reiserfs_panic(tb->tb_sb, | |
100 | - "PAP-12245: balance_leaf: blknum > 2: unexpectable mode: %s(%d)", | |
101 | + reiserfs_panic(tb->tb_sb, "PAP-12245", | |
102 | + "blknum > 2: unexpected mode: %s(%d)", | |
103 | (flag == | |
104 | M_DELETE) ? "DELETE" : ((flag == | |
105 | M_CUT) ? "CUT" | |
106 | @@ -1678,10 +1682,11 @@ static int balance_leaf(struct tree_bala | |
107 | print_cur_tb("12285"); | |
108 | reiserfs_panic(tb-> | |
109 | tb_sb, | |
110 | - "PAP-12285: balance_leaf: insert_size must be 0 (%d)", | |
111 | - tb-> | |
112 | - insert_size | |
113 | - [0]); | |
114 | + "PAP-12285", | |
115 | + "insert_size " | |
116 | + "must be 0 " | |
117 | + "(%d)", | |
118 | + tb->insert_size[0]); | |
119 | } | |
120 | } | |
121 | #endif /* CONFIG_REISERFS_CHECK */ | |
122 | @@ -1694,11 +1699,10 @@ static int balance_leaf(struct tree_bala | |
123 | if (flag == M_PASTE && tb->insert_size[0]) { | |
124 | print_cur_tb("12290"); | |
125 | reiserfs_panic(tb->tb_sb, | |
126 | - "PAP-12290: balance_leaf: insert_size is still not 0 (%d)", | |
127 | + "PAP-12290", "insert_size is still not 0 (%d)", | |
128 | tb->insert_size[0]); | |
129 | } | |
130 | #endif /* CONFIG_REISERFS_CHECK */ | |
131 | - | |
132 | return 0; | |
133 | } /* Leaf level of the tree is balanced (end of balance_leaf) */ | |
134 | ||
135 | @@ -1729,8 +1733,7 @@ struct buffer_head *get_FEB(struct tree_ | |
136 | break; | |
137 | ||
138 | if (i == MAX_FEB_SIZE) | |
139 | - reiserfs_panic(tb->tb_sb, | |
140 | - "vs-12300: get_FEB: FEB list is empty"); | |
141 | + reiserfs_panic(tb->tb_sb, "vs-12300", "FEB list is empty"); | |
142 | ||
143 | bi.tb = tb; | |
144 | bi.bi_bh = first_b = tb->FEB[i]; | |
145 | @@ -1871,8 +1874,8 @@ static void check_internal_node(struct s | |
146 | for (i = 0; i <= B_NR_ITEMS(bh); i++, dc++) { | |
147 | if (!is_reusable(s, dc_block_number(dc), 1)) { | |
148 | print_cur_tb(mes); | |
149 | - reiserfs_panic(s, | |
150 | - "PAP-12338: check_internal_node: invalid child pointer %y in %b", | |
151 | + reiserfs_panic(s, "PAP-12338", | |
152 | + "invalid child pointer %y in %b", | |
153 | dc, bh); | |
154 | } | |
155 | } | |
156 | @@ -1894,9 +1897,10 @@ static int check_before_balancing(struct | |
157 | int retval = 0; | |
158 | ||
159 | if (cur_tb) { | |
160 | - reiserfs_panic(tb->tb_sb, "vs-12335: check_before_balancing: " | |
161 | - "suspect that schedule occurred based on cur_tb not being null at this point in code. " | |
162 | - "do_balance cannot properly handle schedule occurring while it runs."); | |
163 | + reiserfs_panic(tb->tb_sb, "vs-12335", "suspect that schedule " | |
164 | + "occurred based on cur_tb not being null at " | |
165 | + "this point in code. do_balance cannot properly " | |
166 | + "handle schedule occurring while it runs."); | |
167 | } | |
168 | ||
169 | /* double check that buffers that we will modify are unlocked. (fix_nodes should already have | |
170 | @@ -1928,8 +1932,8 @@ static void check_after_balance_leaf(str | |
171 | dc_size(B_N_CHILD | |
172 | (tb->FL[0], get_left_neighbor_position(tb, 0)))) { | |
173 | print_cur_tb("12221"); | |
174 | - reiserfs_panic(tb->tb_sb, | |
175 | - "PAP-12355: check_after_balance_leaf: shift to left was incorrect"); | |
176 | + reiserfs_panic(tb->tb_sb, "PAP-12355", | |
177 | + "shift to left was incorrect"); | |
178 | } | |
179 | } | |
180 | if (tb->rnum[0]) { | |
181 | @@ -1938,8 +1942,8 @@ static void check_after_balance_leaf(str | |
182 | dc_size(B_N_CHILD | |
183 | (tb->FR[0], get_right_neighbor_position(tb, 0)))) { | |
184 | print_cur_tb("12222"); | |
185 | - reiserfs_panic(tb->tb_sb, | |
186 | - "PAP-12360: check_after_balance_leaf: shift to right was incorrect"); | |
187 | + reiserfs_panic(tb->tb_sb, "PAP-12360", | |
188 | + "shift to right was incorrect"); | |
189 | } | |
190 | } | |
191 | if (PATH_H_PBUFFER(tb->tb_path, 1) && | |
192 | @@ -1964,8 +1968,7 @@ static void check_after_balance_leaf(str | |
193 | (PATH_H_PBUFFER(tb->tb_path, 1), | |
194 | PATH_H_POSITION(tb->tb_path, 1))), | |
195 | right); | |
196 | - reiserfs_panic(tb->tb_sb, | |
197 | - "PAP-12365: check_after_balance_leaf: S is incorrect"); | |
198 | + reiserfs_panic(tb->tb_sb, "PAP-12365", "S is incorrect"); | |
199 | } | |
200 | } | |
201 | ||
202 | @@ -2100,8 +2103,8 @@ void do_balance(struct tree_balance *tb, | |
203 | tb->need_balance_dirty = 0; | |
204 | ||
205 | if (FILESYSTEM_CHANGED_TB(tb)) { | |
206 | - reiserfs_panic(tb->tb_sb, | |
207 | - "clm-6000: do_balance, fs generation has changed\n"); | |
208 | + reiserfs_panic(tb->tb_sb, "clm-6000", "fs generation has " | |
209 | + "changed"); | |
210 | } | |
211 | /* if we have no real work to do */ | |
212 | if (!tb->insert_size[0]) { | |
213 | --- a/fs/reiserfs/fix_node.c | |
214 | +++ b/fs/reiserfs/fix_node.c | |
215 | @@ -135,8 +135,7 @@ static void create_virtual_node(struct t | |
216 | vn->vn_free_ptr += | |
217 | op_create_vi(vn, vi, is_affected, tb->insert_size[0]); | |
218 | if (tb->vn_buf + tb->vn_buf_size < vn->vn_free_ptr) | |
219 | - reiserfs_panic(tb->tb_sb, | |
220 | - "vs-8030: create_virtual_node: " | |
221 | + reiserfs_panic(tb->tb_sb, "vs-8030", | |
222 | "virtual node space consumed"); | |
223 | ||
224 | if (!is_affected) | |
225 | @@ -186,8 +185,9 @@ static void create_virtual_node(struct t | |
226 | && I_ENTRY_COUNT(B_N_PITEM_HEAD(Sh, 0)) == 1)) { | |
227 | /* node contains more than 1 item, or item is not directory item, or this item contains more than 1 entry */ | |
228 | print_block(Sh, 0, -1, -1); | |
229 | - reiserfs_panic(tb->tb_sb, | |
230 | - "vs-8045: create_virtual_node: rdkey %k, affected item==%d (mode==%c) Must be %c", | |
231 | + reiserfs_panic(tb->tb_sb, "vs-8045", | |
232 | + "rdkey %k, affected item==%d " | |
233 | + "(mode==%c) Must be %c", | |
234 | key, vn->vn_affected_item_num, | |
235 | vn->vn_mode, M_DELETE); | |
236 | } | |
237 | @@ -1255,8 +1255,8 @@ static int ip_check_balance(struct tree_ | |
238 | /* Calculate balance parameters for creating new root. */ | |
239 | if (!Sh) { | |
240 | if (!h) | |
241 | - reiserfs_panic(tb->tb_sb, | |
242 | - "vs-8210: ip_check_balance: S[0] can not be 0"); | |
243 | + reiserfs_panic(tb->tb_sb, "vs-8210", | |
244 | + "S[0] can not be 0"); | |
245 | switch (n_ret_value = get_empty_nodes(tb, h)) { | |
246 | case CARRY_ON: | |
247 | set_parameters(tb, h, 0, 0, 1, NULL, -1, -1); | |
248 | @@ -1266,8 +1266,8 @@ static int ip_check_balance(struct tree_ | |
249 | case REPEAT_SEARCH: | |
250 | return n_ret_value; | |
251 | default: | |
252 | - reiserfs_panic(tb->tb_sb, | |
253 | - "vs-8215: ip_check_balance: incorrect return value of get_empty_nodes"); | |
254 | + reiserfs_panic(tb->tb_sb, "vs-8215", "incorrect " | |
255 | + "return value of get_empty_nodes"); | |
256 | } | |
257 | } | |
258 | ||
259 | @@ -2095,38 +2095,38 @@ static void tb_buffer_sanity_check(struc | |
260 | if (p_s_bh) { | |
261 | if (atomic_read(&(p_s_bh->b_count)) <= 0) { | |
262 | ||
263 | - reiserfs_panic(p_s_sb, | |
264 | - "jmacd-1: tb_buffer_sanity_check(): negative or zero reference counter for buffer %s[%d] (%b)\n", | |
265 | - descr, level, p_s_bh); | |
266 | + reiserfs_panic(p_s_sb, "jmacd-1", "negative or zero " | |
267 | + "reference counter for buffer %s[%d] " | |
268 | + "(%b)", descr, level, p_s_bh); | |
269 | } | |
270 | ||
271 | if (!buffer_uptodate(p_s_bh)) { | |
272 | - reiserfs_panic(p_s_sb, | |
273 | - "jmacd-2: tb_buffer_sanity_check(): buffer is not up to date %s[%d] (%b)\n", | |
274 | + reiserfs_panic(p_s_sb, "jmacd-2", "buffer is not up " | |
275 | + "to date %s[%d] (%b)", | |
276 | descr, level, p_s_bh); | |
277 | } | |
278 | ||
279 | if (!B_IS_IN_TREE(p_s_bh)) { | |
280 | - reiserfs_panic(p_s_sb, | |
281 | - "jmacd-3: tb_buffer_sanity_check(): buffer is not in tree %s[%d] (%b)\n", | |
282 | + reiserfs_panic(p_s_sb, "jmacd-3", "buffer is not " | |
283 | + "in tree %s[%d] (%b)", | |
284 | descr, level, p_s_bh); | |
285 | } | |
286 | ||
287 | if (p_s_bh->b_bdev != p_s_sb->s_bdev) { | |
288 | - reiserfs_panic(p_s_sb, | |
289 | - "jmacd-4: tb_buffer_sanity_check(): buffer has wrong device %s[%d] (%b)\n", | |
290 | + reiserfs_panic(p_s_sb, "jmacd-4", "buffer has wrong " | |
291 | + "device %s[%d] (%b)", | |
292 | descr, level, p_s_bh); | |
293 | } | |
294 | ||
295 | if (p_s_bh->b_size != p_s_sb->s_blocksize) { | |
296 | - reiserfs_panic(p_s_sb, | |
297 | - "jmacd-5: tb_buffer_sanity_check(): buffer has wrong blocksize %s[%d] (%b)\n", | |
298 | + reiserfs_panic(p_s_sb, "jmacd-5", "buffer has wrong " | |
299 | + "blocksize %s[%d] (%b)", | |
300 | descr, level, p_s_bh); | |
301 | } | |
302 | ||
303 | if (p_s_bh->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) { | |
304 | - reiserfs_panic(p_s_sb, | |
305 | - "jmacd-6: tb_buffer_sanity_check(): buffer block number too high %s[%d] (%b)\n", | |
306 | + reiserfs_panic(p_s_sb, "jmacd-6", "buffer block " | |
307 | + "number too high %s[%d] (%b)", | |
308 | descr, level, p_s_bh); | |
309 | } | |
310 | } | |
311 | @@ -2358,14 +2358,14 @@ int fix_nodes(int n_op_mode, struct tree | |
312 | #ifdef CONFIG_REISERFS_CHECK | |
313 | if (cur_tb) { | |
314 | print_cur_tb("fix_nodes"); | |
315 | - reiserfs_panic(p_s_tb->tb_sb, | |
316 | - "PAP-8305: fix_nodes: there is pending do_balance"); | |
317 | + reiserfs_panic(p_s_tb->tb_sb, "PAP-8305", | |
318 | + "there is pending do_balance"); | |
319 | } | |
320 | ||
321 | if (!buffer_uptodate(p_s_tbS0) || !B_IS_IN_TREE(p_s_tbS0)) { | |
322 | - reiserfs_panic(p_s_tb->tb_sb, | |
323 | - "PAP-8320: fix_nodes: S[0] (%b %z) is not uptodate " | |
324 | - "at the beginning of fix_nodes or not in tree (mode %c)", | |
325 | + reiserfs_panic(p_s_tb->tb_sb, "PAP-8320", "S[0] (%b %z) is " | |
326 | + "not uptodate at the beginning of fix_nodes " | |
327 | + "or not in tree (mode %c)", | |
328 | p_s_tbS0, p_s_tbS0, n_op_mode); | |
329 | } | |
330 | ||
331 | @@ -2373,24 +2373,26 @@ int fix_nodes(int n_op_mode, struct tree | |
332 | switch (n_op_mode) { | |
333 | case M_INSERT: | |
334 | if (n_item_num <= 0 || n_item_num > B_NR_ITEMS(p_s_tbS0)) | |
335 | - reiserfs_panic(p_s_tb->tb_sb, | |
336 | - "PAP-8330: fix_nodes: Incorrect item number %d (in S0 - %d) in case of insert", | |
337 | - n_item_num, B_NR_ITEMS(p_s_tbS0)); | |
338 | + reiserfs_panic(p_s_tb->tb_sb, "PAP-8330", "Incorrect " | |
339 | + "item number %d (in S0 - %d) in case " | |
340 | + "of insert", n_item_num, | |
341 | + B_NR_ITEMS(p_s_tbS0)); | |
342 | break; | |
343 | case M_PASTE: | |
344 | case M_DELETE: | |
345 | case M_CUT: | |
346 | if (n_item_num < 0 || n_item_num >= B_NR_ITEMS(p_s_tbS0)) { | |
347 | print_block(p_s_tbS0, 0, -1, -1); | |
348 | - reiserfs_panic(p_s_tb->tb_sb, | |
349 | - "PAP-8335: fix_nodes: Incorrect item number(%d); mode = %c insert_size = %d\n", | |
350 | + reiserfs_panic(p_s_tb->tb_sb, "PAP-8335", "Incorrect " | |
351 | + "item number(%d); mode = %c " | |
352 | + "insert_size = %d", | |
353 | n_item_num, n_op_mode, | |
354 | p_s_tb->insert_size[0]); | |
355 | } | |
356 | break; | |
357 | default: | |
358 | - reiserfs_panic(p_s_tb->tb_sb, | |
359 | - "PAP-8340: fix_nodes: Incorrect mode of operation"); | |
360 | + reiserfs_panic(p_s_tb->tb_sb, "PAP-8340", "Incorrect mode " | |
361 | + "of operation"); | |
362 | } | |
363 | #endif | |
364 | ||
365 | --- a/fs/reiserfs/ibalance.c | |
366 | +++ b/fs/reiserfs/ibalance.c | |
367 | @@ -105,8 +105,8 @@ static void internal_define_dest_src_inf | |
368 | break; | |
369 | ||
370 | default: | |
371 | - reiserfs_panic(tb->tb_sb, | |
372 | - "internal_define_dest_src_infos: shift type is unknown (%d)", | |
373 | + reiserfs_panic(tb->tb_sb, "ibalance-1", | |
374 | + "shift type is unknown (%d)", | |
375 | shift_mode); | |
376 | } | |
377 | } | |
378 | @@ -702,8 +702,8 @@ static void balance_internal_when_delete | |
379 | ||
380 | return; | |
381 | } | |
382 | - reiserfs_panic(tb->tb_sb, | |
383 | - "balance_internal_when_delete: unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d", | |
384 | + reiserfs_panic(tb->tb_sb, "ibalance-2", | |
385 | + "unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d", | |
386 | h, tb->lnum[h], h, tb->rnum[h]); | |
387 | } | |
388 | ||
389 | @@ -940,8 +940,8 @@ int balance_internal(struct tree_balance | |
390 | struct block_head *blkh; | |
391 | ||
392 | if (tb->blknum[h] != 1) | |
393 | - reiserfs_panic(NULL, | |
394 | - "balance_internal: One new node required for creating the new root"); | |
395 | + reiserfs_panic(NULL, "ibalance-3", "One new node " | |
396 | + "required for creating the new root"); | |
397 | /* S[h] = empty buffer from the list FEB. */ | |
398 | tbSh = get_FEB(tb); | |
399 | blkh = B_BLK_HEAD(tbSh); | |
400 | --- a/fs/reiserfs/inode.c | |
401 | +++ b/fs/reiserfs/inode.c | |
402 | @@ -1300,8 +1300,7 @@ static void update_stat_data(struct tree | |
403 | ih = PATH_PITEM_HEAD(path); | |
404 | ||
405 | if (!is_statdata_le_ih(ih)) | |
406 | - reiserfs_panic(inode->i_sb, | |
407 | - "vs-13065: update_stat_data: key %k, found item %h", | |
408 | + reiserfs_panic(inode->i_sb, "vs-13065", "key %k, found item %h", | |
409 | INODE_PKEY(inode), ih); | |
410 | ||
411 | if (stat_data_v1(ih)) { | |
412 | --- a/fs/reiserfs/item_ops.c | |
413 | +++ b/fs/reiserfs/item_ops.c | |
414 | @@ -517,8 +517,9 @@ static int direntry_create_vi(struct vir | |
415 | ((is_affected | |
416 | && (vn->vn_mode == M_PASTE | |
417 | || vn->vn_mode == M_CUT)) ? insert_size : 0)) { | |
418 | - reiserfs_panic(NULL, | |
419 | - "vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item", | |
420 | + reiserfs_panic(NULL, "vs-8025", "(mode==%c, " | |
421 | + "insert_size==%d), invalid length of " | |
422 | + "directory item", | |
423 | vn->vn_mode, insert_size); | |
424 | } | |
425 | } | |
426 | @@ -549,7 +550,8 @@ static int direntry_check_left(struct vi | |
427 | } | |
428 | ||
429 | if (entries == dir_u->entry_count) { | |
430 | - reiserfs_panic(NULL, "free space %d, entry_count %d\n", free, | |
431 | + reiserfs_panic(NULL, "item_ops-1", | |
432 | + "free space %d, entry_count %d", free, | |
433 | dir_u->entry_count); | |
434 | } | |
435 | ||
436 | --- a/fs/reiserfs/journal.c | |
437 | +++ b/fs/reiserfs/journal.c | |
438 | @@ -436,8 +436,8 @@ void reiserfs_check_lock_depth(struct su | |
439 | { | |
440 | #ifdef CONFIG_SMP | |
441 | if (current->lock_depth < 0) { | |
442 | - reiserfs_panic(sb, "%s called without kernel lock held", | |
443 | - caller); | |
444 | + reiserfs_panic(sb, "journal-1", "%s called without kernel " | |
445 | + "lock held", caller); | |
446 | } | |
447 | #else | |
448 | ; | |
449 | @@ -574,7 +574,7 @@ static inline void put_journal_list(stru | |
450 | struct reiserfs_journal_list *jl) | |
451 | { | |
452 | if (jl->j_refcount < 1) { | |
453 | - reiserfs_panic(s, "trans id %u, refcount at %d", | |
454 | + reiserfs_panic(s, "journal-2", "trans id %u, refcount at %d", | |
455 | jl->j_trans_id, jl->j_refcount); | |
456 | } | |
457 | if (--jl->j_refcount == 0) | |
458 | @@ -1416,8 +1416,7 @@ static int flush_journal_list(struct sup | |
459 | ||
460 | count = 0; | |
461 | if (j_len_saved > journal->j_trans_max) { | |
462 | - reiserfs_panic(s, | |
463 | - "journal-715: flush_journal_list, length is %lu, trans id %lu\n", | |
464 | + reiserfs_panic(s, "journal-715", "length is %lu, trans id %lu", | |
465 | j_len_saved, jl->j_trans_id); | |
466 | return 0; | |
467 | } | |
468 | @@ -1449,8 +1448,8 @@ static int flush_journal_list(struct sup | |
469 | ** or wait on a more recent transaction, or just ignore it | |
470 | */ | |
471 | if (atomic_read(&(journal->j_wcount)) != 0) { | |
472 | - reiserfs_panic(s, | |
473 | - "journal-844: panic journal list is flushing, wcount is not 0\n"); | |
474 | + reiserfs_panic(s, "journal-844", "journal list is flushing, " | |
475 | + "wcount is not 0"); | |
476 | } | |
477 | cn = jl->j_realblock; | |
478 | while (cn) { | |
479 | @@ -1551,13 +1550,13 @@ static int flush_journal_list(struct sup | |
480 | while (cn) { | |
481 | if (test_bit(BLOCK_NEEDS_FLUSH, &cn->state)) { | |
482 | if (!cn->bh) { | |
483 | - reiserfs_panic(s, | |
484 | - "journal-1011: cn->bh is NULL\n"); | |
485 | + reiserfs_panic(s, "journal-1011", | |
486 | + "cn->bh is NULL"); | |
487 | } | |
488 | wait_on_buffer(cn->bh); | |
489 | if (!cn->bh) { | |
490 | - reiserfs_panic(s, | |
491 | - "journal-1012: cn->bh is NULL\n"); | |
492 | + reiserfs_panic(s, "journal-1012", | |
493 | + "cn->bh is NULL"); | |
494 | } | |
495 | if (unlikely(!buffer_uptodate(cn->bh))) { | |
496 | #ifdef CONFIG_REISERFS_CHECK | |
497 | @@ -3252,8 +3251,8 @@ int journal_mark_dirty(struct reiserfs_t | |
498 | ||
499 | PROC_INFO_INC(p_s_sb, journal.mark_dirty); | |
500 | if (th->t_trans_id != journal->j_trans_id) { | |
501 | - reiserfs_panic(th->t_super, | |
502 | - "journal-1577: handle trans id %ld != current trans id %ld\n", | |
503 | + reiserfs_panic(th->t_super, "journal-1577", | |
504 | + "handle trans id %ld != current trans id %ld", | |
505 | th->t_trans_id, journal->j_trans_id); | |
506 | } | |
507 | ||
508 | @@ -3292,8 +3291,8 @@ int journal_mark_dirty(struct reiserfs_t | |
509 | ** Nothing can be done here, except make the FS readonly or panic. | |
510 | */ | |
511 | if (journal->j_len >= journal->j_trans_max) { | |
512 | - reiserfs_panic(th->t_super, | |
513 | - "journal-1413: journal_mark_dirty: j_len (%lu) is too big\n", | |
514 | + reiserfs_panic(th->t_super, "journal-1413", | |
515 | + "j_len (%lu) is too big", | |
516 | journal->j_len); | |
517 | } | |
518 | ||
519 | @@ -3313,7 +3312,8 @@ int journal_mark_dirty(struct reiserfs_t | |
520 | if (!cn) { | |
521 | cn = get_cnode(p_s_sb); | |
522 | if (!cn) { | |
523 | - reiserfs_panic(p_s_sb, "get_cnode failed!\n"); | |
524 | + reiserfs_panic(p_s_sb, "journal-4", | |
525 | + "get_cnode failed!"); | |
526 | } | |
527 | ||
528 | if (th->t_blocks_logged == th->t_blocks_allocated) { | |
529 | @@ -3581,8 +3581,8 @@ static int check_journal_end(struct reis | |
530 | BUG_ON(!th->t_trans_id); | |
531 | ||
532 | if (th->t_trans_id != journal->j_trans_id) { | |
533 | - reiserfs_panic(th->t_super, | |
534 | - "journal-1577: handle trans id %ld != current trans id %ld\n", | |
535 | + reiserfs_panic(th->t_super, "journal-1577", | |
536 | + "handle trans id %ld != current trans id %ld", | |
537 | th->t_trans_id, journal->j_trans_id); | |
538 | } | |
539 | ||
540 | @@ -3661,8 +3661,8 @@ static int check_journal_end(struct reis | |
541 | } | |
542 | ||
543 | if (journal->j_start > SB_ONDISK_JOURNAL_SIZE(p_s_sb)) { | |
544 | - reiserfs_panic(p_s_sb, | |
545 | - "journal-003: journal_end: j_start (%ld) is too high\n", | |
546 | + reiserfs_panic(p_s_sb, "journal-003", | |
547 | + "j_start (%ld) is too high", | |
548 | journal->j_start); | |
549 | } | |
550 | return 1; | |
551 | @@ -3707,8 +3707,8 @@ int journal_mark_freed(struct reiserfs_t | |
552 | /* set the bit for this block in the journal bitmap for this transaction */ | |
553 | jb = journal->j_current_jl->j_list_bitmap; | |
554 | if (!jb) { | |
555 | - reiserfs_panic(p_s_sb, | |
556 | - "journal-1702: journal_mark_freed, journal_list_bitmap is NULL\n"); | |
557 | + reiserfs_panic(p_s_sb, "journal-1702", | |
558 | + "journal_list_bitmap is NULL"); | |
559 | } | |
560 | set_bit_in_list_bitmap(p_s_sb, blocknr, jb); | |
561 | ||
562 | @@ -4063,8 +4063,8 @@ static int do_journal_end(struct reiserf | |
563 | if (buffer_journaled(cn->bh)) { | |
564 | jl_cn = get_cnode(p_s_sb); | |
565 | if (!jl_cn) { | |
566 | - reiserfs_panic(p_s_sb, | |
567 | - "journal-1676, get_cnode returned NULL\n"); | |
568 | + reiserfs_panic(p_s_sb, "journal-1676", | |
569 | + "get_cnode returned NULL"); | |
570 | } | |
571 | if (i == 0) { | |
572 | jl->j_realblock = jl_cn; | |
573 | @@ -4080,8 +4080,9 @@ static int do_journal_end(struct reiserf | |
574 | ||
575 | if (is_block_in_log_or_reserved_area | |
576 | (p_s_sb, cn->bh->b_blocknr)) { | |
577 | - reiserfs_panic(p_s_sb, | |
578 | - "journal-2332: Trying to log block %lu, which is a log block\n", | |
579 | + reiserfs_panic(p_s_sb, "journal-2332", | |
580 | + "Trying to log block %lu, " | |
581 | + "which is a log block", | |
582 | cn->bh->b_blocknr); | |
583 | } | |
584 | jl_cn->blocknr = cn->bh->b_blocknr; | |
585 | @@ -4265,8 +4266,8 @@ static int do_journal_end(struct reiserf | |
586 | get_list_bitmap(p_s_sb, journal->j_current_jl); | |
587 | ||
588 | if (!(journal->j_current_jl->j_list_bitmap)) { | |
589 | - reiserfs_panic(p_s_sb, | |
590 | - "journal-1996: do_journal_end, could not get a list bitmap\n"); | |
591 | + reiserfs_panic(p_s_sb, "journal-1996", | |
592 | + "could not get a list bitmap"); | |
593 | } | |
594 | ||
595 | atomic_set(&(journal->j_jlock), 0); | |
596 | --- a/fs/reiserfs/lbalance.c | |
597 | +++ b/fs/reiserfs/lbalance.c | |
598 | @@ -168,10 +168,11 @@ static int leaf_copy_boundary_item(struc | |
599 | if (bytes_or_entries == ih_item_len(ih) | |
600 | && is_indirect_le_ih(ih)) | |
601 | if (get_ih_free_space(ih)) | |
602 | - reiserfs_panic(NULL, | |
603 | - "vs-10020: leaf_copy_boundary_item: " | |
604 | - "last unformatted node must be filled entirely (%h)", | |
605 | - ih); | |
606 | + reiserfs_panic(sb_from_bi(dest_bi), | |
607 | + "vs-10020", | |
608 | + "last unformatted node " | |
609 | + "must be filled " | |
610 | + "entirely (%h)", ih); | |
611 | } | |
612 | #endif | |
613 | ||
614 | @@ -622,9 +623,8 @@ static void leaf_define_dest_src_infos(i | |
615 | break; | |
616 | ||
617 | default: | |
618 | - reiserfs_panic(NULL, | |
619 | - "vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)", | |
620 | - shift_mode); | |
621 | + reiserfs_panic(sb_from_bi(src_bi), "vs-10250", | |
622 | + "shift type is unknown (%d)", shift_mode); | |
623 | } | |
624 | RFALSE(!src_bi->bi_bh || !dest_bi->bi_bh, | |
625 | "vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly", | |
626 | @@ -674,9 +674,9 @@ int leaf_shift_left(struct tree_balance | |
627 | #ifdef CONFIG_REISERFS_CHECK | |
628 | if (tb->tb_mode == M_PASTE || tb->tb_mode == M_INSERT) { | |
629 | print_cur_tb("vs-10275"); | |
630 | - reiserfs_panic(tb->tb_sb, | |
631 | - "vs-10275: leaf_shift_left: balance condition corrupted (%c)", | |
632 | - tb->tb_mode); | |
633 | + reiserfs_panic(tb->tb_sb, "vs-10275", | |
634 | + "balance condition corrupted " | |
635 | + "(%c)", tb->tb_mode); | |
636 | } | |
637 | #endif | |
638 | ||
639 | @@ -889,9 +889,12 @@ void leaf_paste_in_buffer(struct buffer_ | |
640 | ||
641 | #ifdef CONFIG_REISERFS_CHECK | |
642 | if (zeros_number > paste_size) { | |
643 | + struct super_block *sb = NULL; | |
644 | + if (bi && bi->tb) | |
645 | + sb = bi->tb->tb_sb; | |
646 | print_cur_tb("10177"); | |
647 | - reiserfs_panic(NULL, | |
648 | - "vs-10177: leaf_paste_in_buffer: ero number == %d, paste_size == %d", | |
649 | + reiserfs_panic(sb, "vs-10177", | |
650 | + "zeros_number == %d, paste_size == %d", | |
651 | zeros_number, paste_size); | |
652 | } | |
653 | #endif /* CONFIG_REISERFS_CHECK */ | |
654 | --- a/fs/reiserfs/namei.c | |
655 | +++ b/fs/reiserfs/namei.c | |
656 | @@ -145,10 +145,9 @@ int search_by_entry_key(struct super_blo | |
657 | if (!is_direntry_le_ih(de->de_ih) || | |
658 | COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) { | |
659 | print_block(de->de_bh, 0, -1, -1); | |
660 | - reiserfs_panic(sb, | |
661 | - "vs-7005: search_by_entry_key: found item %h is not directory item or " | |
662 | - "does not belong to the same directory as key %K", | |
663 | - de->de_ih, key); | |
664 | + reiserfs_panic(sb, "vs-7005", "found item %h is not directory " | |
665 | + "item or does not belong to the same directory " | |
666 | + "as key %K", de->de_ih, key); | |
667 | } | |
668 | #endif /* CONFIG_REISERFS_CHECK */ | |
669 | ||
670 | @@ -1194,15 +1193,14 @@ static int entry_points_to_object(const | |
671 | ||
672 | if (inode) { | |
673 | if (!de_visible(de->de_deh + de->de_entry_num)) | |
674 | - reiserfs_panic(NULL, | |
675 | - "vs-7042: entry_points_to_object: entry must be visible"); | |
676 | + reiserfs_panic(inode->i_sb, "vs-7042", | |
677 | + "entry must be visible"); | |
678 | return (de->de_objectid == inode->i_ino) ? 1 : 0; | |
679 | } | |
680 | ||
681 | /* this must be added hidden entry */ | |
682 | if (de_visible(de->de_deh + de->de_entry_num)) | |
683 | - reiserfs_panic(NULL, | |
684 | - "vs-7043: entry_points_to_object: entry must be visible"); | |
685 | + reiserfs_panic(NULL, "vs-7043", "entry must be visible"); | |
686 | ||
687 | return 1; | |
688 | } | |
689 | @@ -1316,8 +1314,8 @@ static int reiserfs_rename(struct inode | |
690 | new_dentry->d_name.len, old_inode, 0); | |
691 | if (retval == -EEXIST) { | |
692 | if (!new_dentry_inode) { | |
693 | - reiserfs_panic(old_dir->i_sb, | |
694 | - "vs-7050: new entry is found, new inode == 0\n"); | |
695 | + reiserfs_panic(old_dir->i_sb, "vs-7050", | |
696 | + "new entry is found, new inode == 0"); | |
697 | } | |
698 | } else if (retval) { | |
699 | int err = journal_end(&th, old_dir->i_sb, jbegin_count); | |
700 | --- a/fs/reiserfs/objectid.c | |
701 | +++ b/fs/reiserfs/objectid.c | |
702 | @@ -18,8 +18,7 @@ | |
703 | static void check_objectid_map(struct super_block *s, __le32 * map) | |
704 | { | |
705 | if (le32_to_cpu(map[0]) != 1) | |
706 | - reiserfs_panic(s, | |
707 | - "vs-15010: check_objectid_map: map corrupted: %lx", | |
708 | + reiserfs_panic(s, "vs-15010", "map corrupted: %lx", | |
709 | (long unsigned int)le32_to_cpu(map[0])); | |
710 | ||
711 | // FIXME: add something else here | |
712 | --- a/fs/reiserfs/prints.c | |
713 | +++ b/fs/reiserfs/prints.c | |
714 | @@ -356,14 +356,21 @@ void reiserfs_debug(struct super_block * | |
715 | extern struct tree_balance *cur_tb; | |
716 | #endif | |
717 | ||
718 | -void reiserfs_panic(struct super_block *sb, const char *fmt, ...) | |
719 | +void __reiserfs_panic(struct super_block *sb, const char *id, | |
720 | + const char *function, const char *fmt, ...) | |
721 | { | |
722 | do_reiserfs_warning(fmt); | |
723 | ||
724 | +#ifdef CONFIG_REISERFS_CHECK | |
725 | dump_stack(); | |
726 | - | |
727 | - panic(KERN_EMERG "REISERFS: panic (device %s): %s\n", | |
728 | - reiserfs_bdevname(sb), error_buf); | |
729 | +#endif | |
730 | + if (sb) | |
731 | + panic(KERN_WARNING "REISERFS panic (device %s): %s%s%s: %s\n", | |
732 | + sb->s_id, id ? id : "", id ? " " : "", | |
733 | + function, error_buf); | |
734 | + else | |
735 | + panic(KERN_WARNING "REISERFS panic: %s%s%s: %s\n", | |
736 | + id ? id : "", id ? " " : "", function, error_buf); | |
737 | } | |
738 | ||
739 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...) | |
740 | @@ -684,12 +691,10 @@ static void check_leaf_block_head(struct | |
741 | blkh = B_BLK_HEAD(bh); | |
742 | nr = blkh_nr_item(blkh); | |
743 | if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE) | |
744 | - reiserfs_panic(NULL, | |
745 | - "vs-6010: check_leaf_block_head: invalid item number %z", | |
746 | + reiserfs_panic(NULL, "vs-6010", "invalid item number %z", | |
747 | bh); | |
748 | if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr) | |
749 | - reiserfs_panic(NULL, | |
750 | - "vs-6020: check_leaf_block_head: invalid free space %z", | |
751 | + reiserfs_panic(NULL, "vs-6020", "invalid free space %z", | |
752 | bh); | |
753 | ||
754 | } | |
755 | @@ -700,21 +705,15 @@ static void check_internal_block_head(st | |
756 | ||
757 | blkh = B_BLK_HEAD(bh); | |
758 | if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT)) | |
759 | - reiserfs_panic(NULL, | |
760 | - "vs-6025: check_internal_block_head: invalid level %z", | |
761 | - bh); | |
762 | + reiserfs_panic(NULL, "vs-6025", "invalid level %z", bh); | |
763 | ||
764 | if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE) | |
765 | - reiserfs_panic(NULL, | |
766 | - "vs-6030: check_internal_block_head: invalid item number %z", | |
767 | - bh); | |
768 | + reiserfs_panic(NULL, "vs-6030", "invalid item number %z", bh); | |
769 | ||
770 | if (B_FREE_SPACE(bh) != | |
771 | bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) - | |
772 | DC_SIZE * (B_NR_ITEMS(bh) + 1)) | |
773 | - reiserfs_panic(NULL, | |
774 | - "vs-6040: check_internal_block_head: invalid free space %z", | |
775 | - bh); | |
776 | + reiserfs_panic(NULL, "vs-6040", "invalid free space %z", bh); | |
777 | ||
778 | } | |
779 | ||
780 | --- a/fs/reiserfs/stree.c | |
781 | +++ b/fs/reiserfs/stree.c | |
782 | @@ -366,9 +366,8 @@ inline void decrement_bcount(struct buff | |
783 | put_bh(p_s_bh); | |
784 | return; | |
785 | } | |
786 | - reiserfs_panic(NULL, | |
787 | - "PAP-5070: decrement_bcount: trying to free free buffer %b", | |
788 | - p_s_bh); | |
789 | + reiserfs_panic(NULL, "PAP-5070", | |
790 | + "trying to free free buffer %b", p_s_bh); | |
791 | } | |
792 | } | |
793 | ||
794 | @@ -713,8 +712,8 @@ int search_by_key(struct super_block *p_ | |
795 | #ifdef CONFIG_REISERFS_CHECK | |
796 | if (cur_tb) { | |
797 | print_cur_tb("5140"); | |
798 | - reiserfs_panic(p_s_sb, | |
799 | - "PAP-5140: search_by_key: schedule occurred in do_balance!"); | |
800 | + reiserfs_panic(p_s_sb, "PAP-5140", | |
801 | + "schedule occurred in do_balance!"); | |
802 | } | |
803 | #endif | |
804 | ||
805 | @@ -1511,8 +1510,8 @@ static void indirect_to_direct_roll_back | |
806 | /* look for the last byte of the tail */ | |
807 | if (search_for_position_by_key(inode->i_sb, &tail_key, path) == | |
808 | POSITION_NOT_FOUND) | |
809 | - reiserfs_panic(inode->i_sb, | |
810 | - "vs-5615: indirect_to_direct_roll_back: found invalid item"); | |
811 | + reiserfs_panic(inode->i_sb, "vs-5615", | |
812 | + "found invalid item"); | |
813 | RFALSE(path->pos_in_item != | |
814 | ih_item_len(PATH_PITEM_HEAD(path)) - 1, | |
815 | "vs-5616: appended bytes found"); | |
816 | @@ -1612,8 +1611,8 @@ int reiserfs_cut_from_item(struct reiser | |
817 | print_block(PATH_PLAST_BUFFER(p_s_path), 3, | |
818 | PATH_LAST_POSITION(p_s_path) - 1, | |
819 | PATH_LAST_POSITION(p_s_path) + 1); | |
820 | - reiserfs_panic(p_s_sb, | |
821 | - "PAP-5580: reiserfs_cut_from_item: item to convert does not exist (%K)", | |
822 | + reiserfs_panic(p_s_sb, "PAP-5580", "item to " | |
823 | + "convert does not exist (%K)", | |
824 | p_s_item_key); | |
825 | } | |
826 | continue; | |
827 | @@ -1693,22 +1692,20 @@ int reiserfs_cut_from_item(struct reiser | |
828 | sure, that we exactly remove last unformatted node pointer | |
829 | of the item */ | |
830 | if (!is_indirect_le_ih(le_ih)) | |
831 | - reiserfs_panic(p_s_sb, | |
832 | - "vs-5652: reiserfs_cut_from_item: " | |
833 | + reiserfs_panic(p_s_sb, "vs-5652", | |
834 | "item must be indirect %h", le_ih); | |
835 | ||
836 | if (c_mode == M_DELETE && ih_item_len(le_ih) != UNFM_P_SIZE) | |
837 | - reiserfs_panic(p_s_sb, | |
838 | - "vs-5653: reiserfs_cut_from_item: " | |
839 | - "completing indirect2direct conversion indirect item %h " | |
840 | - "being deleted must be of 4 byte long", | |
841 | - le_ih); | |
842 | + reiserfs_panic(p_s_sb, "vs-5653", "completing " | |
843 | + "indirect2direct conversion indirect " | |
844 | + "item %h being deleted must be of " | |
845 | + "4 byte long", le_ih); | |
846 | ||
847 | if (c_mode == M_CUT | |
848 | && s_cut_balance.insert_size[0] != -UNFM_P_SIZE) { | |
849 | - reiserfs_panic(p_s_sb, | |
850 | - "vs-5654: reiserfs_cut_from_item: " | |
851 | - "can not complete indirect2direct conversion of %h (CUT, insert_size==%d)", | |
852 | + reiserfs_panic(p_s_sb, "vs-5654", "can not complete " | |
853 | + "indirect2direct conversion of %h " | |
854 | + "(CUT, insert_size==%d)", | |
855 | le_ih, s_cut_balance.insert_size[0]); | |
856 | } | |
857 | /* it would be useful to make sure, that right neighboring | |
858 | @@ -1923,10 +1920,10 @@ static void check_research_for_paste(str | |
859 | || op_bytes_number(found_ih, | |
860 | get_last_bh(path)->b_size) != | |
861 | pos_in_item(path)) | |
862 | - reiserfs_panic(NULL, | |
863 | - "PAP-5720: check_research_for_paste: " | |
864 | - "found direct item %h or position (%d) does not match to key %K", | |
865 | - found_ih, pos_in_item(path), p_s_key); | |
866 | + reiserfs_panic(NULL, "PAP-5720", "found direct item " | |
867 | + "%h or position (%d) does not match " | |
868 | + "to key %K", found_ih, | |
869 | + pos_in_item(path), p_s_key); | |
870 | } | |
871 | if (is_indirect_le_ih(found_ih)) { | |
872 | if (le_ih_k_offset(found_ih) + | |
873 | @@ -1935,9 +1932,9 @@ static void check_research_for_paste(str | |
874 | cpu_key_k_offset(p_s_key) | |
875 | || I_UNFM_NUM(found_ih) != pos_in_item(path) | |
876 | || get_ih_free_space(found_ih) != 0) | |
877 | - reiserfs_panic(NULL, | |
878 | - "PAP-5730: check_research_for_paste: " | |
879 | - "found indirect item (%h) or position (%d) does not match to key (%K)", | |
880 | + reiserfs_panic(NULL, "PAP-5730", "found indirect " | |
881 | + "item (%h) or position (%d) does not " | |
882 | + "match to key (%K)", | |
883 | found_ih, pos_in_item(path), p_s_key); | |
884 | } | |
885 | } | |
886 | --- a/fs/reiserfs/tail_conversion.c | |
887 | +++ b/fs/reiserfs/tail_conversion.c | |
888 | @@ -92,8 +92,7 @@ int direct2indirect(struct reiserfs_tran | |
889 | last item of the file */ | |
890 | if (search_for_position_by_key(sb, &end_key, path) == | |
891 | POSITION_FOUND) | |
892 | - reiserfs_panic(sb, | |
893 | - "PAP-14050: direct2indirect: " | |
894 | + reiserfs_panic(sb, "PAP-14050", | |
895 | "direct item (%K) not found", &end_key); | |
896 | p_le_ih = PATH_PITEM_HEAD(path); | |
897 | RFALSE(!is_direct_le_ih(p_le_ih), | |
898 | @@ -214,8 +213,7 @@ int indirect2direct(struct reiserfs_tran | |
899 | /* re-search indirect item */ | |
900 | if (search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) | |
901 | == POSITION_NOT_FOUND) | |
902 | - reiserfs_panic(p_s_sb, | |
903 | - "PAP-5520: indirect2direct: " | |
904 | + reiserfs_panic(p_s_sb, "PAP-5520", | |
905 | "item to be converted %K does not exist", | |
906 | p_s_item_key); | |
907 | copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); | |
908 | @@ -224,8 +222,8 @@ int indirect2direct(struct reiserfs_tran | |
909 | (ih_item_len(&s_ih) / UNFM_P_SIZE - | |
910 | 1) * p_s_sb->s_blocksize; | |
911 | if (pos != pos1) | |
912 | - reiserfs_panic(p_s_sb, "vs-5530: indirect2direct: " | |
913 | - "tail position changed while we were reading it"); | |
914 | + reiserfs_panic(p_s_sb, "vs-5530", "tail position " | |
915 | + "changed while we were reading it"); | |
916 | #endif | |
917 | } | |
918 | ||
919 | --- a/include/linux/reiserfs_fs.h | |
920 | +++ b/include/linux/reiserfs_fs.h | |
921 | @@ -86,11 +86,14 @@ void __reiserfs_warning(struct super_blo | |
922 | /* assertions handling */ | |
923 | ||
924 | /** always check a condition and panic if it's false. */ | |
925 | -#define __RASSERT( cond, scond, format, args... ) \ | |
926 | -if( !( cond ) ) \ | |
927 | - reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ | |
928 | - __FILE__ ":%i:%s: " format "\n", \ | |
929 | - in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __FUNCTION__ , ##args ) | |
930 | +#define __RASSERT(cond, scond, format, args...) \ | |
931 | +do { \ | |
932 | + if (!(cond)) \ | |
933 | + reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \ | |
934 | + __FILE__ ":%i:%s: " format "\n", \ | |
935 | + in_interrupt() ? -1 : task_pid_nr(current), \ | |
936 | + __LINE__, __func__ , ##args); \ | |
937 | +} while (0) | |
938 | ||
939 | #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) | |
940 | ||
941 | @@ -1448,6 +1451,16 @@ struct buffer_info { | |
942 | int bi_position; | |
943 | }; | |
944 | ||
945 | +static inline struct super_block *sb_from_tb(struct tree_balance *tb) | |
946 | +{ | |
947 | + return tb ? tb->tb_sb : NULL; | |
948 | +} | |
949 | + | |
950 | +static inline struct super_block *sb_from_bi(struct buffer_info *bi) | |
951 | +{ | |
952 | + return bi ? sb_from_tb(bi->tb) : NULL; | |
953 | +} | |
954 | + | |
955 | /* there are 4 types of items: stat data, directory item, indirect, direct. | |
956 | +-------------------+------------+--------------+------------+ | |
957 | | | k_offset | k_uniqueness | mergeable? | | |
958 | @@ -1988,8 +2001,11 @@ int fix_nodes(int n_op_mode, struct tree | |
959 | void unfix_nodes(struct tree_balance *); | |
960 | ||
961 | /* prints.c */ | |
962 | -void reiserfs_panic(struct super_block *s, const char *fmt, ...) | |
963 | +void __reiserfs_panic(struct super_block *s, const char *id, | |
964 | + const char *function, const char *fmt, ...) | |
965 | __attribute__ ((noreturn)); | |
966 | +#define reiserfs_panic(s, id, fmt, args...) \ | |
967 | + __reiserfs_panic(s, id, __func__, fmt, ##args) | |
968 | void reiserfs_info(struct super_block *s, const char *fmt, ...); | |
969 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); | |
970 | void print_indirect_item(struct buffer_head *bh, int item_num); |