aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/reiserfs/fix_node.c94
-rw-r--r--fs/reiserfs/stree.c63
2 files changed, 75 insertions, 82 deletions
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c
index 799c0ce2429..ad42c45af44 100644
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -1887,7 +1887,7 @@ static int check_balance(int mode,
/* Check whether parent at the path is the really parent of the current node.*/
static int get_direct_parent(struct tree_balance *p_s_tb, int n_h)
{
- struct buffer_head *p_s_bh;
+ struct buffer_head *bh;
struct treepath *p_s_path = p_s_tb->tb_path;
int n_position,
n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h);
@@ -1909,21 +1909,21 @@ static int get_direct_parent(struct tree_balance *p_s_tb, int n_h)
}
if (!B_IS_IN_TREE
- (p_s_bh = PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1)))
+ (bh = PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1)))
return REPEAT_SEARCH; /* Parent in the path is not in the tree. */
if ((n_position =
PATH_OFFSET_POSITION(p_s_path,
- n_path_offset - 1)) > B_NR_ITEMS(p_s_bh))
+ n_path_offset - 1)) > B_NR_ITEMS(bh))
return REPEAT_SEARCH;
- if (B_N_CHILD_NUM(p_s_bh, n_position) !=
+ if (B_N_CHILD_NUM(bh, n_position) !=
PATH_OFFSET_PBUFFER(p_s_path, n_path_offset)->b_blocknr)
/* Parent in the path is not parent of the current node in the tree. */
return REPEAT_SEARCH;
- if (buffer_locked(p_s_bh)) {
- __wait_on_buffer(p_s_bh);
+ if (buffer_locked(bh)) {
+ __wait_on_buffer(bh);
if (FILESYSTEM_CHANGED_TB(p_s_tb))
return REPEAT_SEARCH;
}
@@ -1943,29 +1943,29 @@ static int get_neighbors(struct tree_balance *p_s_tb, int n_h)
n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h + 1);
unsigned long n_son_number;
struct super_block *sb = p_s_tb->tb_sb;
- struct buffer_head *p_s_bh;
+ struct buffer_head *bh;
PROC_INFO_INC(sb, get_neighbors[n_h]);
if (p_s_tb->lnum[n_h]) {
/* We need left neighbor to balance S[n_h]. */
PROC_INFO_INC(sb, need_l_neighbor[n_h]);
- p_s_bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset);
+ bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset);
- RFALSE(p_s_bh == p_s_tb->FL[n_h] &&
+ RFALSE(bh == p_s_tb->FL[n_h] &&
!PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset),
"PAP-8270: invalid position in the parent");
n_child_position =
- (p_s_bh ==
+ (bh ==
p_s_tb->FL[n_h]) ? p_s_tb->lkey[n_h] : B_NR_ITEMS(p_s_tb->
FL[n_h]);
n_son_number = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position);
- p_s_bh = sb_bread(sb, n_son_number);
- if (!p_s_bh)
+ bh = sb_bread(sb, n_son_number);
+ if (!bh)
return IO_ERROR;
if (FILESYSTEM_CHANGED_TB(p_s_tb)) {
- brelse(p_s_bh);
+ brelse(bh);
PROC_INFO_INC(sb, get_neighbors_restart[n_h]);
return REPEAT_SEARCH;
}
@@ -1973,48 +1973,48 @@ static int get_neighbors(struct tree_balance *p_s_tb, int n_h)
RFALSE(!B_IS_IN_TREE(p_s_tb->FL[n_h]) ||
n_child_position > B_NR_ITEMS(p_s_tb->FL[n_h]) ||
B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position) !=
- p_s_bh->b_blocknr, "PAP-8275: invalid parent");
- RFALSE(!B_IS_IN_TREE(p_s_bh), "PAP-8280: invalid child");
+ bh->b_blocknr, "PAP-8275: invalid parent");
+ RFALSE(!B_IS_IN_TREE(bh), "PAP-8280: invalid child");
RFALSE(!n_h &&
- B_FREE_SPACE(p_s_bh) !=
- MAX_CHILD_SIZE(p_s_bh) -
+ B_FREE_SPACE(bh) !=
+ MAX_CHILD_SIZE(bh) -
dc_size(B_N_CHILD(p_s_tb->FL[0], n_child_position)),
"PAP-8290: invalid child size of left neighbor");
brelse(p_s_tb->L[n_h]);
- p_s_tb->L[n_h] = p_s_bh;
+ p_s_tb->L[n_h] = bh;
}
if (p_s_tb->rnum[n_h]) { /* We need right neighbor to balance S[n_path_offset]. */
PROC_INFO_INC(sb, need_r_neighbor[n_h]);
- p_s_bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset);
+ bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset);
- RFALSE(p_s_bh == p_s_tb->FR[n_h] &&
+ RFALSE(bh == p_s_tb->FR[n_h] &&
PATH_OFFSET_POSITION(p_s_tb->tb_path,
n_path_offset) >=
- B_NR_ITEMS(p_s_bh),
+ B_NR_ITEMS(bh),
"PAP-8295: invalid position in the parent");
n_child_position =
- (p_s_bh == p_s_tb->FR[n_h]) ? p_s_tb->rkey[n_h] + 1 : 0;
+ (bh == p_s_tb->FR[n_h]) ? p_s_tb->rkey[n_h] + 1 : 0;
n_son_number = B_N_CHILD_NUM(p_s_tb->FR[n_h], n_child_position);
- p_s_bh = sb_bread(sb, n_son_number);
- if (!p_s_bh)
+ bh = sb_bread(sb, n_son_number);
+ if (!bh)
return IO_ERROR;
if (FILESYSTEM_CHANGED_TB(p_s_tb)) {
- brelse(p_s_bh);
+ brelse(bh);
PROC_INFO_INC(sb, get_neighbors_restart[n_h]);
return REPEAT_SEARCH;
}
brelse(p_s_tb->R[n_h]);
- p_s_tb->R[n_h] = p_s_bh;
+ p_s_tb->R[n_h] = bh;
RFALSE(!n_h
- && B_FREE_SPACE(p_s_bh) !=
- MAX_CHILD_SIZE(p_s_bh) -
+ && B_FREE_SPACE(bh) !=
+ MAX_CHILD_SIZE(bh) -
dc_size(B_N_CHILD(p_s_tb->FR[0], n_child_position)),
"PAP-8300: invalid child size of right neighbor (%d != %d - %d)",
- B_FREE_SPACE(p_s_bh), MAX_CHILD_SIZE(p_s_bh),
+ B_FREE_SPACE(bh), MAX_CHILD_SIZE(bh),
dc_size(B_N_CHILD(p_s_tb->FR[0], n_child_position)));
}
@@ -2090,51 +2090,45 @@ static int get_mem_for_virtual_node(struct tree_balance *tb)
#ifdef CONFIG_REISERFS_CHECK
static void tb_buffer_sanity_check(struct super_block *sb,
- struct buffer_head *p_s_bh,
+ struct buffer_head *bh,
const char *descr, int level)
{
- if (p_s_bh) {
- if (atomic_read(&(p_s_bh->b_count)) <= 0) {
+ if (bh) {
+ if (atomic_read(&(bh->b_count)) <= 0)
reiserfs_panic(sb, "jmacd-1", "negative or zero "
"reference counter for buffer %s[%d] "
- "(%b)", descr, level, p_s_bh);
- }
+ "(%b)", descr, level, bh);
- if (!buffer_uptodate(p_s_bh)) {
+ if (!buffer_uptodate(bh))
reiserfs_panic(sb, "jmacd-2", "buffer is not up "
"to date %s[%d] (%b)",
- descr, level, p_s_bh);
- }
+ descr, level, bh);
- if (!B_IS_IN_TREE(p_s_bh)) {
+ if (!B_IS_IN_TREE(bh))
reiserfs_panic(sb, "jmacd-3", "buffer is not "
"in tree %s[%d] (%b)",
- descr, level, p_s_bh);
- }
+ descr, level, bh);
- if (p_s_bh->b_bdev != sb->s_bdev) {
+ if (bh->b_bdev != sb->s_bdev)
reiserfs_panic(sb, "jmacd-4", "buffer has wrong "
"device %s[%d] (%b)",
- descr, level, p_s_bh);
- }
+ descr, level, bh);
- if (p_s_bh->b_size != sb->s_blocksize) {
+ if (bh->b_size != sb->s_blocksize)
reiserfs_panic(sb, "jmacd-5", "buffer has wrong "
"blocksize %s[%d] (%b)",
- descr, level, p_s_bh);
- }
+ descr, level, bh);
- if (p_s_bh->b_blocknr > SB_BLOCK_COUNT(sb)) {
+ if (bh->b_blocknr > SB_BLOCK_COUNT(sb))
reiserfs_panic(sb, "jmacd-6", "buffer block "
"number too high %s[%d] (%b)",
- descr, level, p_s_bh);
- }
+ descr, level, bh);
}
}
#else
static void tb_buffer_sanity_check(struct super_block *sb,
- struct buffer_head *p_s_bh,
+ struct buffer_head *bh,
const char *descr, int level)
{;
}
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 00fd879c4a2..eb6856f6d32 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -56,13 +56,13 @@
#include <linux/quotaops.h>
/* Does the buffer contain a disk block which is in the tree. */
-inline int B_IS_IN_TREE(const struct buffer_head *p_s_bh)
+inline int B_IS_IN_TREE(const struct buffer_head *bh)
{
- RFALSE(B_LEVEL(p_s_bh) > MAX_HEIGHT,
- "PAP-1010: block (%b) has too big level (%z)", p_s_bh, p_s_bh);
+ RFALSE(B_LEVEL(bh) > MAX_HEIGHT,
+ "PAP-1010: block (%b) has too big level (%z)", bh, bh);
- return (B_LEVEL(p_s_bh) != FREE_LEVEL);
+ return (B_LEVEL(bh) != FREE_LEVEL);
}
//
@@ -579,7 +579,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
{
b_blocknr_t n_block_number;
int expected_level;
- struct buffer_head *p_s_bh;
+ struct buffer_head *bh;
struct path_element *p_s_last_element;
int n_node_level, n_retval;
int right_neighbor_of_leaf_node;
@@ -626,15 +626,14 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
/* Read the next tree node, and set the last element in the path to
have a pointer to it. */
- if ((p_s_bh = p_s_last_element->pe_buffer =
+ if ((bh = p_s_last_element->pe_buffer =
sb_getblk(sb, n_block_number))) {
- if (!buffer_uptodate(p_s_bh) && reada_count > 1) {
+ if (!buffer_uptodate(bh) && reada_count > 1)
search_by_key_reada(sb, reada_bh,
reada_blocks, reada_count);
- }
- ll_rw_block(READ, 1, &p_s_bh);
- wait_on_buffer(p_s_bh);
- if (!buffer_uptodate(p_s_bh))
+ ll_rw_block(READ, 1, &bh);
+ wait_on_buffer(bh);
+ if (!buffer_uptodate(bh))
goto io_error;
} else {
io_error:
@@ -651,8 +650,8 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
to search is still in the tree rooted from the current buffer. If
not then repeat search from the root. */
if (fs_changed(fs_gen, sb) &&
- (!B_IS_IN_TREE(p_s_bh) ||
- B_LEVEL(p_s_bh) != expected_level ||
+ (!B_IS_IN_TREE(bh) ||
+ B_LEVEL(bh) != expected_level ||
!key_in_buffer(p_s_search_path, p_s_key, sb))) {
PROC_INFO_INC(sb, search_by_key_fs_changed);
PROC_INFO_INC(sb, search_by_key_restarted);
@@ -686,25 +685,25 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
// make sure, that the node contents look like a node of
// certain level
- if (!is_tree_node(p_s_bh, expected_level)) {
+ if (!is_tree_node(bh, expected_level)) {
reiserfs_error(sb, "vs-5150",
"invalid format found in block %ld. "
- "Fsck?", p_s_bh->b_blocknr);
+ "Fsck?", bh->b_blocknr);
pathrelse(p_s_search_path);
return IO_ERROR;
}
/* ok, we have acquired next formatted node in the tree */
- n_node_level = B_LEVEL(p_s_bh);
+ n_node_level = B_LEVEL(bh);
- PROC_INFO_BH_STAT(sb, p_s_bh, n_node_level - 1);
+ PROC_INFO_BH_STAT(sb, bh, n_node_level - 1);
RFALSE(n_node_level < n_stop_level,
"vs-5152: tree level (%d) is less than stop level (%d)",
n_node_level, n_stop_level);
- n_retval = bin_search(p_s_key, B_N_PITEM_HEAD(p_s_bh, 0),
- B_NR_ITEMS(p_s_bh),
+ n_retval = bin_search(p_s_key, B_N_PITEM_HEAD(bh, 0),
+ B_NR_ITEMS(bh),
(n_node_level ==
DISK_LEAF_NODE_LEVEL) ? IH_SIZE :
KEY_SIZE,
@@ -726,13 +725,13 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
an internal node. Now we calculate child block number by
position in the node. */
n_block_number =
- B_N_CHILD_NUM(p_s_bh, p_s_last_element->pe_position);
+ B_N_CHILD_NUM(bh, p_s_last_element->pe_position);
/* if we are going to read leaf nodes, try for read ahead as well */
if ((p_s_search_path->reada & PATH_READA) &&
n_node_level == DISK_LEAF_NODE_LEVEL + 1) {
int pos = p_s_last_element->pe_position;
- int limit = B_NR_ITEMS(p_s_bh);
+ int limit = B_NR_ITEMS(bh);
struct reiserfs_key *le_key;
if (p_s_search_path->reada & PATH_READA_BACK)
@@ -741,7 +740,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
if (pos == limit)
break;
reada_blocks[reada_count++] =
- B_N_CHILD_NUM(p_s_bh, pos);
+ B_N_CHILD_NUM(bh, pos);
if (p_s_search_path->reada & PATH_READA_BACK)
pos--;
else
@@ -750,7 +749,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
/*
* check to make sure we're in the same object
*/
- le_key = B_N_PDELIM_KEY(p_s_bh, pos);
+ le_key = B_N_PDELIM_KEY(bh, pos);
if (le32_to_cpu(le_key->k_objectid) !=
p_s_key->on_disk_key.k_objectid) {
break;
@@ -851,15 +850,15 @@ int search_for_position_by_key(struct super_block *sb, /* Pointer to the super b
/* Compare given item and item pointed to by the path. */
int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path)
{
- struct buffer_head *p_s_bh;
+ struct buffer_head *bh = PATH_PLAST_BUFFER(p_s_path);
struct item_head *ih;
/* Last buffer at the path is not in the tree. */
- if (!B_IS_IN_TREE(p_s_bh = PATH_PLAST_BUFFER(p_s_path)))
+ if (!B_IS_IN_TREE(bh))
return 1;
/* Last path position is invalid. */
- if (PATH_LAST_POSITION(p_s_path) >= B_NR_ITEMS(p_s_bh))
+ if (PATH_LAST_POSITION(p_s_path) >= B_NR_ITEMS(bh))
return 1;
/* we need only to know, whether it is the same item */
@@ -959,7 +958,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
{
struct super_block *sb = inode->i_sb;
struct item_head *p_le_ih = PATH_PITEM_HEAD(p_s_path);
- struct buffer_head *p_s_bh = PATH_PLAST_BUFFER(p_s_path);
+ struct buffer_head *bh = PATH_PLAST_BUFFER(p_s_path);
BUG_ON(!th->t_trans_id);
@@ -1003,7 +1002,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
do {
need_re_search = 0;
*p_n_cut_size = 0;
- p_s_bh = PATH_PLAST_BUFFER(p_s_path);
+ bh = PATH_PLAST_BUFFER(p_s_path);
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
pos = I_UNFM_NUM(&s_ih);
@@ -1019,13 +1018,13 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
break;
}
- unfm = (__le32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1;
+ unfm = (__le32 *)B_I_PITEM(bh, &s_ih) + pos - 1;
block = get_block_num(unfm, 0);
if (block != 0) {
- reiserfs_prepare_for_journal(sb, p_s_bh, 1);
+ reiserfs_prepare_for_journal(sb, bh, 1);
put_block_num(unfm, 0, 0);
- journal_mark_dirty (th, sb, p_s_bh);
+ journal_mark_dirty(th, sb, bh);
reiserfs_free_block(th, inode, block, 1);
}
@@ -1049,7 +1048,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
/* a trick. If the buffer has been logged, this will do nothing. If
** we've broken the loop without logging it, it will restore the
** buffer */
- reiserfs_restore_prepared_buffer(sb, p_s_bh);
+ reiserfs_restore_prepared_buffer(sb, bh);
} while (need_re_search &&
search_for_position_by_key(sb, p_s_item_key, p_s_path) == POSITION_FOUND);
pos_in_item(p_s_path) = pos * UNFM_P_SIZE;