Lines Matching refs:p_s_tb
726 struct tree_balance * p_s_tb in free_buffers_in_tb() argument
730 decrement_counters_in_path(p_s_tb->tb_path); in free_buffers_in_tb()
733 decrement_bcount(p_s_tb->L[n_counter]); in free_buffers_in_tb()
734 p_s_tb->L[n_counter] = NULL; in free_buffers_in_tb()
735 decrement_bcount(p_s_tb->R[n_counter]); in free_buffers_in_tb()
736 p_s_tb->R[n_counter] = NULL; in free_buffers_in_tb()
737 decrement_bcount(p_s_tb->FL[n_counter]); in free_buffers_in_tb()
738 p_s_tb->FL[n_counter] = NULL; in free_buffers_in_tb()
739 decrement_bcount(p_s_tb->FR[n_counter]); in free_buffers_in_tb()
740 p_s_tb->FR[n_counter] = NULL; in free_buffers_in_tb()
741 decrement_bcount(p_s_tb->CFL[n_counter]); in free_buffers_in_tb()
742 p_s_tb->CFL[n_counter] = NULL; in free_buffers_in_tb()
743 decrement_bcount(p_s_tb->CFR[n_counter]); in free_buffers_in_tb()
744 p_s_tb->CFR[n_counter] = NULL; in free_buffers_in_tb()
756 struct tree_balance * p_s_tb, in get_empty_nodes() argument
760 * p_s_Sh = PATH_H_PBUFFER (p_s_tb->tb_path, n_h); in get_empty_nodes()
767 struct super_block * p_s_sb = p_s_tb->tb_sb; in get_empty_nodes()
786 for ( n_counter = 0, n_number_of_freeblk = p_s_tb->cur_blknum; n_counter < n_h; n_counter++ ) in get_empty_nodes()
787 n_number_of_freeblk -= ( p_s_tb->blknum[n_counter] ) ? (p_s_tb->blknum[n_counter] - 1) : 0; in get_empty_nodes()
791 n_amount_needed = ( p_s_Sh ) ? (p_s_tb->blknum[n_h] - 1) : 1; in get_empty_nodes()
798 if ( reiserfs_new_form_blocknrs (p_s_tb, a_n_blocknrs, in get_empty_nodes()
821 free_buffers_in_tb (p_s_tb); in get_empty_nodes()
834 if (p_s_tb->FEB[p_s_tb->cur_blknum]) in get_empty_nodes()
838 p_s_tb->FEB[p_s_tb->cur_blknum++] = p_s_new_bh; in get_empty_nodes()
841 if ( n_retval == CARRY_ON && FILESYSTEM_CHANGED_TB (p_s_tb) ) in get_empty_nodes()
894 struct tree_balance * p_s_tb, in is_left_neighbor_in_cache() argument
898 struct super_block * p_s_sb = p_s_tb->tb_sb; in is_left_neighbor_in_cache()
902 if ( ! p_s_tb->FL[n_h] ) /* Father of the left neighbor does not exist. */ in is_left_neighbor_in_cache()
906 p_s_father = PATH_H_PBUFFER(p_s_tb->tb_path, n_h + 1); in is_left_neighbor_in_cache()
910 ! B_IS_IN_TREE (p_s_tb->FL[n_h]) || in is_left_neighbor_in_cache()
912 ! buffer_uptodate (p_s_tb->FL[n_h]), in is_left_neighbor_in_cache()
914 p_s_father, p_s_tb->FL[n_h]); in is_left_neighbor_in_cache()
918 n_left_neighbor_position = ( p_s_father == p_s_tb->FL[n_h] ) ? in is_left_neighbor_in_cache()
919 p_s_tb->lkey[n_h] : B_NR_ITEMS (p_s_tb->FL[n_h]); in is_left_neighbor_in_cache()
921 n_left_neighbor_blocknr = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_left_neighbor_position); in is_left_neighbor_in_cache()
956 static int get_far_parent (struct tree_balance * p_s_tb, in get_far_parent() argument
964 struct path * p_s_path = p_s_tb->tb_path; in get_far_parent()
1005 if ( PATH_OFFSET_PBUFFER(p_s_tb->tb_path, FIRST_PATH_ELEMENT_OFFSET)->b_blocknr == in get_far_parent()
1006 SB_ROOT_BLOCK (p_s_tb->tb_sb) ) { in get_far_parent()
1021 if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) { in get_far_parent()
1032 (p_s_tb->lkey[n_h - 1] = n_position - 1) : (p_s_tb->rkey[n_h - 1] = n_position))); in get_far_parent()
1038 …if (search_by_key(p_s_tb->tb_sb, &s_lr_father_key, &s_path_to_neighbor_father, n_h + 1) == IO_ERRO… in get_far_parent()
1042 if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) { in get_far_parent()
1068 static int get_parents (struct tree_balance * p_s_tb, int n_h) in get_parents() argument
1070 struct path * p_s_path = p_s_tb->tb_path; in get_parents()
1073 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h); in get_parents()
1081 decrement_bcount(p_s_tb->FL[n_h]); in get_parents()
1082 decrement_bcount(p_s_tb->CFL[n_h]); in get_parents()
1083 decrement_bcount(p_s_tb->FR[n_h]); in get_parents()
1084 decrement_bcount(p_s_tb->CFR[n_h]); in get_parents()
1085 p_s_tb->FL[n_h] = p_s_tb->CFL[n_h] = p_s_tb->FR[n_h] = p_s_tb->CFR[n_h] = NULL; in get_parents()
1096 p_s_tb->lkey[n_h] = n_position - 1; in get_parents()
1103 if ( (n_ret_value = get_far_parent(p_s_tb, n_h + 1, &p_s_curf, in get_parents()
1108 decrement_bcount(p_s_tb->FL[n_h]); in get_parents()
1109 p_s_tb->FL[n_h] = p_s_curf; /* New initialization of FL[n_h]. */ in get_parents()
1110 decrement_bcount(p_s_tb->CFL[n_h]); in get_parents()
1111 p_s_tb->CFL[n_h] = p_s_curcf; /* New initialization of CFL[n_h]. */ in get_parents()
1124 …if ( (n_ret_value = get_far_parent(p_s_tb, n_h + 1, &p_s_curf, &p_s_curcf, RIGHT_PARENTS)) != CAR… in get_parents()
1133 p_s_tb->rkey[n_h] = n_position; in get_parents()
1136 decrement_bcount(p_s_tb->FR[n_h]); in get_parents()
1137 p_s_tb->FR[n_h] = p_s_curf; /* New initialization of FR[n_path_offset]. */ in get_parents()
1139 decrement_bcount(p_s_tb->CFR[n_h]); in get_parents()
1140 p_s_tb->CFR[n_h] = p_s_curcf; /* New initialization of CFR[n_path_offset]. */ in get_parents()
1855 struct tree_balance * p_s_tb, in get_direct_parent() argument
1859 struct path * p_s_path = p_s_tb->tb_path; in get_direct_parent()
1861 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h); in get_direct_parent()
1870 SB_ROOT_BLOCK (p_s_tb->tb_sb) ) { in get_direct_parent()
1891 if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) in get_direct_parent()
1906 struct tree_balance * p_s_tb, in get_neighbors() argument
1910 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h + 1); in get_neighbors()
1912 struct super_block * p_s_sb = p_s_tb->tb_sb; in get_neighbors()
1918 if ( p_s_tb->lnum[n_h] ) { in get_neighbors()
1921 p_s_bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset); in get_neighbors()
1923 RFALSE( p_s_bh == p_s_tb->FL[n_h] && in get_neighbors()
1924 ! PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset), in get_neighbors()
1927 …n_child_position = ( p_s_bh == p_s_tb->FL[n_h] ) ? p_s_tb->lkey[n_h] : B_NR_ITEMS (p_s_tb->FL[n_h]… in get_neighbors()
1928 n_son_number = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position); in get_neighbors()
1932 if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) { in get_neighbors()
1938 RFALSE( ! B_IS_IN_TREE(p_s_tb->FL[n_h]) || in get_neighbors()
1939 n_child_position > B_NR_ITEMS(p_s_tb->FL[n_h]) || in get_neighbors()
1940 B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position) != in get_neighbors()
1944 …B_FREE_SPACE (p_s_bh) != MAX_CHILD_SIZE (p_s_bh) - dc_size(B_N_CHILD (p_s_tb->FL[0],n_child_positi… in get_neighbors()
1947 decrement_bcount(p_s_tb->L[n_h]); in get_neighbors()
1948 p_s_tb->L[n_h] = p_s_bh; in get_neighbors()
1952 if ( p_s_tb->rnum[n_h] ) { /* We need right neighbor to balance S[n_path_offset]. */ in get_neighbors()
1954 p_s_bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset); in get_neighbors()
1956 RFALSE( p_s_bh == p_s_tb->FR[n_h] && in get_neighbors()
1957 PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset) >= B_NR_ITEMS(p_s_bh), in get_neighbors()
1960 n_child_position = ( p_s_bh == p_s_tb->FR[n_h] ) ? p_s_tb->rkey[n_h] + 1 : 0; in get_neighbors()
1961 n_son_number = B_N_CHILD_NUM(p_s_tb->FR[n_h], n_child_position); in get_neighbors()
1965 if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) { in get_neighbors()
1970 decrement_bcount(p_s_tb->R[n_h]); in get_neighbors()
1971 p_s_tb->R[n_h] = p_s_bh; in get_neighbors()
1973 …RFALSE( ! n_h && B_FREE_SPACE (p_s_bh) != MAX_CHILD_SIZE (p_s_bh) - dc_size(B_N_CHILD (p_s_tb->FR[… in get_neighbors()
1976 dc_size(B_N_CHILD (p_s_tb->FR[0],n_child_position))); in get_neighbors()
2127 static int wait_tb_buffers_until_unlocked (struct tree_balance * p_s_tb) in wait_tb_buffers_until_unlocked() argument
2139 for ( i = p_s_tb->tb_path->path_length; !locked && i > ILLEGAL_PATH_ELEMENT_OFFSET; i-- ) { in wait_tb_buffers_until_unlocked()
2140 if ( PATH_OFFSET_PBUFFER (p_s_tb->tb_path, i) ) { in wait_tb_buffers_until_unlocked()
2145 if (PATH_PLAST_BUFFER(p_s_tb->tb_path) == in wait_tb_buffers_until_unlocked()
2146 PATH_OFFSET_PBUFFER(p_s_tb->tb_path, i)) { in wait_tb_buffers_until_unlocked()
2147 tb_buffer_sanity_check (p_s_tb->tb_sb, in wait_tb_buffers_until_unlocked()
2148 PATH_OFFSET_PBUFFER (p_s_tb->tb_path, i), in wait_tb_buffers_until_unlocked()
2150 p_s_tb->tb_path->path_length - i); in wait_tb_buffers_until_unlocked()
2153 clear_all_dirty_bits(p_s_tb->tb_sb, in wait_tb_buffers_until_unlocked()
2154 PATH_OFFSET_PBUFFER (p_s_tb->tb_path, i)) ; in wait_tb_buffers_until_unlocked()
2156 if ( buffer_locked (PATH_OFFSET_PBUFFER (p_s_tb->tb_path, i)) ) in wait_tb_buffers_until_unlocked()
2157 locked = PATH_OFFSET_PBUFFER (p_s_tb->tb_path, i); in wait_tb_buffers_until_unlocked()
2161 for ( i = 0; !locked && i < MAX_HEIGHT && p_s_tb->insert_size[i]; i++ ) { in wait_tb_buffers_until_unlocked()
2163 if (p_s_tb->lnum[i] ) { in wait_tb_buffers_until_unlocked()
2165 if ( p_s_tb->L[i] ) { in wait_tb_buffers_until_unlocked()
2166 tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->L[i], "L", i); in wait_tb_buffers_until_unlocked()
2167 clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->L[i]) ; in wait_tb_buffers_until_unlocked()
2168 if ( buffer_locked (p_s_tb->L[i]) ) in wait_tb_buffers_until_unlocked()
2169 locked = p_s_tb->L[i]; in wait_tb_buffers_until_unlocked()
2172 if ( !locked && p_s_tb->FL[i] ) { in wait_tb_buffers_until_unlocked()
2173 tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->FL[i], "FL", i); in wait_tb_buffers_until_unlocked()
2174 clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->FL[i]) ; in wait_tb_buffers_until_unlocked()
2175 if ( buffer_locked (p_s_tb->FL[i]) ) in wait_tb_buffers_until_unlocked()
2176 locked = p_s_tb->FL[i]; in wait_tb_buffers_until_unlocked()
2179 if ( !locked && p_s_tb->CFL[i] ) { in wait_tb_buffers_until_unlocked()
2180 tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->CFL[i], "CFL", i); in wait_tb_buffers_until_unlocked()
2181 clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->CFL[i]) ; in wait_tb_buffers_until_unlocked()
2182 if ( buffer_locked (p_s_tb->CFL[i]) ) in wait_tb_buffers_until_unlocked()
2183 locked = p_s_tb->CFL[i]; in wait_tb_buffers_until_unlocked()
2188 if ( !locked && (p_s_tb->rnum[i]) ) { in wait_tb_buffers_until_unlocked()
2190 if ( p_s_tb->R[i] ) { in wait_tb_buffers_until_unlocked()
2191 tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->R[i], "R", i); in wait_tb_buffers_until_unlocked()
2192 clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->R[i]) ; in wait_tb_buffers_until_unlocked()
2193 if ( buffer_locked (p_s_tb->R[i]) ) in wait_tb_buffers_until_unlocked()
2194 locked = p_s_tb->R[i]; in wait_tb_buffers_until_unlocked()
2198 if ( !locked && p_s_tb->FR[i] ) { in wait_tb_buffers_until_unlocked()
2199 tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->FR[i], "FR", i); in wait_tb_buffers_until_unlocked()
2200 clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->FR[i]) ; in wait_tb_buffers_until_unlocked()
2201 if ( buffer_locked (p_s_tb->FR[i]) ) in wait_tb_buffers_until_unlocked()
2202 locked = p_s_tb->FR[i]; in wait_tb_buffers_until_unlocked()
2205 if ( !locked && p_s_tb->CFR[i] ) { in wait_tb_buffers_until_unlocked()
2206 tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->CFR[i], "CFR", i); in wait_tb_buffers_until_unlocked()
2207 clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->CFR[i]) ; in wait_tb_buffers_until_unlocked()
2208 if ( buffer_locked (p_s_tb->CFR[i]) ) in wait_tb_buffers_until_unlocked()
2209 locked = p_s_tb->CFR[i]; in wait_tb_buffers_until_unlocked()
2222 if ( p_s_tb->FEB[i] ) { in wait_tb_buffers_until_unlocked()
2223 clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->FEB[i]) ; in wait_tb_buffers_until_unlocked()
2224 if (buffer_locked(p_s_tb->FEB[i])) { in wait_tb_buffers_until_unlocked()
2225 locked = p_s_tb->FEB[i] ; in wait_tb_buffers_until_unlocked()
2234 …reiserfs_warning (p_s_tb->tb_sb, "wait_tb_buffers_until_released(): too many iterations waiting fo… in wait_tb_buffers_until_unlocked()
2238 return ( FILESYSTEM_CHANGED_TB (p_s_tb) ) ? REPEAT_SEARCH : CARRY_ON; in wait_tb_buffers_until_unlocked()
2242 if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) { in wait_tb_buffers_until_unlocked()
2283 struct tree_balance * p_s_tb, in fix_nodes() argument
2289 n_item_num = PATH_LAST_POSITION(p_s_tb->tb_path); in fix_nodes()
2297 struct buffer_head * p_s_tbS0 = PATH_PLAST_BUFFER(p_s_tb->tb_path); in fix_nodes()
2299 ++ p_s_tb -> tb_sb -> u.reiserfs_sb.s_fix_nodes; in fix_nodes()
2301 n_pos_in_item = p_s_tb->tb_path->pos_in_item; in fix_nodes()
2304 p_s_tb->fs_gen = get_generation (p_s_tb->tb_sb); in fix_nodes()
2311 reiserfs_prepare_for_journal(p_s_tb->tb_sb, in fix_nodes()
2312 SB_BUFFER_WITH_SB(p_s_tb->tb_sb), 1) ; in fix_nodes()
2313 journal_mark_dirty(p_s_tb->transaction_handle, p_s_tb->tb_sb, in fix_nodes()
2314 SB_BUFFER_WITH_SB(p_s_tb->tb_sb)) ; in fix_nodes()
2315 if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) in fix_nodes()
2321 if ( FILESYSTEM_CHANGED_TB (p_s_tb) ) in fix_nodes()
2328 reiserfs_panic(p_s_tb->tb_sb,"PAP-8305: fix_nodes: there is pending do_balance"); in fix_nodes()
2332 reiserfs_panic (p_s_tb->tb_sb, "PAP-8320: fix_nodes: S[0] (%b %z) is not uptodate " in fix_nodes()
2340 …reiserfs_panic(p_s_tb->tb_sb,"PAP-8330: fix_nodes: Incorrect item number %d (in S0 - %d) in case o… in fix_nodes()
2348 printk("mode = %c insert_size = %d\n", n_op_mode, p_s_tb->insert_size[0]); in fix_nodes()
2349 reiserfs_panic(p_s_tb->tb_sb,"PAP-8335: fix_nodes: Incorrect item number(%d)", n_item_num); in fix_nodes()
2353 reiserfs_panic(p_s_tb->tb_sb,"PAP-8340: fix_nodes: Incorrect mode of operation"); in fix_nodes()
2357 if (get_mem_for_virtual_node (p_s_tb) == REPEAT_SEARCH) in fix_nodes()
2363 for ( n_h = 0; n_h < MAX_HEIGHT && p_s_tb->insert_size[n_h]; n_h++ ) { in fix_nodes()
2364 if ( (n_ret_value = get_direct_parent(p_s_tb, n_h)) != CARRY_ON ) { in fix_nodes()
2368 if ( (n_ret_value = check_balance (n_op_mode, p_s_tb, n_h, n_item_num, in fix_nodes()
2372 if ( (n_ret_value = get_neighbors(p_s_tb, n_h)) != CARRY_ON ) { in fix_nodes()
2376 p_s_tb->insert_size[n_h + 1] = 0; in fix_nodes()
2383 if ( (n_ret_value = get_neighbors(p_s_tb, n_h)) != CARRY_ON ) { in fix_nodes()
2387 if ( (n_ret_value = get_empty_nodes(p_s_tb, n_h)) != CARRY_ON ) { in fix_nodes()
2392 if ( ! PATH_H_PBUFFER(p_s_tb->tb_path, n_h) ) { in fix_nodes()
2396 RFALSE( p_s_tb->blknum[n_h] != 1, in fix_nodes()
2400 p_s_tb->insert_size[n_h + 1] = 0; in fix_nodes()
2403 if ( ! PATH_H_PBUFFER(p_s_tb->tb_path, n_h + 1) ) { in fix_nodes()
2404 if ( p_s_tb->blknum[n_h] > 1 ) { in fix_nodes()
2413 p_s_tb->insert_size[n_h + 1] = (DC_SIZE + KEY_SIZE) * (p_s_tb->blknum[n_h] - 1) + DC_SIZE; in fix_nodes()
2417 p_s_tb->insert_size[n_h + 1] = 0; in fix_nodes()
2420 p_s_tb->insert_size[n_h + 1] = (DC_SIZE + KEY_SIZE) * (p_s_tb->blknum[n_h] - 1); in fix_nodes()
2425 if ((n_ret_value = wait_tb_buffers_until_unlocked (p_s_tb)) == CARRY_ON) { in fix_nodes()
2427 if (FILESYSTEM_CHANGED_TB(p_s_tb)) { in fix_nodes()
2451 pathrelse_and_restore(p_s_tb->tb_sb, p_s_tb->tb_path) ; in fix_nodes()
2453 pathrelse (p_s_tb->tb_path); in fix_nodes()
2458 reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, p_s_tb->L[i]); in fix_nodes()
2459 reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, p_s_tb->R[i]); in fix_nodes()
2460 reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, p_s_tb->FL[i]); in fix_nodes()
2461 reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, p_s_tb->FR[i]); in fix_nodes()
2462 reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, p_s_tb->CFL[i]); in fix_nodes()
2463 reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, p_s_tb->CFR[i]); in fix_nodes()
2466 brelse (p_s_tb->L[i]);p_s_tb->L[i] = 0; in fix_nodes()
2467 brelse (p_s_tb->R[i]);p_s_tb->R[i] = 0; in fix_nodes()
2468 brelse (p_s_tb->FL[i]);p_s_tb->FL[i] = 0; in fix_nodes()
2469 brelse (p_s_tb->FR[i]);p_s_tb->FR[i] = 0; in fix_nodes()
2470 brelse (p_s_tb->CFL[i]);p_s_tb->CFL[i] = 0; in fix_nodes()
2471 brelse (p_s_tb->CFR[i]);p_s_tb->CFR[i] = 0; in fix_nodes()
2476 if ( p_s_tb->FEB[i] ) { in fix_nodes()
2477 reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, in fix_nodes()
2478 p_s_tb->FEB[i]) ; in fix_nodes()