reiserfs: rename p_._ variables

This patch is a simple s/p_._//g to the reiserfs code.  This is the
fifth in a series of patches to rip out some of the awful variable
naming in reiserfs.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jeff Mahoney 2009-03-30 14:02:49 -04:00 committed by Linus Torvalds
parent a063ae1792
commit d68caa9530
5 changed files with 365 additions and 356 deletions

View file

@ -134,10 +134,10 @@ static void reiserfs_vfs_truncate_file(struct inode *inode)
* be removed... * be removed...
*/ */
static int reiserfs_sync_file(struct file *p_s_filp, static int reiserfs_sync_file(struct file *filp,
struct dentry *p_s_dentry, int datasync) struct dentry *dentry, int datasync)
{ {
struct inode *inode = p_s_dentry->d_inode; struct inode *inode = dentry->d_inode;
int n_err; int n_err;
int barrier_done; int barrier_done;

View file

@ -780,9 +780,9 @@ static void free_buffers_in_tb(struct tree_balance *tb)
/* The function is NOT SCHEDULE-SAFE! */ /* The function is NOT SCHEDULE-SAFE! */
static int get_empty_nodes(struct tree_balance *tb, int n_h) static int get_empty_nodes(struct tree_balance *tb, int n_h)
{ {
struct buffer_head *p_s_new_bh, struct buffer_head *new_bh,
*p_s_Sh = PATH_H_PBUFFER(tb->tb_path, n_h); *Sh = PATH_H_PBUFFER(tb->tb_path, n_h);
b_blocknr_t *p_n_blocknr, a_n_blocknrs[MAX_AMOUNT_NEEDED] = { 0, }; b_blocknr_t *blocknr, a_n_blocknrs[MAX_AMOUNT_NEEDED] = { 0, };
int n_counter, n_number_of_freeblk, n_amount_needed, /* number of needed empty blocks */ int n_counter, n_number_of_freeblk, n_amount_needed, /* number of needed empty blocks */
n_retval = CARRY_ON; n_retval = CARRY_ON;
struct super_block *sb = tb->tb_sb; struct super_block *sb = tb->tb_sb;
@ -810,8 +810,8 @@ static int get_empty_nodes(struct tree_balance *tb, int n_h)
1) : 0; 1) : 0;
/* Allocate missing empty blocks. */ /* Allocate missing empty blocks. */
/* if p_s_Sh == 0 then we are getting a new root */ /* if Sh == 0 then we are getting a new root */
n_amount_needed = (p_s_Sh) ? (tb->blknum[n_h] - 1) : 1; n_amount_needed = (Sh) ? (tb->blknum[n_h] - 1) : 1;
/* Amount_needed = the amount that we need more than the amount that we have. */ /* Amount_needed = the amount that we need more than the amount that we have. */
if (n_amount_needed > n_number_of_freeblk) if (n_amount_needed > n_number_of_freeblk)
n_amount_needed -= n_number_of_freeblk; n_amount_needed -= n_number_of_freeblk;
@ -824,25 +824,25 @@ static int get_empty_nodes(struct tree_balance *tb, int n_h)
return NO_DISK_SPACE; return NO_DISK_SPACE;
/* for each blocknumber we just got, get a buffer and stick it on FEB */ /* for each blocknumber we just got, get a buffer and stick it on FEB */
for (p_n_blocknr = a_n_blocknrs, n_counter = 0; for (blocknr = a_n_blocknrs, n_counter = 0;
n_counter < n_amount_needed; p_n_blocknr++, n_counter++) { n_counter < n_amount_needed; blocknr++, n_counter++) {
RFALSE(!*p_n_blocknr, RFALSE(!*blocknr,
"PAP-8135: reiserfs_new_blocknrs failed when got new blocks"); "PAP-8135: reiserfs_new_blocknrs failed when got new blocks");
p_s_new_bh = sb_getblk(sb, *p_n_blocknr); new_bh = sb_getblk(sb, *blocknr);
RFALSE(buffer_dirty(p_s_new_bh) || RFALSE(buffer_dirty(new_bh) ||
buffer_journaled(p_s_new_bh) || buffer_journaled(new_bh) ||
buffer_journal_dirty(p_s_new_bh), buffer_journal_dirty(new_bh),
"PAP-8140: journlaled or dirty buffer %b for the new block", "PAP-8140: journlaled or dirty buffer %b for the new block",
p_s_new_bh); new_bh);
/* Put empty buffers into the array. */ /* Put empty buffers into the array. */
RFALSE(tb->FEB[tb->cur_blknum], RFALSE(tb->FEB[tb->cur_blknum],
"PAP-8141: busy slot for new buffer"); "PAP-8141: busy slot for new buffer");
set_buffer_journal_new(p_s_new_bh); set_buffer_journal_new(new_bh);
tb->FEB[tb->cur_blknum++] = p_s_new_bh; tb->FEB[tb->cur_blknum++] = new_bh;
} }
if (n_retval == CARRY_ON && FILESYSTEM_CHANGED_TB(tb)) if (n_retval == CARRY_ON && FILESYSTEM_CHANGED_TB(tb))
@ -898,7 +898,7 @@ static int get_rfree(struct tree_balance *tb, int h)
/* Check whether left neighbor is in memory. */ /* Check whether left neighbor is in memory. */
static int is_left_neighbor_in_cache(struct tree_balance *tb, int n_h) static int is_left_neighbor_in_cache(struct tree_balance *tb, int n_h)
{ {
struct buffer_head *p_s_father, *left; struct buffer_head *father, *left;
struct super_block *sb = tb->tb_sb; struct super_block *sb = tb->tb_sb;
b_blocknr_t n_left_neighbor_blocknr; b_blocknr_t n_left_neighbor_blocknr;
int n_left_neighbor_position; int n_left_neighbor_position;
@ -908,18 +908,18 @@ static int is_left_neighbor_in_cache(struct tree_balance *tb, int n_h)
return 0; return 0;
/* Calculate father of the node to be balanced. */ /* Calculate father of the node to be balanced. */
p_s_father = PATH_H_PBUFFER(tb->tb_path, n_h + 1); father = PATH_H_PBUFFER(tb->tb_path, n_h + 1);
RFALSE(!p_s_father || RFALSE(!father ||
!B_IS_IN_TREE(p_s_father) || !B_IS_IN_TREE(father) ||
!B_IS_IN_TREE(tb->FL[n_h]) || !B_IS_IN_TREE(tb->FL[n_h]) ||
!buffer_uptodate(p_s_father) || !buffer_uptodate(father) ||
!buffer_uptodate(tb->FL[n_h]), !buffer_uptodate(tb->FL[n_h]),
"vs-8165: F[h] (%b) or FL[h] (%b) is invalid", "vs-8165: F[h] (%b) or FL[h] (%b) is invalid",
p_s_father, tb->FL[n_h]); father, tb->FL[n_h]);
/* Get position of the pointer to the left neighbor into the left father. */ /* Get position of the pointer to the left neighbor into the left father. */
n_left_neighbor_position = (p_s_father == tb->FL[n_h]) ? n_left_neighbor_position = (father == tb->FL[n_h]) ?
tb->lkey[n_h] : B_NR_ITEMS(tb->FL[n_h]); tb->lkey[n_h] : B_NR_ITEMS(tb->FL[n_h]);
/* Get left neighbor block number. */ /* Get left neighbor block number. */
n_left_neighbor_blocknr = n_left_neighbor_blocknr =
@ -940,10 +940,10 @@ static int is_left_neighbor_in_cache(struct tree_balance *tb, int n_h)
#define LEFT_PARENTS 'l' #define LEFT_PARENTS 'l'
#define RIGHT_PARENTS 'r' #define RIGHT_PARENTS 'r'
static void decrement_key(struct cpu_key *p_s_key) static void decrement_key(struct cpu_key *key)
{ {
// call item specific function for this key // call item specific function for this key
item_ops[cpu_key_k_type(p_s_key)]->decrement_key(p_s_key); item_ops[cpu_key_k_type(key)]->decrement_key(key);
} }
/* Calculate far left/right parent of the left/right neighbor of the current node, that /* Calculate far left/right parent of the left/right neighbor of the current node, that
@ -956,17 +956,17 @@ static void decrement_key(struct cpu_key *p_s_key)
*/ */
static int get_far_parent(struct tree_balance *tb, static int get_far_parent(struct tree_balance *tb,
int n_h, int n_h,
struct buffer_head **pp_s_father, struct buffer_head **pfather,
struct buffer_head **pp_s_com_father, char c_lr_par) struct buffer_head **pcom_father, char c_lr_par)
{ {
struct buffer_head *p_s_parent; struct buffer_head *parent;
INITIALIZE_PATH(s_path_to_neighbor_father); INITIALIZE_PATH(s_path_to_neighbor_father);
struct treepath *p_s_path = tb->tb_path; struct treepath *path = tb->tb_path;
struct cpu_key s_lr_father_key; struct cpu_key s_lr_father_key;
int n_counter, int n_counter,
n_position = INT_MAX, n_position = INT_MAX,
n_first_last_position = 0, n_first_last_position = 0,
n_path_offset = PATH_H_PATH_OFFSET(p_s_path, n_h); n_path_offset = PATH_H_PATH_OFFSET(path, n_h);
/* Starting from F[n_h] go upwards in the tree, and look for the common /* Starting from F[n_h] go upwards in the tree, and look for the common
ancestor of F[n_h], and its neighbor l/r, that should be obtained. */ ancestor of F[n_h], and its neighbor l/r, that should be obtained. */
@ -979,25 +979,25 @@ static int get_far_parent(struct tree_balance *tb,
for (; n_counter > FIRST_PATH_ELEMENT_OFFSET; n_counter--) { for (; n_counter > FIRST_PATH_ELEMENT_OFFSET; n_counter--) {
/* Check whether parent of the current buffer in the path is really parent in the tree. */ /* Check whether parent of the current buffer in the path is really parent in the tree. */
if (!B_IS_IN_TREE if (!B_IS_IN_TREE
(p_s_parent = PATH_OFFSET_PBUFFER(p_s_path, n_counter - 1))) (parent = PATH_OFFSET_PBUFFER(path, n_counter - 1)))
return REPEAT_SEARCH; return REPEAT_SEARCH;
/* Check whether position in the parent is correct. */ /* Check whether position in the parent is correct. */
if ((n_position = if ((n_position =
PATH_OFFSET_POSITION(p_s_path, PATH_OFFSET_POSITION(path,
n_counter - 1)) > n_counter - 1)) >
B_NR_ITEMS(p_s_parent)) B_NR_ITEMS(parent))
return REPEAT_SEARCH; return REPEAT_SEARCH;
/* Check whether parent at the path really points to the child. */ /* Check whether parent at the path really points to the child. */
if (B_N_CHILD_NUM(p_s_parent, n_position) != if (B_N_CHILD_NUM(parent, n_position) !=
PATH_OFFSET_PBUFFER(p_s_path, n_counter)->b_blocknr) PATH_OFFSET_PBUFFER(path, n_counter)->b_blocknr)
return REPEAT_SEARCH; return REPEAT_SEARCH;
/* Return delimiting key if position in the parent is not equal to first/last one. */ /* Return delimiting key if position in the parent is not equal to first/last one. */
if (c_lr_par == RIGHT_PARENTS) if (c_lr_par == RIGHT_PARENTS)
n_first_last_position = B_NR_ITEMS(p_s_parent); n_first_last_position = B_NR_ITEMS(parent);
if (n_position != n_first_last_position) { if (n_position != n_first_last_position) {
*pp_s_com_father = p_s_parent; *pcom_father = parent;
get_bh(*pp_s_com_father); get_bh(*pcom_father);
/*(*pp_s_com_father = p_s_parent)->b_count++; */ /*(*pcom_father = parent)->b_count++; */
break; break;
} }
} }
@ -1009,22 +1009,22 @@ static int get_far_parent(struct tree_balance *tb,
(tb->tb_path, (tb->tb_path,
FIRST_PATH_ELEMENT_OFFSET)->b_blocknr == FIRST_PATH_ELEMENT_OFFSET)->b_blocknr ==
SB_ROOT_BLOCK(tb->tb_sb)) { SB_ROOT_BLOCK(tb->tb_sb)) {
*pp_s_father = *pp_s_com_father = NULL; *pfather = *pcom_father = NULL;
return CARRY_ON; return CARRY_ON;
} }
return REPEAT_SEARCH; return REPEAT_SEARCH;
} }
RFALSE(B_LEVEL(*pp_s_com_father) <= DISK_LEAF_NODE_LEVEL, RFALSE(B_LEVEL(*pcom_father) <= DISK_LEAF_NODE_LEVEL,
"PAP-8185: (%b %z) level too small", "PAP-8185: (%b %z) level too small",
*pp_s_com_father, *pp_s_com_father); *pcom_father, *pcom_father);
/* Check whether the common parent is locked. */ /* Check whether the common parent is locked. */
if (buffer_locked(*pp_s_com_father)) { if (buffer_locked(*pcom_father)) {
__wait_on_buffer(*pp_s_com_father); __wait_on_buffer(*pcom_father);
if (FILESYSTEM_CHANGED_TB(tb)) { if (FILESYSTEM_CHANGED_TB(tb)) {
brelse(*pp_s_com_father); brelse(*pcom_father);
return REPEAT_SEARCH; return REPEAT_SEARCH;
} }
} }
@ -1034,7 +1034,7 @@ static int get_far_parent(struct tree_balance *tb,
/* Form key to get parent of the left/right neighbor. */ /* Form key to get parent of the left/right neighbor. */
le_key2cpu_key(&s_lr_father_key, le_key2cpu_key(&s_lr_father_key,
B_N_PDELIM_KEY(*pp_s_com_father, B_N_PDELIM_KEY(*pcom_father,
(c_lr_par == (c_lr_par ==
LEFT_PARENTS) ? (tb->lkey[n_h - 1] = LEFT_PARENTS) ? (tb->lkey[n_h - 1] =
n_position - n_position -
@ -1053,14 +1053,14 @@ static int get_far_parent(struct tree_balance *tb,
if (FILESYSTEM_CHANGED_TB(tb)) { if (FILESYSTEM_CHANGED_TB(tb)) {
pathrelse(&s_path_to_neighbor_father); pathrelse(&s_path_to_neighbor_father);
brelse(*pp_s_com_father); brelse(*pcom_father);
return REPEAT_SEARCH; return REPEAT_SEARCH;
} }
*pp_s_father = PATH_PLAST_BUFFER(&s_path_to_neighbor_father); *pfather = PATH_PLAST_BUFFER(&s_path_to_neighbor_father);
RFALSE(B_LEVEL(*pp_s_father) != n_h + 1, RFALSE(B_LEVEL(*pfather) != n_h + 1,
"PAP-8190: (%b %z) level too small", *pp_s_father, *pp_s_father); "PAP-8190: (%b %z) level too small", *pfather, *pfather);
RFALSE(s_path_to_neighbor_father.path_length < RFALSE(s_path_to_neighbor_father.path_length <
FIRST_PATH_ELEMENT_OFFSET, "PAP-8192: path length is too small"); FIRST_PATH_ELEMENT_OFFSET, "PAP-8192: path length is too small");
@ -1078,11 +1078,11 @@ static int get_far_parent(struct tree_balance *tb,
*/ */
static int get_parents(struct tree_balance *tb, int n_h) static int get_parents(struct tree_balance *tb, int n_h)
{ {
struct treepath *p_s_path = tb->tb_path; struct treepath *path = tb->tb_path;
int n_position, int n_position,
n_ret_value, n_ret_value,
n_path_offset = PATH_H_PATH_OFFSET(tb->tb_path, n_h); n_path_offset = PATH_H_PATH_OFFSET(tb->tb_path, n_h);
struct buffer_head *p_s_curf, *p_s_curcf; struct buffer_head *curf, *curcf;
/* Current node is the root of the tree or will be root of the tree */ /* Current node is the root of the tree or will be root of the tree */
if (n_path_offset <= FIRST_PATH_ELEMENT_OFFSET) { if (n_path_offset <= FIRST_PATH_ELEMENT_OFFSET) {
@ -1100,66 +1100,65 @@ static int get_parents(struct tree_balance *tb, int n_h)
} }
/* Get parent FL[n_path_offset] of L[n_path_offset]. */ /* Get parent FL[n_path_offset] of L[n_path_offset]. */
if ((n_position = PATH_OFFSET_POSITION(p_s_path, n_path_offset - 1))) { n_position = PATH_OFFSET_POSITION(path, n_path_offset - 1);
if (n_position) {
/* Current node is not the first child of its parent. */ /* Current node is not the first child of its parent. */
/*(p_s_curf = p_s_curcf = PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1))->b_count += 2; */ curf = PATH_OFFSET_PBUFFER(path, n_path_offset - 1);
p_s_curf = p_s_curcf = curcf = PATH_OFFSET_PBUFFER(path, n_path_offset - 1);
PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1); get_bh(curf);
get_bh(p_s_curf); get_bh(curf);
get_bh(p_s_curf);
tb->lkey[n_h] = n_position - 1; tb->lkey[n_h] = n_position - 1;
} else { } else {
/* Calculate current parent of L[n_path_offset], which is the left neighbor of the current node. /* Calculate current parent of L[n_path_offset], which is the left neighbor of the current node.
Calculate current common parent of L[n_path_offset] and the current node. Note that Calculate current common parent of L[n_path_offset] and the current node. Note that
CFL[n_path_offset] not equal FL[n_path_offset] and CFL[n_path_offset] not equal F[n_path_offset]. CFL[n_path_offset] not equal FL[n_path_offset] and CFL[n_path_offset] not equal F[n_path_offset].
Calculate lkey[n_path_offset]. */ Calculate lkey[n_path_offset]. */
if ((n_ret_value = get_far_parent(tb, n_h + 1, &p_s_curf, if ((n_ret_value = get_far_parent(tb, n_h + 1, &curf,
&p_s_curcf, &curcf,
LEFT_PARENTS)) != CARRY_ON) LEFT_PARENTS)) != CARRY_ON)
return n_ret_value; return n_ret_value;
} }
brelse(tb->FL[n_h]); brelse(tb->FL[n_h]);
tb->FL[n_h] = p_s_curf; /* New initialization of FL[n_h]. */ tb->FL[n_h] = curf; /* New initialization of FL[n_h]. */
brelse(tb->CFL[n_h]); brelse(tb->CFL[n_h]);
tb->CFL[n_h] = p_s_curcf; /* New initialization of CFL[n_h]. */ tb->CFL[n_h] = curcf; /* New initialization of CFL[n_h]. */
RFALSE((p_s_curf && !B_IS_IN_TREE(p_s_curf)) || RFALSE((curf && !B_IS_IN_TREE(curf)) ||
(p_s_curcf && !B_IS_IN_TREE(p_s_curcf)), (curcf && !B_IS_IN_TREE(curcf)),
"PAP-8195: FL (%b) or CFL (%b) is invalid", p_s_curf, p_s_curcf); "PAP-8195: FL (%b) or CFL (%b) is invalid", curf, curcf);
/* Get parent FR[n_h] of R[n_h]. */ /* Get parent FR[n_h] of R[n_h]. */
/* Current node is the last child of F[n_h]. FR[n_h] != F[n_h]. */ /* Current node is the last child of F[n_h]. FR[n_h] != F[n_h]. */
if (n_position == B_NR_ITEMS(PATH_H_PBUFFER(p_s_path, n_h + 1))) { if (n_position == B_NR_ITEMS(PATH_H_PBUFFER(path, n_h + 1))) {
/* Calculate current parent of R[n_h], which is the right neighbor of F[n_h]. /* Calculate current parent of R[n_h], which is the right neighbor of F[n_h].
Calculate current common parent of R[n_h] and current node. Note that CFR[n_h] Calculate current common parent of R[n_h] and current node. Note that CFR[n_h]
not equal FR[n_path_offset] and CFR[n_h] not equal F[n_h]. */ not equal FR[n_path_offset] and CFR[n_h] not equal F[n_h]. */
if ((n_ret_value = if ((n_ret_value =
get_far_parent(tb, n_h + 1, &p_s_curf, &p_s_curcf, get_far_parent(tb, n_h + 1, &curf, &curcf,
RIGHT_PARENTS)) != CARRY_ON) RIGHT_PARENTS)) != CARRY_ON)
return n_ret_value; return n_ret_value;
} else { } else {
/* Current node is not the last child of its parent F[n_h]. */ /* Current node is not the last child of its parent F[n_h]. */
/*(p_s_curf = p_s_curcf = PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1))->b_count += 2; */ curf = PATH_OFFSET_PBUFFER(path, n_path_offset - 1);
p_s_curf = p_s_curcf = curcf = PATH_OFFSET_PBUFFER(path, n_path_offset - 1);
PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1); get_bh(curf);
get_bh(p_s_curf); get_bh(curf);
get_bh(p_s_curf);
tb->rkey[n_h] = n_position; tb->rkey[n_h] = n_position;
} }
brelse(tb->FR[n_h]); brelse(tb->FR[n_h]);
/* New initialization of FR[n_path_offset]. */ /* New initialization of FR[n_path_offset]. */
tb->FR[n_h] = p_s_curf; tb->FR[n_h] = curf;
brelse(tb->CFR[n_h]); brelse(tb->CFR[n_h]);
/* New initialization of CFR[n_path_offset]. */ /* New initialization of CFR[n_path_offset]. */
tb->CFR[n_h] = p_s_curcf; tb->CFR[n_h] = curcf;
RFALSE((p_s_curf && !B_IS_IN_TREE(p_s_curf)) || RFALSE((curf && !B_IS_IN_TREE(curf)) ||
(p_s_curcf && !B_IS_IN_TREE(p_s_curcf)), (curcf && !B_IS_IN_TREE(curcf)),
"PAP-8205: FR (%b) or CFR (%b) is invalid", p_s_curf, p_s_curcf); "PAP-8205: FR (%b) or CFR (%b) is invalid", curf, curcf);
return CARRY_ON; return CARRY_ON;
} }
@ -1893,7 +1892,7 @@ static int check_balance(int mode,
static int get_direct_parent(struct tree_balance *tb, int n_h) static int get_direct_parent(struct tree_balance *tb, int n_h)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct treepath *p_s_path = tb->tb_path; struct treepath *path = tb->tb_path;
int n_position, int n_position,
n_path_offset = PATH_H_PATH_OFFSET(tb->tb_path, n_h); n_path_offset = PATH_H_PATH_OFFSET(tb->tb_path, n_h);
@ -1903,27 +1902,27 @@ static int get_direct_parent(struct tree_balance *tb, int n_h)
RFALSE(n_path_offset < FIRST_PATH_ELEMENT_OFFSET - 1, RFALSE(n_path_offset < FIRST_PATH_ELEMENT_OFFSET - 1,
"PAP-8260: invalid offset in the path"); "PAP-8260: invalid offset in the path");
if (PATH_OFFSET_PBUFFER(p_s_path, FIRST_PATH_ELEMENT_OFFSET)-> if (PATH_OFFSET_PBUFFER(path, FIRST_PATH_ELEMENT_OFFSET)->
b_blocknr == SB_ROOT_BLOCK(tb->tb_sb)) { b_blocknr == SB_ROOT_BLOCK(tb->tb_sb)) {
/* Root is not changed. */ /* Root is not changed. */
PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1) = NULL; PATH_OFFSET_PBUFFER(path, n_path_offset - 1) = NULL;
PATH_OFFSET_POSITION(p_s_path, n_path_offset - 1) = 0; PATH_OFFSET_POSITION(path, n_path_offset - 1) = 0;
return CARRY_ON; return CARRY_ON;
} }
return REPEAT_SEARCH; /* Root is changed and we must recalculate the path. */ return REPEAT_SEARCH; /* Root is changed and we must recalculate the path. */
} }
if (!B_IS_IN_TREE if (!B_IS_IN_TREE
(bh = PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1))) (bh = PATH_OFFSET_PBUFFER(path, n_path_offset - 1)))
return REPEAT_SEARCH; /* Parent in the path is not in the tree. */ return REPEAT_SEARCH; /* Parent in the path is not in the tree. */
if ((n_position = if ((n_position =
PATH_OFFSET_POSITION(p_s_path, PATH_OFFSET_POSITION(path,
n_path_offset - 1)) > B_NR_ITEMS(bh)) n_path_offset - 1)) > B_NR_ITEMS(bh))
return REPEAT_SEARCH; return REPEAT_SEARCH;
if (B_N_CHILD_NUM(bh, n_position) != if (B_N_CHILD_NUM(bh, n_position) !=
PATH_OFFSET_PBUFFER(p_s_path, n_path_offset)->b_blocknr) PATH_OFFSET_PBUFFER(path, n_path_offset)->b_blocknr)
/* Parent in the path is not parent of the current node in the tree. */ /* Parent in the path is not parent of the current node in the tree. */
return REPEAT_SEARCH; return REPEAT_SEARCH;
@ -2319,7 +2318,7 @@ static int wait_tb_buffers_until_unlocked(struct tree_balance *tb)
*/ */
int fix_nodes(int n_op_mode, struct tree_balance *tb, int fix_nodes(int n_op_mode, struct tree_balance *tb,
struct item_head *p_s_ins_ih, const void *data) struct item_head *ins_ih, const void *data)
{ {
int n_ret_value, n_h, n_item_num = PATH_LAST_POSITION(tb->tb_path); int n_ret_value, n_h, n_item_num = PATH_LAST_POSITION(tb->tb_path);
int n_pos_in_item; int n_pos_in_item;
@ -2405,7 +2404,7 @@ int fix_nodes(int n_op_mode, struct tree_balance *tb,
goto repeat; goto repeat;
n_ret_value = check_balance(n_op_mode, tb, n_h, n_item_num, n_ret_value = check_balance(n_op_mode, tb, n_h, n_item_num,
n_pos_in_item, p_s_ins_ih, data); n_pos_in_item, ins_ih, data);
if (n_ret_value != CARRY_ON) { if (n_ret_value != CARRY_ON) {
if (n_ret_value == NO_BALANCING_NEEDED) { if (n_ret_value == NO_BALANCING_NEEDED) {
/* No balancing for higher levels needed. */ /* No balancing for higher levels needed. */

File diff suppressed because it is too large Load diff

View file

@ -172,10 +172,12 @@ void reiserfs_unmap_buffer(struct buffer_head *bh)
inode */ inode */
int indirect2direct(struct reiserfs_transaction_handle *th, int indirect2direct(struct reiserfs_transaction_handle *th,
struct inode *inode, struct page *page, struct inode *inode, struct page *page,
struct treepath *p_s_path, /* path to the indirect item. */ struct treepath *path, /* path to the indirect item. */
const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */ const struct cpu_key *item_key, /* Key to look for
* unformatted node
* pointer to be cut. */
loff_t n_new_file_size, /* New file size. */ loff_t n_new_file_size, /* New file size. */
char *p_c_mode) char *mode)
{ {
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct item_head s_ih; struct item_head s_ih;
@ -189,10 +191,10 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
REISERFS_SB(sb)->s_indirect2direct++; REISERFS_SB(sb)->s_indirect2direct++;
*p_c_mode = M_SKIP_BALANCING; *mode = M_SKIP_BALANCING;
/* store item head path points to. */ /* store item head path points to. */
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
tail_len = (n_new_file_size & (n_block_size - 1)); tail_len = (n_new_file_size & (n_block_size - 1));
if (get_inode_sd_version(inode) == STAT_DATA_V2) if (get_inode_sd_version(inode) == STAT_DATA_V2)
@ -211,14 +213,14 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
tail = (char *)kmap(page); /* this can schedule */ tail = (char *)kmap(page); /* this can schedule */
if (path_changed(&s_ih, p_s_path)) { if (path_changed(&s_ih, path)) {
/* re-search indirect item */ /* re-search indirect item */
if (search_for_position_by_key(sb, p_s_item_key, p_s_path) if (search_for_position_by_key(sb, item_key, path)
== POSITION_NOT_FOUND) == POSITION_NOT_FOUND)
reiserfs_panic(sb, "PAP-5520", reiserfs_panic(sb, "PAP-5520",
"item to be converted %K does not exist", "item to be converted %K does not exist",
p_s_item_key); item_key);
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
#ifdef CONFIG_REISERFS_CHECK #ifdef CONFIG_REISERFS_CHECK
pos = le_ih_k_offset(&s_ih) - 1 + pos = le_ih_k_offset(&s_ih) - 1 +
(ih_item_len(&s_ih) / UNFM_P_SIZE - (ih_item_len(&s_ih) / UNFM_P_SIZE -
@ -240,13 +242,13 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
*/ */
tail = tail + (pos & (PAGE_CACHE_SIZE - 1)); tail = tail + (pos & (PAGE_CACHE_SIZE - 1));
PATH_LAST_POSITION(p_s_path)++; PATH_LAST_POSITION(path)++;
key = *p_s_item_key; key = *item_key;
set_cpu_key_k_type(&key, TYPE_DIRECT); set_cpu_key_k_type(&key, TYPE_DIRECT);
key.key_length = 4; key.key_length = 4;
/* Insert tail as new direct item in the tree */ /* Insert tail as new direct item in the tree */
if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, inode, if (reiserfs_insert_item(th, path, &key, &s_ih, inode,
tail ? tail : NULL) < 0) { tail ? tail : NULL) < 0) {
/* No disk memory. So we can not convert last unformatted node /* No disk memory. So we can not convert last unformatted node
to the direct item. In this case we used to adjust to the direct item. In this case we used to adjust
@ -268,7 +270,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
/* We have inserted new direct item and must remove last /* We have inserted new direct item and must remove last
unformatted node. */ unformatted node. */
*p_c_mode = M_CUT; *mode = M_CUT;
/* we store position of first direct item in the in-core inode */ /* we store position of first direct item in the in-core inode */
/* mark_file_with_tail (inode, pos1 + 1); */ /* mark_file_with_tail (inode, pos1 + 1); */

View file

@ -694,9 +694,9 @@ static inline void cpu_key_k_offset_dec(struct cpu_key *key)
#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ #define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \
( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ (!COMP_SHORT_KEYS(ih, key) && \
I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize))
/* maximal length of item */ /* maximal length of item */
#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
@ -1196,33 +1196,33 @@ struct treepath {
struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
/* Get path element by path and path position. */ /* Get path element by path and path position. */
#define PATH_OFFSET_PELEMENT(p_s_path,n_offset) ((p_s_path)->path_elements +(n_offset)) #define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset))
/* Get buffer header at the path by path and path position. */ /* Get buffer header at the path by path and path position. */
#define PATH_OFFSET_PBUFFER(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_buffer) #define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer)
/* Get position in the element at the path by path and path position. */ /* Get position in the element at the path by path and path position. */
#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) #define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position)
#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) #define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length))
/* you know, to the person who didn't /* you know, to the person who didn't
write this the macro name does not write this the macro name does not
at first suggest what it does. at first suggest what it does.
Maybe POSITION_FROM_PATH_END? Or Maybe POSITION_FROM_PATH_END? Or
maybe we should just focus on maybe we should just focus on
dumping paths... -Hans */ dumping paths... -Hans */
#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) #define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length))
#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) #define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path))
/* in do_balance leaf has h == 0 in contrast with path structure, /* in do_balance leaf has h == 0 in contrast with path structure,
where root has level == 0. That is why we need these defines */ where root has level == 0. That is why we need these defines */
#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ #define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */
#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) #define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h))
#define get_last_bh(path) PATH_PLAST_BUFFER(path) #define get_last_bh(path) PATH_PLAST_BUFFER(path)
#define get_ih(path) PATH_PITEM_HEAD(path) #define get_ih(path) PATH_PITEM_HEAD(path)
@ -1512,7 +1512,7 @@ extern struct item_operations *item_ops[TYPE_ANY + 1];
#define COMP_SHORT_KEYS comp_short_keys #define COMP_SHORT_KEYS comp_short_keys
/* number of blocks pointed to by the indirect item */ /* number of blocks pointed to by the indirect item */
#define I_UNFM_NUM(p_s_ih) ( ih_item_len(p_s_ih) / UNFM_P_SIZE ) #define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE)
/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ /* the used space within the unformatted node corresponding to pos within the item pointed to by ih */
#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) #define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size))
@ -1793,8 +1793,8 @@ int reiserfs_convert_objectid_map_v1(struct super_block *);
/* stree.c */ /* stree.c */
int B_IS_IN_TREE(const struct buffer_head *); int B_IS_IN_TREE(const struct buffer_head *);
extern void copy_item_head(struct item_head *p_v_to, extern void copy_item_head(struct item_head *to,
const struct item_head *p_v_from); const struct item_head *from);
// first key is in cpu form, second - le // first key is in cpu form, second - le
extern int comp_short_keys(const struct reiserfs_key *le_key, extern int comp_short_keys(const struct reiserfs_key *le_key,
@ -1829,20 +1829,20 @@ static inline void copy_key(struct reiserfs_key *to,
memcpy(to, from, KEY_SIZE); memcpy(to, from, KEY_SIZE);
} }
int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path); int comp_items(const struct item_head *stored_ih, const struct treepath *path);
const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, const struct reiserfs_key *get_rkey(const struct treepath *chk_path,
const struct super_block *sb); const struct super_block *sb);
int search_by_key(struct super_block *, const struct cpu_key *, int search_by_key(struct super_block *, const struct cpu_key *,
struct treepath *, int); struct treepath *, int);
#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
int search_for_position_by_key(struct super_block *sb, int search_for_position_by_key(struct super_block *sb,
const struct cpu_key *p_s_cpu_key, const struct cpu_key *cpu_key,
struct treepath *p_s_search_path); struct treepath *search_path);
extern void decrement_bcount(struct buffer_head *bh); extern void decrement_bcount(struct buffer_head *bh);
void decrement_counters_in_path(struct treepath *p_s_search_path); void decrement_counters_in_path(struct treepath *search_path);
void pathrelse(struct treepath *p_s_search_path); void pathrelse(struct treepath *search_path);
int reiserfs_check_path(struct treepath *p); int reiserfs_check_path(struct treepath *p);
void pathrelse_and_restore(struct super_block *s, struct treepath *p_s_search_path); void pathrelse_and_restore(struct super_block *s, struct treepath *search_path);
int reiserfs_insert_item(struct reiserfs_transaction_handle *th, int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
struct treepath *path, struct treepath *path,
@ -1865,7 +1865,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
int reiserfs_delete_item(struct reiserfs_transaction_handle *th, int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
struct treepath *path, struct treepath *path,
const struct cpu_key *key, const struct cpu_key *key,
struct inode *inode, struct buffer_head *p_s_un_bh); struct inode *inode, struct buffer_head *un_bh);
void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
struct inode *inode, struct reiserfs_key *key); struct inode *inode, struct reiserfs_key *key);
@ -2005,7 +2005,7 @@ extern const struct address_space_operations reiserfs_address_space_operations;
/* fix_nodes.c */ /* fix_nodes.c */
int fix_nodes(int n_op_mode, struct tree_balance *tb, int fix_nodes(int n_op_mode, struct tree_balance *tb,
struct item_head *p_s_ins_ih, const void *); struct item_head *ins_ih, const void *);
void unfix_nodes(struct tree_balance *); void unfix_nodes(struct tree_balance *);
/* prints.c */ /* prints.c */