]>
Commit | Line | Data |
---|---|---|
8f69975d BS |
1 | From: Jeff Mahoney <jeffm@suse.com> |
2 | Subject: reiserfs: rename p_s_tb to tb | |
3 | ||
4 | This patch is a simple s/p_s_tb/tb/g to the reiserfs code. This is the fourth | |
5 | in a series of patches to rip out some of the awful variable naming in | |
6 | reiserfs. | |
7 | ||
8 | Signed-off-by: Jeff Mahoney <jeffm@suse.com> | |
9 | ||
10 | --- | |
11 | ||
12 | fs/reiserfs/fix_node.c | 482 ++++++++++++++++++++++---------------------- | |
13 | fs/reiserfs/stree.c | 21 + | |
14 | include/linux/reiserfs_fs.h | 2 | |
15 | 3 files changed, 254 insertions(+), 251 deletions(-) | |
16 | ||
17 | --- a/fs/reiserfs/fix_node.c | |
18 | +++ b/fs/reiserfs/fix_node.c | |
19 | @@ -749,26 +749,26 @@ else \ | |
20 | -1, -1);\ | |
21 | } | |
22 | ||
23 | -static void free_buffers_in_tb(struct tree_balance *p_s_tb) | |
24 | +static void free_buffers_in_tb(struct tree_balance *tb) | |
25 | { | |
26 | int n_counter; | |
27 | ||
28 | - pathrelse(p_s_tb->tb_path); | |
29 | + pathrelse(tb->tb_path); | |
30 | ||
31 | for (n_counter = 0; n_counter < MAX_HEIGHT; n_counter++) { | |
32 | - brelse(p_s_tb->L[n_counter]); | |
33 | - brelse(p_s_tb->R[n_counter]); | |
34 | - brelse(p_s_tb->FL[n_counter]); | |
35 | - brelse(p_s_tb->FR[n_counter]); | |
36 | - brelse(p_s_tb->CFL[n_counter]); | |
37 | - brelse(p_s_tb->CFR[n_counter]); | |
38 | - | |
39 | - p_s_tb->L[n_counter] = NULL; | |
40 | - p_s_tb->R[n_counter] = NULL; | |
41 | - p_s_tb->FL[n_counter] = NULL; | |
42 | - p_s_tb->FR[n_counter] = NULL; | |
43 | - p_s_tb->CFL[n_counter] = NULL; | |
44 | - p_s_tb->CFR[n_counter] = NULL; | |
45 | + brelse(tb->L[n_counter]); | |
46 | + brelse(tb->R[n_counter]); | |
47 | + brelse(tb->FL[n_counter]); | |
48 | + brelse(tb->FR[n_counter]); | |
49 | + brelse(tb->CFL[n_counter]); | |
50 | + brelse(tb->CFR[n_counter]); | |
51 | + | |
52 | + tb->L[n_counter] = NULL; | |
53 | + tb->R[n_counter] = NULL; | |
54 | + tb->FL[n_counter] = NULL; | |
55 | + tb->FR[n_counter] = NULL; | |
56 | + tb->CFL[n_counter] = NULL; | |
57 | + tb->CFR[n_counter] = NULL; | |
58 | } | |
59 | } | |
60 | ||
61 | @@ -778,14 +778,14 @@ static void free_buffers_in_tb(struct tr | |
62 | * NO_DISK_SPACE - no disk space. | |
63 | */ | |
64 | /* The function is NOT SCHEDULE-SAFE! */ | |
65 | -static int get_empty_nodes(struct tree_balance *p_s_tb, int n_h) | |
66 | +static int get_empty_nodes(struct tree_balance *tb, int n_h) | |
67 | { | |
68 | struct buffer_head *p_s_new_bh, | |
69 | - *p_s_Sh = PATH_H_PBUFFER(p_s_tb->tb_path, n_h); | |
70 | + *p_s_Sh = PATH_H_PBUFFER(tb->tb_path, n_h); | |
71 | b_blocknr_t *p_n_blocknr, a_n_blocknrs[MAX_AMOUNT_NEEDED] = { 0, }; | |
72 | int n_counter, n_number_of_freeblk, n_amount_needed, /* number of needed empty blocks */ | |
73 | n_retval = CARRY_ON; | |
74 | - struct super_block *sb = p_s_tb->tb_sb; | |
75 | + struct super_block *sb = tb->tb_sb; | |
76 | ||
77 | /* number_of_freeblk is the number of empty blocks which have been | |
78 | acquired for use by the balancing algorithm minus the number of | |
79 | @@ -803,15 +803,15 @@ static int get_empty_nodes(struct tree_b | |
80 | the analysis or 0 if not restarted, then subtract the amount needed | |
81 | by all of the levels of the tree below n_h. */ | |
82 | /* blknum includes S[n_h], so we subtract 1 in this calculation */ | |
83 | - for (n_counter = 0, n_number_of_freeblk = p_s_tb->cur_blknum; | |
84 | + for (n_counter = 0, n_number_of_freeblk = tb->cur_blknum; | |
85 | n_counter < n_h; n_counter++) | |
86 | n_number_of_freeblk -= | |
87 | - (p_s_tb->blknum[n_counter]) ? (p_s_tb->blknum[n_counter] - | |
88 | + (tb->blknum[n_counter]) ? (tb->blknum[n_counter] - | |
89 | 1) : 0; | |
90 | ||
91 | /* Allocate missing empty blocks. */ | |
92 | /* if p_s_Sh == 0 then we are getting a new root */ | |
93 | - n_amount_needed = (p_s_Sh) ? (p_s_tb->blknum[n_h] - 1) : 1; | |
94 | + n_amount_needed = (p_s_Sh) ? (tb->blknum[n_h] - 1) : 1; | |
95 | /* Amount_needed = the amount that we need more than the amount that we have. */ | |
96 | if (n_amount_needed > n_number_of_freeblk) | |
97 | n_amount_needed -= n_number_of_freeblk; | |
98 | @@ -819,7 +819,7 @@ static int get_empty_nodes(struct tree_b | |
99 | return CARRY_ON; | |
100 | ||
101 | /* No need to check quota - is not allocated for blocks used for formatted nodes */ | |
102 | - if (reiserfs_new_form_blocknrs(p_s_tb, a_n_blocknrs, | |
103 | + if (reiserfs_new_form_blocknrs(tb, a_n_blocknrs, | |
104 | n_amount_needed) == NO_DISK_SPACE) | |
105 | return NO_DISK_SPACE; | |
106 | ||
107 | @@ -838,14 +838,14 @@ static int get_empty_nodes(struct tree_b | |
108 | p_s_new_bh); | |
109 | ||
110 | /* Put empty buffers into the array. */ | |
111 | - RFALSE(p_s_tb->FEB[p_s_tb->cur_blknum], | |
112 | + RFALSE(tb->FEB[tb->cur_blknum], | |
113 | "PAP-8141: busy slot for new buffer"); | |
114 | ||
115 | set_buffer_journal_new(p_s_new_bh); | |
116 | - p_s_tb->FEB[p_s_tb->cur_blknum++] = p_s_new_bh; | |
117 | + tb->FEB[tb->cur_blknum++] = p_s_new_bh; | |
118 | } | |
119 | ||
120 | - if (n_retval == CARRY_ON && FILESYSTEM_CHANGED_TB(p_s_tb)) | |
121 | + if (n_retval == CARRY_ON && FILESYSTEM_CHANGED_TB(tb)) | |
122 | n_retval = REPEAT_SEARCH; | |
123 | ||
124 | return n_retval; | |
125 | @@ -896,33 +896,34 @@ static int get_rfree(struct tree_balance | |
126 | } | |
127 | ||
128 | /* Check whether left neighbor is in memory. */ | |
129 | -static int is_left_neighbor_in_cache(struct tree_balance *p_s_tb, int n_h) | |
130 | +static int is_left_neighbor_in_cache(struct tree_balance *tb, int n_h) | |
131 | { | |
132 | struct buffer_head *p_s_father, *left; | |
133 | - struct super_block *sb = p_s_tb->tb_sb; | |
134 | + struct super_block *sb = tb->tb_sb; | |
135 | b_blocknr_t n_left_neighbor_blocknr; | |
136 | int n_left_neighbor_position; | |
137 | ||
138 | - if (!p_s_tb->FL[n_h]) /* Father of the left neighbor does not exist. */ | |
139 | + /* Father of the left neighbor does not exist. */ | |
140 | + if (!tb->FL[n_h]) | |
141 | return 0; | |
142 | ||
143 | /* Calculate father of the node to be balanced. */ | |
144 | - p_s_father = PATH_H_PBUFFER(p_s_tb->tb_path, n_h + 1); | |
145 | + p_s_father = PATH_H_PBUFFER(tb->tb_path, n_h + 1); | |
146 | ||
147 | RFALSE(!p_s_father || | |
148 | !B_IS_IN_TREE(p_s_father) || | |
149 | - !B_IS_IN_TREE(p_s_tb->FL[n_h]) || | |
150 | + !B_IS_IN_TREE(tb->FL[n_h]) || | |
151 | !buffer_uptodate(p_s_father) || | |
152 | - !buffer_uptodate(p_s_tb->FL[n_h]), | |
153 | + !buffer_uptodate(tb->FL[n_h]), | |
154 | "vs-8165: F[h] (%b) or FL[h] (%b) is invalid", | |
155 | - p_s_father, p_s_tb->FL[n_h]); | |
156 | + p_s_father, tb->FL[n_h]); | |
157 | ||
158 | /* Get position of the pointer to the left neighbor into the left father. */ | |
159 | - n_left_neighbor_position = (p_s_father == p_s_tb->FL[n_h]) ? | |
160 | - p_s_tb->lkey[n_h] : B_NR_ITEMS(p_s_tb->FL[n_h]); | |
161 | + n_left_neighbor_position = (p_s_father == tb->FL[n_h]) ? | |
162 | + tb->lkey[n_h] : B_NR_ITEMS(tb->FL[n_h]); | |
163 | /* Get left neighbor block number. */ | |
164 | n_left_neighbor_blocknr = | |
165 | - B_N_CHILD_NUM(p_s_tb->FL[n_h], n_left_neighbor_position); | |
166 | + B_N_CHILD_NUM(tb->FL[n_h], n_left_neighbor_position); | |
167 | /* Look for the left neighbor in the cache. */ | |
168 | if ((left = sb_find_get_block(sb, n_left_neighbor_blocknr))) { | |
169 | ||
170 | @@ -953,14 +954,14 @@ static void decrement_key(struct cpu_key | |
171 | SCHEDULE_OCCURRED - schedule occurred while the function worked; | |
172 | * CARRY_ON - schedule didn't occur while the function worked; | |
173 | */ | |
174 | -static int get_far_parent(struct tree_balance *p_s_tb, | |
175 | +static int get_far_parent(struct tree_balance *tb, | |
176 | int n_h, | |
177 | struct buffer_head **pp_s_father, | |
178 | struct buffer_head **pp_s_com_father, char c_lr_par) | |
179 | { | |
180 | struct buffer_head *p_s_parent; | |
181 | INITIALIZE_PATH(s_path_to_neighbor_father); | |
182 | - struct treepath *p_s_path = p_s_tb->tb_path; | |
183 | + struct treepath *p_s_path = tb->tb_path; | |
184 | struct cpu_key s_lr_father_key; | |
185 | int n_counter, | |
186 | n_position = INT_MAX, | |
187 | @@ -1005,9 +1006,9 @@ static int get_far_parent(struct tree_ba | |
188 | if (n_counter == FIRST_PATH_ELEMENT_OFFSET) { | |
189 | /* Check whether first buffer in the path is the root of the tree. */ | |
190 | if (PATH_OFFSET_PBUFFER | |
191 | - (p_s_tb->tb_path, | |
192 | + (tb->tb_path, | |
193 | FIRST_PATH_ELEMENT_OFFSET)->b_blocknr == | |
194 | - SB_ROOT_BLOCK(p_s_tb->tb_sb)) { | |
195 | + SB_ROOT_BLOCK(tb->tb_sb)) { | |
196 | *pp_s_father = *pp_s_com_father = NULL; | |
197 | return CARRY_ON; | |
198 | } | |
199 | @@ -1022,7 +1023,7 @@ static int get_far_parent(struct tree_ba | |
200 | ||
201 | if (buffer_locked(*pp_s_com_father)) { | |
202 | __wait_on_buffer(*pp_s_com_father); | |
203 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) { | |
204 | + if (FILESYSTEM_CHANGED_TB(tb)) { | |
205 | brelse(*pp_s_com_father); | |
206 | return REPEAT_SEARCH; | |
207 | } | |
208 | @@ -1035,9 +1036,9 @@ static int get_far_parent(struct tree_ba | |
209 | le_key2cpu_key(&s_lr_father_key, | |
210 | B_N_PDELIM_KEY(*pp_s_com_father, | |
211 | (c_lr_par == | |
212 | - LEFT_PARENTS) ? (p_s_tb->lkey[n_h - 1] = | |
213 | + LEFT_PARENTS) ? (tb->lkey[n_h - 1] = | |
214 | n_position - | |
215 | - 1) : (p_s_tb->rkey[n_h - | |
216 | + 1) : (tb->rkey[n_h - | |
217 | 1] = | |
218 | n_position))); | |
219 | ||
220 | @@ -1045,12 +1046,12 @@ static int get_far_parent(struct tree_ba | |
221 | decrement_key(&s_lr_father_key); | |
222 | ||
223 | if (search_by_key | |
224 | - (p_s_tb->tb_sb, &s_lr_father_key, &s_path_to_neighbor_father, | |
225 | + (tb->tb_sb, &s_lr_father_key, &s_path_to_neighbor_father, | |
226 | n_h + 1) == IO_ERROR) | |
227 | // path is released | |
228 | return IO_ERROR; | |
229 | ||
230 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) { | |
231 | + if (FILESYSTEM_CHANGED_TB(tb)) { | |
232 | pathrelse(&s_path_to_neighbor_father); | |
233 | brelse(*pp_s_com_father); | |
234 | return REPEAT_SEARCH; | |
235 | @@ -1075,24 +1076,26 @@ static int get_far_parent(struct tree_ba | |
236 | * Returns: SCHEDULE_OCCURRED - schedule occurred while the function worked; | |
237 | * CARRY_ON - schedule didn't occur while the function worked; | |
238 | */ | |
239 | -static int get_parents(struct tree_balance *p_s_tb, int n_h) | |
240 | +static int get_parents(struct tree_balance *tb, int n_h) | |
241 | { | |
242 | - struct treepath *p_s_path = p_s_tb->tb_path; | |
243 | + struct treepath *p_s_path = tb->tb_path; | |
244 | int n_position, | |
245 | n_ret_value, | |
246 | - n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h); | |
247 | + n_path_offset = PATH_H_PATH_OFFSET(tb->tb_path, n_h); | |
248 | struct buffer_head *p_s_curf, *p_s_curcf; | |
249 | ||
250 | /* Current node is the root of the tree or will be root of the tree */ | |
251 | if (n_path_offset <= FIRST_PATH_ELEMENT_OFFSET) { | |
252 | /* The root can not have parents. | |
253 | Release nodes which previously were obtained as parents of the current node neighbors. */ | |
254 | - brelse(p_s_tb->FL[n_h]); | |
255 | - brelse(p_s_tb->CFL[n_h]); | |
256 | - brelse(p_s_tb->FR[n_h]); | |
257 | - brelse(p_s_tb->CFR[n_h]); | |
258 | - p_s_tb->FL[n_h] = p_s_tb->CFL[n_h] = p_s_tb->FR[n_h] = | |
259 | - p_s_tb->CFR[n_h] = NULL; | |
260 | + brelse(tb->FL[n_h]); | |
261 | + brelse(tb->CFL[n_h]); | |
262 | + brelse(tb->FR[n_h]); | |
263 | + brelse(tb->CFR[n_h]); | |
264 | + tb->FL[n_h] = NULL; | |
265 | + tb->CFL[n_h] = NULL; | |
266 | + tb->FR[n_h] = NULL; | |
267 | + tb->CFR[n_h] = NULL; | |
268 | return CARRY_ON; | |
269 | } | |
270 | ||
271 | @@ -1104,22 +1107,22 @@ static int get_parents(struct tree_balan | |
272 | PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1); | |
273 | get_bh(p_s_curf); | |
274 | get_bh(p_s_curf); | |
275 | - p_s_tb->lkey[n_h] = n_position - 1; | |
276 | + tb->lkey[n_h] = n_position - 1; | |
277 | } else { | |
278 | /* Calculate current parent of L[n_path_offset], which is the left neighbor of the current node. | |
279 | Calculate current common parent of L[n_path_offset] and the current node. Note that | |
280 | CFL[n_path_offset] not equal FL[n_path_offset] and CFL[n_path_offset] not equal F[n_path_offset]. | |
281 | Calculate lkey[n_path_offset]. */ | |
282 | - if ((n_ret_value = get_far_parent(p_s_tb, n_h + 1, &p_s_curf, | |
283 | + if ((n_ret_value = get_far_parent(tb, n_h + 1, &p_s_curf, | |
284 | &p_s_curcf, | |
285 | LEFT_PARENTS)) != CARRY_ON) | |
286 | return n_ret_value; | |
287 | } | |
288 | ||
289 | - brelse(p_s_tb->FL[n_h]); | |
290 | - p_s_tb->FL[n_h] = p_s_curf; /* New initialization of FL[n_h]. */ | |
291 | - brelse(p_s_tb->CFL[n_h]); | |
292 | - p_s_tb->CFL[n_h] = p_s_curcf; /* New initialization of CFL[n_h]. */ | |
293 | + brelse(tb->FL[n_h]); | |
294 | + tb->FL[n_h] = p_s_curf; /* New initialization of FL[n_h]. */ | |
295 | + brelse(tb->CFL[n_h]); | |
296 | + tb->CFL[n_h] = p_s_curcf; /* New initialization of CFL[n_h]. */ | |
297 | ||
298 | RFALSE((p_s_curf && !B_IS_IN_TREE(p_s_curf)) || | |
299 | (p_s_curcf && !B_IS_IN_TREE(p_s_curcf)), | |
300 | @@ -1133,7 +1136,7 @@ static int get_parents(struct tree_balan | |
301 | Calculate current common parent of R[n_h] and current node. Note that CFR[n_h] | |
302 | not equal FR[n_path_offset] and CFR[n_h] not equal F[n_h]. */ | |
303 | if ((n_ret_value = | |
304 | - get_far_parent(p_s_tb, n_h + 1, &p_s_curf, &p_s_curcf, | |
305 | + get_far_parent(tb, n_h + 1, &p_s_curf, &p_s_curcf, | |
306 | RIGHT_PARENTS)) != CARRY_ON) | |
307 | return n_ret_value; | |
308 | } else { | |
309 | @@ -1143,14 +1146,16 @@ static int get_parents(struct tree_balan | |
310 | PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1); | |
311 | get_bh(p_s_curf); | |
312 | get_bh(p_s_curf); | |
313 | - p_s_tb->rkey[n_h] = n_position; | |
314 | + tb->rkey[n_h] = n_position; | |
315 | } | |
316 | ||
317 | - brelse(p_s_tb->FR[n_h]); | |
318 | - p_s_tb->FR[n_h] = p_s_curf; /* New initialization of FR[n_path_offset]. */ | |
319 | + brelse(tb->FR[n_h]); | |
320 | + /* New initialization of FR[n_path_offset]. */ | |
321 | + tb->FR[n_h] = p_s_curf; | |
322 | ||
323 | - brelse(p_s_tb->CFR[n_h]); | |
324 | - p_s_tb->CFR[n_h] = p_s_curcf; /* New initialization of CFR[n_path_offset]. */ | |
325 | + brelse(tb->CFR[n_h]); | |
326 | + /* New initialization of CFR[n_path_offset]. */ | |
327 | + tb->CFR[n_h] = p_s_curcf; | |
328 | ||
329 | RFALSE((p_s_curf && !B_IS_IN_TREE(p_s_curf)) || | |
330 | (p_s_curcf && !B_IS_IN_TREE(p_s_curcf)), | |
331 | @@ -1885,12 +1890,12 @@ static int check_balance(int mode, | |
332 | } | |
333 | ||
334 | /* Check whether parent at the path is the really parent of the current node.*/ | |
335 | -static int get_direct_parent(struct tree_balance *p_s_tb, int n_h) | |
336 | +static int get_direct_parent(struct tree_balance *tb, int n_h) | |
337 | { | |
338 | struct buffer_head *bh; | |
339 | - struct treepath *p_s_path = p_s_tb->tb_path; | |
340 | + struct treepath *p_s_path = tb->tb_path; | |
341 | int n_position, | |
342 | - n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h); | |
343 | + n_path_offset = PATH_H_PATH_OFFSET(tb->tb_path, n_h); | |
344 | ||
345 | /* We are in the root or in the new root. */ | |
346 | if (n_path_offset <= FIRST_PATH_ELEMENT_OFFSET) { | |
347 | @@ -1899,7 +1904,7 @@ static int get_direct_parent(struct tree | |
348 | "PAP-8260: invalid offset in the path"); | |
349 | ||
350 | if (PATH_OFFSET_PBUFFER(p_s_path, FIRST_PATH_ELEMENT_OFFSET)-> | |
351 | - b_blocknr == SB_ROOT_BLOCK(p_s_tb->tb_sb)) { | |
352 | + b_blocknr == SB_ROOT_BLOCK(tb->tb_sb)) { | |
353 | /* Root is not changed. */ | |
354 | PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1) = NULL; | |
355 | PATH_OFFSET_POSITION(p_s_path, n_path_offset - 1) = 0; | |
356 | @@ -1924,7 +1929,7 @@ static int get_direct_parent(struct tree | |
357 | ||
358 | if (buffer_locked(bh)) { | |
359 | __wait_on_buffer(bh); | |
360 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) | |
361 | + if (FILESYSTEM_CHANGED_TB(tb)) | |
362 | return REPEAT_SEARCH; | |
363 | } | |
364 | ||
365 | @@ -1937,85 +1942,86 @@ static int get_direct_parent(struct tree | |
366 | * Returns: SCHEDULE_OCCURRED - schedule occurred while the function worked; | |
367 | * CARRY_ON - schedule didn't occur while the function worked; | |
368 | */ | |
369 | -static int get_neighbors(struct tree_balance *p_s_tb, int n_h) | |
370 | +static int get_neighbors(struct tree_balance *tb, int n_h) | |
371 | { | |
372 | int n_child_position, | |
373 | - n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h + 1); | |
374 | + n_path_offset = PATH_H_PATH_OFFSET(tb->tb_path, n_h + 1); | |
375 | unsigned long n_son_number; | |
376 | - struct super_block *sb = p_s_tb->tb_sb; | |
377 | + struct super_block *sb = tb->tb_sb; | |
378 | struct buffer_head *bh; | |
379 | ||
380 | PROC_INFO_INC(sb, get_neighbors[n_h]); | |
381 | ||
382 | - if (p_s_tb->lnum[n_h]) { | |
383 | + if (tb->lnum[n_h]) { | |
384 | /* We need left neighbor to balance S[n_h]. */ | |
385 | PROC_INFO_INC(sb, need_l_neighbor[n_h]); | |
386 | - bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset); | |
387 | + bh = PATH_OFFSET_PBUFFER(tb->tb_path, n_path_offset); | |
388 | ||
389 | - RFALSE(bh == p_s_tb->FL[n_h] && | |
390 | - !PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset), | |
391 | + RFALSE(bh == tb->FL[n_h] && | |
392 | + !PATH_OFFSET_POSITION(tb->tb_path, n_path_offset), | |
393 | "PAP-8270: invalid position in the parent"); | |
394 | ||
395 | n_child_position = | |
396 | (bh == | |
397 | - p_s_tb->FL[n_h]) ? p_s_tb->lkey[n_h] : B_NR_ITEMS(p_s_tb-> | |
398 | + tb->FL[n_h]) ? tb->lkey[n_h] : B_NR_ITEMS(tb-> | |
399 | FL[n_h]); | |
400 | - n_son_number = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position); | |
401 | + n_son_number = B_N_CHILD_NUM(tb->FL[n_h], n_child_position); | |
402 | bh = sb_bread(sb, n_son_number); | |
403 | if (!bh) | |
404 | return IO_ERROR; | |
405 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) { | |
406 | + if (FILESYSTEM_CHANGED_TB(tb)) { | |
407 | brelse(bh); | |
408 | PROC_INFO_INC(sb, get_neighbors_restart[n_h]); | |
409 | return REPEAT_SEARCH; | |
410 | } | |
411 | ||
412 | - RFALSE(!B_IS_IN_TREE(p_s_tb->FL[n_h]) || | |
413 | - n_child_position > B_NR_ITEMS(p_s_tb->FL[n_h]) || | |
414 | - B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position) != | |
415 | + RFALSE(!B_IS_IN_TREE(tb->FL[n_h]) || | |
416 | + n_child_position > B_NR_ITEMS(tb->FL[n_h]) || | |
417 | + B_N_CHILD_NUM(tb->FL[n_h], n_child_position) != | |
418 | bh->b_blocknr, "PAP-8275: invalid parent"); | |
419 | RFALSE(!B_IS_IN_TREE(bh), "PAP-8280: invalid child"); | |
420 | RFALSE(!n_h && | |
421 | B_FREE_SPACE(bh) != | |
422 | MAX_CHILD_SIZE(bh) - | |
423 | - dc_size(B_N_CHILD(p_s_tb->FL[0], n_child_position)), | |
424 | + dc_size(B_N_CHILD(tb->FL[0], n_child_position)), | |
425 | "PAP-8290: invalid child size of left neighbor"); | |
426 | ||
427 | - brelse(p_s_tb->L[n_h]); | |
428 | - p_s_tb->L[n_h] = bh; | |
429 | + brelse(tb->L[n_h]); | |
430 | + tb->L[n_h] = bh; | |
431 | } | |
432 | ||
433 | - if (p_s_tb->rnum[n_h]) { /* We need right neighbor to balance S[n_path_offset]. */ | |
434 | + /* We need right neighbor to balance S[n_path_offset]. */ | |
435 | + if (tb->rnum[n_h]) { | |
436 | PROC_INFO_INC(sb, need_r_neighbor[n_h]); | |
437 | - bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset); | |
438 | + bh = PATH_OFFSET_PBUFFER(tb->tb_path, n_path_offset); | |
439 | ||
440 | - RFALSE(bh == p_s_tb->FR[n_h] && | |
441 | - PATH_OFFSET_POSITION(p_s_tb->tb_path, | |
442 | + RFALSE(bh == tb->FR[n_h] && | |
443 | + PATH_OFFSET_POSITION(tb->tb_path, | |
444 | n_path_offset) >= | |
445 | B_NR_ITEMS(bh), | |
446 | "PAP-8295: invalid position in the parent"); | |
447 | ||
448 | n_child_position = | |
449 | - (bh == p_s_tb->FR[n_h]) ? p_s_tb->rkey[n_h] + 1 : 0; | |
450 | - n_son_number = B_N_CHILD_NUM(p_s_tb->FR[n_h], n_child_position); | |
451 | + (bh == tb->FR[n_h]) ? tb->rkey[n_h] + 1 : 0; | |
452 | + n_son_number = B_N_CHILD_NUM(tb->FR[n_h], n_child_position); | |
453 | bh = sb_bread(sb, n_son_number); | |
454 | if (!bh) | |
455 | return IO_ERROR; | |
456 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) { | |
457 | + if (FILESYSTEM_CHANGED_TB(tb)) { | |
458 | brelse(bh); | |
459 | PROC_INFO_INC(sb, get_neighbors_restart[n_h]); | |
460 | return REPEAT_SEARCH; | |
461 | } | |
462 | - brelse(p_s_tb->R[n_h]); | |
463 | - p_s_tb->R[n_h] = bh; | |
464 | + brelse(tb->R[n_h]); | |
465 | + tb->R[n_h] = bh; | |
466 | ||
467 | RFALSE(!n_h | |
468 | && B_FREE_SPACE(bh) != | |
469 | MAX_CHILD_SIZE(bh) - | |
470 | - dc_size(B_N_CHILD(p_s_tb->FR[0], n_child_position)), | |
471 | + dc_size(B_N_CHILD(tb->FR[0], n_child_position)), | |
472 | "PAP-8300: invalid child size of right neighbor (%d != %d - %d)", | |
473 | B_FREE_SPACE(bh), MAX_CHILD_SIZE(bh), | |
474 | - dc_size(B_N_CHILD(p_s_tb->FR[0], n_child_position))); | |
475 | + dc_size(B_N_CHILD(tb->FR[0], n_child_position))); | |
476 | ||
477 | } | |
478 | return CARRY_ON; | |
479 | @@ -2139,7 +2145,7 @@ static int clear_all_dirty_bits(struct s | |
480 | return reiserfs_prepare_for_journal(s, bh, 0); | |
481 | } | |
482 | ||
483 | -static int wait_tb_buffers_until_unlocked(struct tree_balance *p_s_tb) | |
484 | +static int wait_tb_buffers_until_unlocked(struct tree_balance *tb) | |
485 | { | |
486 | struct buffer_head *locked; | |
487 | #ifdef CONFIG_REISERFS_CHECK | |
488 | @@ -2151,95 +2157,94 @@ static int wait_tb_buffers_until_unlocke | |
489 | ||
490 | locked = NULL; | |
491 | ||
492 | - for (i = p_s_tb->tb_path->path_length; | |
493 | + for (i = tb->tb_path->path_length; | |
494 | !locked && i > ILLEGAL_PATH_ELEMENT_OFFSET; i--) { | |
495 | - if (PATH_OFFSET_PBUFFER(p_s_tb->tb_path, i)) { | |
496 | + if (PATH_OFFSET_PBUFFER(tb->tb_path, i)) { | |
497 | /* if I understand correctly, we can only be sure the last buffer | |
498 | ** in the path is in the tree --clm | |
499 | */ | |
500 | #ifdef CONFIG_REISERFS_CHECK | |
501 | - if (PATH_PLAST_BUFFER(p_s_tb->tb_path) == | |
502 | - PATH_OFFSET_PBUFFER(p_s_tb->tb_path, i)) { | |
503 | - tb_buffer_sanity_check(p_s_tb->tb_sb, | |
504 | + if (PATH_PLAST_BUFFER(tb->tb_path) == | |
505 | + PATH_OFFSET_PBUFFER(tb->tb_path, i)) | |
506 | + tb_buffer_sanity_check(tb->tb_sb, | |
507 | PATH_OFFSET_PBUFFER | |
508 | - (p_s_tb->tb_path, | |
509 | + (tb->tb_path, | |
510 | i), "S", | |
511 | - p_s_tb->tb_path-> | |
512 | + tb->tb_path-> | |
513 | path_length - i); | |
514 | - } | |
515 | #endif | |
516 | - if (!clear_all_dirty_bits(p_s_tb->tb_sb, | |
517 | + if (!clear_all_dirty_bits(tb->tb_sb, | |
518 | PATH_OFFSET_PBUFFER | |
519 | - (p_s_tb->tb_path, | |
520 | + (tb->tb_path, | |
521 | i))) { | |
522 | locked = | |
523 | - PATH_OFFSET_PBUFFER(p_s_tb->tb_path, | |
524 | + PATH_OFFSET_PBUFFER(tb->tb_path, | |
525 | i); | |
526 | } | |
527 | } | |
528 | } | |
529 | ||
530 | - for (i = 0; !locked && i < MAX_HEIGHT && p_s_tb->insert_size[i]; | |
531 | + for (i = 0; !locked && i < MAX_HEIGHT && tb->insert_size[i]; | |
532 | i++) { | |
533 | ||
534 | - if (p_s_tb->lnum[i]) { | |
535 | + if (tb->lnum[i]) { | |
536 | ||
537 | - if (p_s_tb->L[i]) { | |
538 | - tb_buffer_sanity_check(p_s_tb->tb_sb, | |
539 | - p_s_tb->L[i], | |
540 | + if (tb->L[i]) { | |
541 | + tb_buffer_sanity_check(tb->tb_sb, | |
542 | + tb->L[i], | |
543 | "L", i); | |
544 | if (!clear_all_dirty_bits | |
545 | - (p_s_tb->tb_sb, p_s_tb->L[i])) | |
546 | - locked = p_s_tb->L[i]; | |
547 | + (tb->tb_sb, tb->L[i])) | |
548 | + locked = tb->L[i]; | |
549 | } | |
550 | ||
551 | - if (!locked && p_s_tb->FL[i]) { | |
552 | - tb_buffer_sanity_check(p_s_tb->tb_sb, | |
553 | - p_s_tb->FL[i], | |
554 | + if (!locked && tb->FL[i]) { | |
555 | + tb_buffer_sanity_check(tb->tb_sb, | |
556 | + tb->FL[i], | |
557 | "FL", i); | |
558 | if (!clear_all_dirty_bits | |
559 | - (p_s_tb->tb_sb, p_s_tb->FL[i])) | |
560 | - locked = p_s_tb->FL[i]; | |
561 | + (tb->tb_sb, tb->FL[i])) | |
562 | + locked = tb->FL[i]; | |
563 | } | |
564 | ||
565 | - if (!locked && p_s_tb->CFL[i]) { | |
566 | - tb_buffer_sanity_check(p_s_tb->tb_sb, | |
567 | - p_s_tb->CFL[i], | |
568 | + if (!locked && tb->CFL[i]) { | |
569 | + tb_buffer_sanity_check(tb->tb_sb, | |
570 | + tb->CFL[i], | |
571 | "CFL", i); | |
572 | if (!clear_all_dirty_bits | |
573 | - (p_s_tb->tb_sb, p_s_tb->CFL[i])) | |
574 | - locked = p_s_tb->CFL[i]; | |
575 | + (tb->tb_sb, tb->CFL[i])) | |
576 | + locked = tb->CFL[i]; | |
577 | } | |
578 | ||
579 | } | |
580 | ||
581 | - if (!locked && (p_s_tb->rnum[i])) { | |
582 | + if (!locked && (tb->rnum[i])) { | |
583 | ||
584 | - if (p_s_tb->R[i]) { | |
585 | - tb_buffer_sanity_check(p_s_tb->tb_sb, | |
586 | - p_s_tb->R[i], | |
587 | + if (tb->R[i]) { | |
588 | + tb_buffer_sanity_check(tb->tb_sb, | |
589 | + tb->R[i], | |
590 | "R", i); | |
591 | if (!clear_all_dirty_bits | |
592 | - (p_s_tb->tb_sb, p_s_tb->R[i])) | |
593 | - locked = p_s_tb->R[i]; | |
594 | + (tb->tb_sb, tb->R[i])) | |
595 | + locked = tb->R[i]; | |
596 | } | |
597 | ||
598 | - if (!locked && p_s_tb->FR[i]) { | |
599 | - tb_buffer_sanity_check(p_s_tb->tb_sb, | |
600 | - p_s_tb->FR[i], | |
601 | + if (!locked && tb->FR[i]) { | |
602 | + tb_buffer_sanity_check(tb->tb_sb, | |
603 | + tb->FR[i], | |
604 | "FR", i); | |
605 | if (!clear_all_dirty_bits | |
606 | - (p_s_tb->tb_sb, p_s_tb->FR[i])) | |
607 | - locked = p_s_tb->FR[i]; | |
608 | + (tb->tb_sb, tb->FR[i])) | |
609 | + locked = tb->FR[i]; | |
610 | } | |
611 | ||
612 | - if (!locked && p_s_tb->CFR[i]) { | |
613 | - tb_buffer_sanity_check(p_s_tb->tb_sb, | |
614 | - p_s_tb->CFR[i], | |
615 | + if (!locked && tb->CFR[i]) { | |
616 | + tb_buffer_sanity_check(tb->tb_sb, | |
617 | + tb->CFR[i], | |
618 | "CFR", i); | |
619 | if (!clear_all_dirty_bits | |
620 | - (p_s_tb->tb_sb, p_s_tb->CFR[i])) | |
621 | - locked = p_s_tb->CFR[i]; | |
622 | + (tb->tb_sb, tb->CFR[i])) | |
623 | + locked = tb->CFR[i]; | |
624 | } | |
625 | } | |
626 | } | |
627 | @@ -2252,10 +2257,10 @@ static int wait_tb_buffers_until_unlocke | |
628 | ** --clm | |
629 | */ | |
630 | for (i = 0; !locked && i < MAX_FEB_SIZE; i++) { | |
631 | - if (p_s_tb->FEB[i]) { | |
632 | + if (tb->FEB[i]) { | |
633 | if (!clear_all_dirty_bits | |
634 | - (p_s_tb->tb_sb, p_s_tb->FEB[i])) | |
635 | - locked = p_s_tb->FEB[i]; | |
636 | + (tb->tb_sb, tb->FEB[i])) | |
637 | + locked = tb->FEB[i]; | |
638 | } | |
639 | } | |
640 | ||
641 | @@ -2263,21 +2268,20 @@ static int wait_tb_buffers_until_unlocke | |
642 | #ifdef CONFIG_REISERFS_CHECK | |
643 | repeat_counter++; | |
644 | if ((repeat_counter % 10000) == 0) { | |
645 | - reiserfs_warning(p_s_tb->tb_sb, "reiserfs-8200", | |
646 | + reiserfs_warning(tb->tb_sb, "reiserfs-8200", | |
647 | "too many iterations waiting " | |
648 | "for buffer to unlock " | |
649 | "(%b)", locked); | |
650 | ||
651 | /* Don't loop forever. Try to recover from possible error. */ | |
652 | ||
653 | - return (FILESYSTEM_CHANGED_TB(p_s_tb)) ? | |
654 | + return (FILESYSTEM_CHANGED_TB(tb)) ? | |
655 | REPEAT_SEARCH : CARRY_ON; | |
656 | } | |
657 | #endif | |
658 | __wait_on_buffer(locked); | |
659 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) { | |
660 | + if (FILESYSTEM_CHANGED_TB(tb)) | |
661 | return REPEAT_SEARCH; | |
662 | - } | |
663 | } | |
664 | ||
665 | } while (locked); | |
666 | @@ -2307,138 +2311,136 @@ static int wait_tb_buffers_until_unlocke | |
667 | * tb tree_balance structure; | |
668 | * inum item number in S[h]; | |
669 | * pos_in_item - comment this if you can | |
670 | - * ins_ih & ins_sd are used when inserting | |
671 | + * ins_ih item head of item being inserted | |
672 | + * data inserted item or data to be pasted | |
673 | * Returns: 1 - schedule occurred while the function worked; | |
674 | * 0 - schedule didn't occur while the function worked; | |
675 | * -1 - if no_disk_space | |
676 | */ | |
677 | ||
678 | -int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, struct item_head *p_s_ins_ih, // item head of item being inserted | |
679 | - const void *data // inserted item or data to be pasted | |
680 | - ) | |
681 | +int fix_nodes(int n_op_mode, struct tree_balance *tb, | |
682 | + struct item_head *p_s_ins_ih, const void *data) | |
683 | { | |
684 | - int n_ret_value, n_h, n_item_num = PATH_LAST_POSITION(p_s_tb->tb_path); | |
685 | + int n_ret_value, n_h, n_item_num = PATH_LAST_POSITION(tb->tb_path); | |
686 | int n_pos_in_item; | |
687 | ||
688 | /* we set wait_tb_buffers_run when we have to restore any dirty bits cleared | |
689 | ** during wait_tb_buffers_run | |
690 | */ | |
691 | int wait_tb_buffers_run = 0; | |
692 | - struct buffer_head *p_s_tbS0 = PATH_PLAST_BUFFER(p_s_tb->tb_path); | |
693 | + struct buffer_head *tbS0 = PATH_PLAST_BUFFER(tb->tb_path); | |
694 | ||
695 | - ++REISERFS_SB(p_s_tb->tb_sb)->s_fix_nodes; | |
696 | + ++REISERFS_SB(tb->tb_sb)->s_fix_nodes; | |
697 | ||
698 | - n_pos_in_item = p_s_tb->tb_path->pos_in_item; | |
699 | + n_pos_in_item = tb->tb_path->pos_in_item; | |
700 | ||
701 | - p_s_tb->fs_gen = get_generation(p_s_tb->tb_sb); | |
702 | + tb->fs_gen = get_generation(tb->tb_sb); | |
703 | ||
704 | /* we prepare and log the super here so it will already be in the | |
705 | ** transaction when do_balance needs to change it. | |
706 | ** This way do_balance won't have to schedule when trying to prepare | |
707 | ** the super for logging | |
708 | */ | |
709 | - reiserfs_prepare_for_journal(p_s_tb->tb_sb, | |
710 | - SB_BUFFER_WITH_SB(p_s_tb->tb_sb), 1); | |
711 | - journal_mark_dirty(p_s_tb->transaction_handle, p_s_tb->tb_sb, | |
712 | - SB_BUFFER_WITH_SB(p_s_tb->tb_sb)); | |
713 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) | |
714 | + reiserfs_prepare_for_journal(tb->tb_sb, | |
715 | + SB_BUFFER_WITH_SB(tb->tb_sb), 1); | |
716 | + journal_mark_dirty(tb->transaction_handle, tb->tb_sb, | |
717 | + SB_BUFFER_WITH_SB(tb->tb_sb)); | |
718 | + if (FILESYSTEM_CHANGED_TB(tb)) | |
719 | return REPEAT_SEARCH; | |
720 | ||
721 | /* if it possible in indirect_to_direct conversion */ | |
722 | - if (buffer_locked(p_s_tbS0)) { | |
723 | - __wait_on_buffer(p_s_tbS0); | |
724 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) | |
725 | + if (buffer_locked(tbS0)) { | |
726 | + __wait_on_buffer(tbS0); | |
727 | + if (FILESYSTEM_CHANGED_TB(tb)) | |
728 | return REPEAT_SEARCH; | |
729 | } | |
730 | #ifdef CONFIG_REISERFS_CHECK | |
731 | if (cur_tb) { | |
732 | print_cur_tb("fix_nodes"); | |
733 | - reiserfs_panic(p_s_tb->tb_sb, "PAP-8305", | |
734 | + reiserfs_panic(tb->tb_sb, "PAP-8305", | |
735 | "there is pending do_balance"); | |
736 | } | |
737 | ||
738 | - if (!buffer_uptodate(p_s_tbS0) || !B_IS_IN_TREE(p_s_tbS0)) { | |
739 | - reiserfs_panic(p_s_tb->tb_sb, "PAP-8320", "S[0] (%b %z) is " | |
740 | + if (!buffer_uptodate(tbS0) || !B_IS_IN_TREE(tbS0)) | |
741 | + reiserfs_panic(tb->tb_sb, "PAP-8320", "S[0] (%b %z) is " | |
742 | "not uptodate at the beginning of fix_nodes " | |
743 | "or not in tree (mode %c)", | |
744 | - p_s_tbS0, p_s_tbS0, n_op_mode); | |
745 | - } | |
746 | + tbS0, tbS0, n_op_mode); | |
747 | ||
748 | /* Check parameters. */ | |
749 | switch (n_op_mode) { | |
750 | case M_INSERT: | |
751 | - if (n_item_num <= 0 || n_item_num > B_NR_ITEMS(p_s_tbS0)) | |
752 | - reiserfs_panic(p_s_tb->tb_sb, "PAP-8330", "Incorrect " | |
753 | + if (n_item_num <= 0 || n_item_num > B_NR_ITEMS(tbS0)) | |
754 | + reiserfs_panic(tb->tb_sb, "PAP-8330", "Incorrect " | |
755 | "item number %d (in S0 - %d) in case " | |
756 | "of insert", n_item_num, | |
757 | - B_NR_ITEMS(p_s_tbS0)); | |
758 | + B_NR_ITEMS(tbS0)); | |
759 | break; | |
760 | case M_PASTE: | |
761 | case M_DELETE: | |
762 | case M_CUT: | |
763 | - if (n_item_num < 0 || n_item_num >= B_NR_ITEMS(p_s_tbS0)) { | |
764 | - print_block(p_s_tbS0, 0, -1, -1); | |
765 | - reiserfs_panic(p_s_tb->tb_sb, "PAP-8335", "Incorrect " | |
766 | + if (n_item_num < 0 || n_item_num >= B_NR_ITEMS(tbS0)) { | |
767 | + print_block(tbS0, 0, -1, -1); | |
768 | + reiserfs_panic(tb->tb_sb, "PAP-8335", "Incorrect " | |
769 | "item number(%d); mode = %c " | |
770 | "insert_size = %d", | |
771 | n_item_num, n_op_mode, | |
772 | - p_s_tb->insert_size[0]); | |
773 | + tb->insert_size[0]); | |
774 | } | |
775 | break; | |
776 | default: | |
777 | - reiserfs_panic(p_s_tb->tb_sb, "PAP-8340", "Incorrect mode " | |
778 | + reiserfs_panic(tb->tb_sb, "PAP-8340", "Incorrect mode " | |
779 | "of operation"); | |
780 | } | |
781 | #endif | |
782 | ||
783 | - if (get_mem_for_virtual_node(p_s_tb) == REPEAT_SEARCH) | |
784 | + if (get_mem_for_virtual_node(tb) == REPEAT_SEARCH) | |
785 | // FIXME: maybe -ENOMEM when tb->vn_buf == 0? Now just repeat | |
786 | return REPEAT_SEARCH; | |
787 | ||
788 | /* Starting from the leaf level; for all levels n_h of the tree. */ | |
789 | - for (n_h = 0; n_h < MAX_HEIGHT && p_s_tb->insert_size[n_h]; n_h++) { | |
790 | - if ((n_ret_value = get_direct_parent(p_s_tb, n_h)) != CARRY_ON) { | |
791 | + for (n_h = 0; n_h < MAX_HEIGHT && tb->insert_size[n_h]; n_h++) { | |
792 | + n_ret_value = get_direct_parent(tb, n_h); | |
793 | + if (n_ret_value != CARRY_ON) | |
794 | goto repeat; | |
795 | - } | |
796 | ||
797 | - if ((n_ret_value = | |
798 | - check_balance(n_op_mode, p_s_tb, n_h, n_item_num, | |
799 | - n_pos_in_item, p_s_ins_ih, | |
800 | - data)) != CARRY_ON) { | |
801 | + n_ret_value = check_balance(n_op_mode, tb, n_h, n_item_num, | |
802 | + n_pos_in_item, p_s_ins_ih, data); | |
803 | + if (n_ret_value != CARRY_ON) { | |
804 | if (n_ret_value == NO_BALANCING_NEEDED) { | |
805 | /* No balancing for higher levels needed. */ | |
806 | - if ((n_ret_value = | |
807 | - get_neighbors(p_s_tb, n_h)) != CARRY_ON) { | |
808 | + n_ret_value = get_neighbors(tb, n_h); | |
809 | + if (n_ret_value != CARRY_ON) | |
810 | goto repeat; | |
811 | - } | |
812 | if (n_h != MAX_HEIGHT - 1) | |
813 | - p_s_tb->insert_size[n_h + 1] = 0; | |
814 | + tb->insert_size[n_h + 1] = 0; | |
815 | /* ok, analysis and resource gathering are complete */ | |
816 | break; | |
817 | } | |
818 | goto repeat; | |
819 | } | |
820 | ||
821 | - if ((n_ret_value = get_neighbors(p_s_tb, n_h)) != CARRY_ON) { | |
822 | + n_ret_value = get_neighbors(tb, n_h); | |
823 | + if (n_ret_value != CARRY_ON) | |
824 | goto repeat; | |
825 | - } | |
826 | ||
827 | - if ((n_ret_value = get_empty_nodes(p_s_tb, n_h)) != CARRY_ON) { | |
828 | - goto repeat; /* No disk space, or schedule occurred and | |
829 | - analysis may be invalid and needs to be redone. */ | |
830 | - } | |
831 | + /* No disk space, or schedule occurred and analysis may be | |
832 | + * invalid and needs to be redone. */ | |
833 | + n_ret_value = get_empty_nodes(tb, n_h); | |
834 | + if (n_ret_value != CARRY_ON) | |
835 | + goto repeat; | |
836 | ||
837 | - if (!PATH_H_PBUFFER(p_s_tb->tb_path, n_h)) { | |
838 | + if (!PATH_H_PBUFFER(tb->tb_path, n_h)) { | |
839 | /* We have a positive insert size but no nodes exist on this | |
840 | level, this means that we are creating a new root. */ | |
841 | ||
842 | - RFALSE(p_s_tb->blknum[n_h] != 1, | |
843 | + RFALSE(tb->blknum[n_h] != 1, | |
844 | "PAP-8350: creating new empty root"); | |
845 | ||
846 | if (n_h < MAX_HEIGHT - 1) | |
847 | - p_s_tb->insert_size[n_h + 1] = 0; | |
848 | - } else if (!PATH_H_PBUFFER(p_s_tb->tb_path, n_h + 1)) { | |
849 | - if (p_s_tb->blknum[n_h] > 1) { | |
850 | + tb->insert_size[n_h + 1] = 0; | |
851 | + } else if (!PATH_H_PBUFFER(tb->tb_path, n_h + 1)) { | |
852 | + if (tb->blknum[n_h] > 1) { | |
853 | /* The tree needs to be grown, so this node S[n_h] | |
854 | which is the root node is split into two nodes, | |
855 | and a new node (S[n_h+1]) will be created to | |
856 | @@ -2447,19 +2449,20 @@ int fix_nodes(int n_op_mode, struct tree | |
857 | RFALSE(n_h == MAX_HEIGHT - 1, | |
858 | "PAP-8355: attempt to create too high of a tree"); | |
859 | ||
860 | - p_s_tb->insert_size[n_h + 1] = | |
861 | + tb->insert_size[n_h + 1] = | |
862 | (DC_SIZE + | |
863 | - KEY_SIZE) * (p_s_tb->blknum[n_h] - 1) + | |
864 | + KEY_SIZE) * (tb->blknum[n_h] - 1) + | |
865 | DC_SIZE; | |
866 | } else if (n_h < MAX_HEIGHT - 1) | |
867 | - p_s_tb->insert_size[n_h + 1] = 0; | |
868 | + tb->insert_size[n_h + 1] = 0; | |
869 | } else | |
870 | - p_s_tb->insert_size[n_h + 1] = | |
871 | - (DC_SIZE + KEY_SIZE) * (p_s_tb->blknum[n_h] - 1); | |
872 | + tb->insert_size[n_h + 1] = | |
873 | + (DC_SIZE + KEY_SIZE) * (tb->blknum[n_h] - 1); | |
874 | } | |
875 | ||
876 | - if ((n_ret_value = wait_tb_buffers_until_unlocked(p_s_tb)) == CARRY_ON) { | |
877 | - if (FILESYSTEM_CHANGED_TB(p_s_tb)) { | |
878 | + n_ret_value = wait_tb_buffers_until_unlocked(tb); | |
879 | + if (n_ret_value == CARRY_ON) { | |
880 | + if (FILESYSTEM_CHANGED_TB(tb)) { | |
881 | wait_tb_buffers_run = 1; | |
882 | n_ret_value = REPEAT_SEARCH; | |
883 | goto repeat; | |
884 | @@ -2482,50 +2485,49 @@ int fix_nodes(int n_op_mode, struct tree | |
885 | ||
886 | /* Release path buffers. */ | |
887 | if (wait_tb_buffers_run) { | |
888 | - pathrelse_and_restore(p_s_tb->tb_sb, p_s_tb->tb_path); | |
889 | + pathrelse_and_restore(tb->tb_sb, tb->tb_path); | |
890 | } else { | |
891 | - pathrelse(p_s_tb->tb_path); | |
892 | + pathrelse(tb->tb_path); | |
893 | } | |
894 | /* brelse all resources collected for balancing */ | |
895 | for (i = 0; i < MAX_HEIGHT; i++) { | |
896 | if (wait_tb_buffers_run) { | |
897 | - reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, | |
898 | - p_s_tb->L[i]); | |
899 | - reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, | |
900 | - p_s_tb->R[i]); | |
901 | - reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, | |
902 | - p_s_tb->FL[i]); | |
903 | - reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, | |
904 | - p_s_tb->FR[i]); | |
905 | - reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, | |
906 | - p_s_tb-> | |
907 | + reiserfs_restore_prepared_buffer(tb->tb_sb, | |
908 | + tb->L[i]); | |
909 | + reiserfs_restore_prepared_buffer(tb->tb_sb, | |
910 | + tb->R[i]); | |
911 | + reiserfs_restore_prepared_buffer(tb->tb_sb, | |
912 | + tb->FL[i]); | |
913 | + reiserfs_restore_prepared_buffer(tb->tb_sb, | |
914 | + tb->FR[i]); | |
915 | + reiserfs_restore_prepared_buffer(tb->tb_sb, | |
916 | + tb-> | |
917 | CFL[i]); | |
918 | - reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, | |
919 | - p_s_tb-> | |
920 | + reiserfs_restore_prepared_buffer(tb->tb_sb, | |
921 | + tb-> | |
922 | CFR[i]); | |
923 | } | |
924 | ||
925 | - brelse(p_s_tb->L[i]); | |
926 | - brelse(p_s_tb->R[i]); | |
927 | - brelse(p_s_tb->FL[i]); | |
928 | - brelse(p_s_tb->FR[i]); | |
929 | - brelse(p_s_tb->CFL[i]); | |
930 | - brelse(p_s_tb->CFR[i]); | |
931 | - | |
932 | - p_s_tb->L[i] = NULL; | |
933 | - p_s_tb->R[i] = NULL; | |
934 | - p_s_tb->FL[i] = NULL; | |
935 | - p_s_tb->FR[i] = NULL; | |
936 | - p_s_tb->CFL[i] = NULL; | |
937 | - p_s_tb->CFR[i] = NULL; | |
938 | + brelse(tb->L[i]); | |
939 | + brelse(tb->R[i]); | |
940 | + brelse(tb->FL[i]); | |
941 | + brelse(tb->FR[i]); | |
942 | + brelse(tb->CFL[i]); | |
943 | + brelse(tb->CFR[i]); | |
944 | + | |
945 | + tb->L[i] = NULL; | |
946 | + tb->R[i] = NULL; | |
947 | + tb->FL[i] = NULL; | |
948 | + tb->FR[i] = NULL; | |
949 | + tb->CFL[i] = NULL; | |
950 | + tb->CFR[i] = NULL; | |
951 | } | |
952 | ||
953 | if (wait_tb_buffers_run) { | |
954 | for (i = 0; i < MAX_FEB_SIZE; i++) { | |
955 | - if (p_s_tb->FEB[i]) { | |
956 | + if (tb->FEB[i]) | |
957 | reiserfs_restore_prepared_buffer | |
958 | - (p_s_tb->tb_sb, p_s_tb->FEB[i]); | |
959 | - } | |
960 | + (tb->tb_sb, tb->FEB[i]); | |
961 | } | |
962 | } | |
963 | return n_ret_value; | |
964 | @@ -2533,7 +2535,7 @@ int fix_nodes(int n_op_mode, struct tree | |
965 | ||
966 | } | |
967 | ||
968 | -/* Anatoly will probably forgive me renaming p_s_tb to tb. I just | |
969 | +/* Anatoly will probably forgive me renaming tb to tb. I just | |
970 | wanted to make lines shorter */ | |
971 | void unfix_nodes(struct tree_balance *tb) | |
972 | { | |
973 | --- a/fs/reiserfs/stree.c | |
974 | +++ b/fs/reiserfs/stree.c | |
975 | @@ -1063,17 +1063,17 @@ static char prepare_for_delete_or_cut(st | |
976 | } | |
977 | ||
978 | /* Calculate number of bytes which will be deleted or cut during balance */ | |
979 | -static int calc_deleted_bytes_number(struct tree_balance *p_s_tb, char c_mode) | |
980 | +static int calc_deleted_bytes_number(struct tree_balance *tb, char c_mode) | |
981 | { | |
982 | int n_del_size; | |
983 | - struct item_head *p_le_ih = PATH_PITEM_HEAD(p_s_tb->tb_path); | |
984 | + struct item_head *p_le_ih = PATH_PITEM_HEAD(tb->tb_path); | |
985 | ||
986 | if (is_statdata_le_ih(p_le_ih)) | |
987 | return 0; | |
988 | ||
989 | n_del_size = | |
990 | (c_mode == | |
991 | - M_DELETE) ? ih_item_len(p_le_ih) : -p_s_tb->insert_size[0]; | |
992 | + M_DELETE) ? ih_item_len(p_le_ih) : -tb->insert_size[0]; | |
993 | if (is_direntry_le_ih(p_le_ih)) { | |
994 | // return EMPTY_DIR_SIZE; /* We delete emty directoris only. */ | |
995 | // we can't use EMPTY_DIR_SIZE, as old format dirs have a different | |
996 | @@ -1083,25 +1083,26 @@ static int calc_deleted_bytes_number(str | |
997 | } | |
998 | ||
999 | if (is_indirect_le_ih(p_le_ih)) | |
1000 | - n_del_size = (n_del_size / UNFM_P_SIZE) * (PATH_PLAST_BUFFER(p_s_tb->tb_path)->b_size); // - get_ih_free_space (p_le_ih); | |
1001 | + n_del_size = (n_del_size / UNFM_P_SIZE) * | |
1002 | + (PATH_PLAST_BUFFER(tb->tb_path)->b_size); | |
1003 | return n_del_size; | |
1004 | } | |
1005 | ||
1006 | static void init_tb_struct(struct reiserfs_transaction_handle *th, | |
1007 | - struct tree_balance *p_s_tb, | |
1008 | + struct tree_balance *tb, | |
1009 | struct super_block *sb, | |
1010 | struct treepath *p_s_path, int n_size) | |
1011 | { | |
1012 | ||
1013 | BUG_ON(!th->t_trans_id); | |
1014 | ||
1015 | - memset(p_s_tb, '\0', sizeof(struct tree_balance)); | |
1016 | - p_s_tb->transaction_handle = th; | |
1017 | - p_s_tb->tb_sb = sb; | |
1018 | - p_s_tb->tb_path = p_s_path; | |
1019 | + memset(tb, '\0', sizeof(struct tree_balance)); | |
1020 | + tb->transaction_handle = th; | |
1021 | + tb->tb_sb = sb; | |
1022 | + tb->tb_path = p_s_path; | |
1023 | PATH_OFFSET_PBUFFER(p_s_path, ILLEGAL_PATH_ELEMENT_OFFSET) = NULL; | |
1024 | PATH_OFFSET_POSITION(p_s_path, ILLEGAL_PATH_ELEMENT_OFFSET) = 0; | |
1025 | - p_s_tb->insert_size[0] = n_size; | |
1026 | + tb->insert_size[0] = n_size; | |
1027 | } | |
1028 | ||
1029 | void padd_item(char *item, int total_length, int length) | |
1030 | --- a/include/linux/reiserfs_fs.h | |
1031 | +++ b/include/linux/reiserfs_fs.h | |
1032 | @@ -2004,7 +2004,7 @@ extern const struct address_space_operat | |
1033 | ||
1034 | /* fix_nodes.c */ | |
1035 | ||
1036 | -int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, | |
1037 | +int fix_nodes(int n_op_mode, struct tree_balance *tb, | |
1038 | struct item_head *p_s_ins_ih, const void *); | |
1039 | void unfix_nodes(struct tree_balance *); | |
1040 |