aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:16:39 -0400
commitad31a4fc0386e8590c51ca4b8f1ae1d8b8b2ac5e (patch)
tree636010f3ba98e15245f04ade1a74a730e40abf57
parenta9dd364358fbdc68faee5d20c2d648c320dc3cf0 (diff)
reiserfs: rename p_s_bh to bh
This patch is a simple s/p_s_bh/bh/g to the reiserfs code. This is the second 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>
-rw-r--r--fs/reiserfs/fix_node.c94
-rw-r--r--fs/reiserfs/stree.c63
-rw-r--r--include/linux/reiserfs_fs.h35
3 files changed, 93 insertions, 99 deletions
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c
index 799c0ce24291..ad42c45af44f 100644
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -1887,7 +1887,7 @@ static int check_balance(int mode,
1887/* Check whether parent at the path is the really parent of the current node.*/ 1887/* Check whether parent at the path is the really parent of the current node.*/
1888static int get_direct_parent(struct tree_balance *p_s_tb, int n_h) 1888static int get_direct_parent(struct tree_balance *p_s_tb, int n_h)
1889{ 1889{
1890 struct buffer_head *p_s_bh; 1890 struct buffer_head *bh;
1891 struct treepath *p_s_path = p_s_tb->tb_path; 1891 struct treepath *p_s_path = p_s_tb->tb_path;
1892 int n_position, 1892 int n_position,
1893 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h); 1893 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)
1909 } 1909 }
1910 1910
1911 if (!B_IS_IN_TREE 1911 if (!B_IS_IN_TREE
1912 (p_s_bh = PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1))) 1912 (bh = PATH_OFFSET_PBUFFER(p_s_path, n_path_offset - 1)))
1913 return REPEAT_SEARCH; /* Parent in the path is not in the tree. */ 1913 return REPEAT_SEARCH; /* Parent in the path is not in the tree. */
1914 1914
1915 if ((n_position = 1915 if ((n_position =
1916 PATH_OFFSET_POSITION(p_s_path, 1916 PATH_OFFSET_POSITION(p_s_path,
1917 n_path_offset - 1)) > B_NR_ITEMS(p_s_bh)) 1917 n_path_offset - 1)) > B_NR_ITEMS(bh))
1918 return REPEAT_SEARCH; 1918 return REPEAT_SEARCH;
1919 1919
1920 if (B_N_CHILD_NUM(p_s_bh, n_position) != 1920 if (B_N_CHILD_NUM(bh, n_position) !=
1921 PATH_OFFSET_PBUFFER(p_s_path, n_path_offset)->b_blocknr) 1921 PATH_OFFSET_PBUFFER(p_s_path, n_path_offset)->b_blocknr)
1922 /* Parent in the path is not parent of the current node in the tree. */ 1922 /* Parent in the path is not parent of the current node in the tree. */
1923 return REPEAT_SEARCH; 1923 return REPEAT_SEARCH;
1924 1924
1925 if (buffer_locked(p_s_bh)) { 1925 if (buffer_locked(bh)) {
1926 __wait_on_buffer(p_s_bh); 1926 __wait_on_buffer(bh);
1927 if (FILESYSTEM_CHANGED_TB(p_s_tb)) 1927 if (FILESYSTEM_CHANGED_TB(p_s_tb))
1928 return REPEAT_SEARCH; 1928 return REPEAT_SEARCH;
1929 } 1929 }
@@ -1943,29 +1943,29 @@ static int get_neighbors(struct tree_balance *p_s_tb, int n_h)
1943 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h + 1); 1943 n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h + 1);
1944 unsigned long n_son_number; 1944 unsigned long n_son_number;
1945 struct super_block *sb = p_s_tb->tb_sb; 1945 struct super_block *sb = p_s_tb->tb_sb;
1946 struct buffer_head *p_s_bh; 1946 struct buffer_head *bh;
1947 1947
1948 PROC_INFO_INC(sb, get_neighbors[n_h]); 1948 PROC_INFO_INC(sb, get_neighbors[n_h]);
1949 1949
1950 if (p_s_tb->lnum[n_h]) { 1950 if (p_s_tb->lnum[n_h]) {
1951 /* We need left neighbor to balance S[n_h]. */ 1951 /* We need left neighbor to balance S[n_h]. */
1952 PROC_INFO_INC(sb, need_l_neighbor[n_h]); 1952 PROC_INFO_INC(sb, need_l_neighbor[n_h]);
1953 p_s_bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset); 1953 bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset);
1954 1954
1955 RFALSE(p_s_bh == p_s_tb->FL[n_h] && 1955 RFALSE(bh == p_s_tb->FL[n_h] &&
1956 !PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset), 1956 !PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset),
1957 "PAP-8270: invalid position in the parent"); 1957 "PAP-8270: invalid position in the parent");
1958 1958
1959 n_child_position = 1959 n_child_position =
1960 (p_s_bh == 1960 (bh ==
1961 p_s_tb->FL[n_h]) ? p_s_tb->lkey[n_h] : B_NR_ITEMS(p_s_tb-> 1961 p_s_tb->FL[n_h]) ? p_s_tb->lkey[n_h] : B_NR_ITEMS(p_s_tb->
1962 FL[n_h]); 1962 FL[n_h]);
1963 n_son_number = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position); 1963 n_son_number = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position);
1964 p_s_bh = sb_bread(sb, n_son_number); 1964 bh = sb_bread(sb, n_son_number);
1965 if (!p_s_bh) 1965 if (!bh)
1966 return IO_ERROR; 1966 return IO_ERROR;
1967 if (FILESYSTEM_CHANGED_TB(p_s_tb)) { 1967 if (FILESYSTEM_CHANGED_TB(p_s_tb)) {
1968 brelse(p_s_bh); 1968 brelse(bh);
1969 PROC_INFO_INC(sb, get_neighbors_restart[n_h]); 1969 PROC_INFO_INC(sb, get_neighbors_restart[n_h]);
1970 return REPEAT_SEARCH; 1970 return REPEAT_SEARCH;
1971 } 1971 }
@@ -1973,48 +1973,48 @@ static int get_neighbors(struct tree_balance *p_s_tb, int n_h)
1973 RFALSE(!B_IS_IN_TREE(p_s_tb->FL[n_h]) || 1973 RFALSE(!B_IS_IN_TREE(p_s_tb->FL[n_h]) ||
1974 n_child_position > B_NR_ITEMS(p_s_tb->FL[n_h]) || 1974 n_child_position > B_NR_ITEMS(p_s_tb->FL[n_h]) ||
1975 B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position) != 1975 B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position) !=
1976 p_s_bh->b_blocknr, "PAP-8275: invalid parent"); 1976 bh->b_blocknr, "PAP-8275: invalid parent");
1977 RFALSE(!B_IS_IN_TREE(p_s_bh), "PAP-8280: invalid child"); 1977 RFALSE(!B_IS_IN_TREE(bh), "PAP-8280: invalid child");
1978 RFALSE(!n_h && 1978 RFALSE(!n_h &&
1979 B_FREE_SPACE(p_s_bh) != 1979 B_FREE_SPACE(bh) !=
1980 MAX_CHILD_SIZE(p_s_bh) - 1980 MAX_CHILD_SIZE(bh) -
1981 dc_size(B_N_CHILD(p_s_tb->FL[0], n_child_position)), 1981 dc_size(B_N_CHILD(p_s_tb->FL[0], n_child_position)),
1982 "PAP-8290: invalid child size of left neighbor"); 1982 "PAP-8290: invalid child size of left neighbor");
1983 1983
1984 brelse(p_s_tb->L[n_h]); 1984 brelse(p_s_tb->L[n_h]);
1985 p_s_tb->L[n_h] = p_s_bh; 1985 p_s_tb->L[n_h] = bh;
1986 } 1986 }
1987 1987
1988 if (p_s_tb->rnum[n_h]) { /* We need right neighbor to balance S[n_path_offset]. */ 1988 if (p_s_tb->rnum[n_h]) { /* We need right neighbor to balance S[n_path_offset]. */
1989 PROC_INFO_INC(sb, need_r_neighbor[n_h]); 1989 PROC_INFO_INC(sb, need_r_neighbor[n_h]);
1990 p_s_bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset); 1990 bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset);
1991 1991
1992 RFALSE(p_s_bh == p_s_tb->FR[n_h] && 1992 RFALSE(bh == p_s_tb->FR[n_h] &&
1993 PATH_OFFSET_POSITION(p_s_tb->tb_path, 1993 PATH_OFFSET_POSITION(p_s_tb->tb_path,
1994 n_path_offset) >= 1994 n_path_offset) >=
1995 B_NR_ITEMS(p_s_bh), 1995 B_NR_ITEMS(bh),
1996 "PAP-8295: invalid position in the parent"); 1996 "PAP-8295: invalid position in the parent");
1997 1997
1998 n_child_position = 1998 n_child_position =
1999 (p_s_bh == p_s_tb->FR[n_h]) ? p_s_tb->rkey[n_h] + 1 : 0; 1999 (bh == p_s_tb->FR[n_h]) ? p_s_tb->rkey[n_h] + 1 : 0;
2000 n_son_number = B_N_CHILD_NUM(p_s_tb->FR[n_h], n_child_position); 2000 n_son_number = B_N_CHILD_NUM(p_s_tb->FR[n_h], n_child_position);
2001 p_s_bh = sb_bread(sb, n_son_number); 2001 bh = sb_bread(sb, n_son_number);
2002 if (!p_s_bh) 2002 if (!bh)
2003 return IO_ERROR; 2003 return IO_ERROR;
2004 if (FILESYSTEM_CHANGED_TB(p_s_tb)) { 2004 if (FILESYSTEM_CHANGED_TB(p_s_tb)) {
2005 brelse(p_s_bh); 2005 brelse(bh);
2006 PROC_INFO_INC(sb, get_neighbors_restart[n_h]); 2006 PROC_INFO_INC(sb, get_neighbors_restart[n_h]);
2007 return REPEAT_SEARCH; 2007 return REPEAT_SEARCH;
2008 } 2008 }
2009 brelse(p_s_tb->R[n_h]); 2009 brelse(p_s_tb->R[n_h]);
2010 p_s_tb->R[n_h] = p_s_bh; 2010 p_s_tb->R[n_h] = bh;
2011 2011
2012 RFALSE(!n_h 2012 RFALSE(!n_h
2013 && B_FREE_SPACE(p_s_bh) != 2013 && B_FREE_SPACE(bh) !=
2014 MAX_CHILD_SIZE(p_s_bh) - 2014 MAX_CHILD_SIZE(bh) -
2015 dc_size(B_N_CHILD(p_s_tb->FR[0], n_child_position)), 2015 dc_size(B_N_CHILD(p_s_tb->FR[0], n_child_position)),
2016 "PAP-8300: invalid child size of right neighbor (%d != %d - %d)", 2016 "PAP-8300: invalid child size of right neighbor (%d != %d - %d)",
2017 B_FREE_SPACE(p_s_bh), MAX_CHILD_SIZE(p_s_bh), 2017 B_FREE_SPACE(bh), MAX_CHILD_SIZE(bh),
2018 dc_size(B_N_CHILD(p_s_tb->FR[0], n_child_position))); 2018 dc_size(B_N_CHILD(p_s_tb->FR[0], n_child_position)));
2019 2019
2020 } 2020 }
@@ -2090,51 +2090,45 @@ static int get_mem_for_virtual_node(struct tree_balance *tb)
2090 2090
2091#ifdef CONFIG_REISERFS_CHECK 2091#ifdef CONFIG_REISERFS_CHECK
2092static void tb_buffer_sanity_check(struct super_block *sb, 2092static void tb_buffer_sanity_check(struct super_block *sb,
2093 struct buffer_head *p_s_bh, 2093 struct buffer_head *bh,
2094 const char *descr, int level) 2094 const char *descr, int level)
2095{ 2095{
2096 if (p_s_bh) { 2096 if (bh) {
2097 if (atomic_read(&(p_s_bh->b_count)) <= 0) { 2097 if (atomic_read(&(bh->b_count)) <= 0)
2098 2098
2099 reiserfs_panic(sb, "jmacd-1", "negative or zero " 2099 reiserfs_panic(sb, "jmacd-1", "negative or zero "
2100 "reference counter for buffer %s[%d] " 2100 "reference counter for buffer %s[%d] "
2101 "(%b)", descr, level, p_s_bh); 2101 "(%b)", descr, level, bh);
2102 }
2103 2102
2104 if (!buffer_uptodate(p_s_bh)) { 2103 if (!buffer_uptodate(bh))
2105 reiserfs_panic(sb, "jmacd-2", "buffer is not up " 2104 reiserfs_panic(sb, "jmacd-2", "buffer is not up "
2106 "to date %s[%d] (%b)", 2105 "to date %s[%d] (%b)",
2107 descr, level, p_s_bh); 2106 descr, level, bh);
2108 }
2109 2107
2110 if (!B_IS_IN_TREE(p_s_bh)) { 2108 if (!B_IS_IN_TREE(bh))
2111 reiserfs_panic(sb, "jmacd-3", "buffer is not " 2109 reiserfs_panic(sb, "jmacd-3", "buffer is not "
2112 "in tree %s[%d] (%b)", 2110 "in tree %s[%d] (%b)",
2113 descr, level, p_s_bh); 2111 descr, level, bh);
2114 }
2115 2112
2116 if (p_s_bh->b_bdev != sb->s_bdev) { 2113 if (bh->b_bdev != sb->s_bdev)
2117 reiserfs_panic(sb, "jmacd-4", "buffer has wrong " 2114 reiserfs_panic(sb, "jmacd-4", "buffer has wrong "
2118 "device %s[%d] (%b)", 2115 "device %s[%d] (%b)",
2119 descr, level, p_s_bh); 2116 descr, level, bh);
2120 }
2121 2117
2122 if (p_s_bh->b_size != sb->s_blocksize) { 2118 if (bh->b_size != sb->s_blocksize)
2123 reiserfs_panic(sb, "jmacd-5", "buffer has wrong " 2119 reiserfs_panic(sb, "jmacd-5", "buffer has wrong "
2124 "blocksize %s[%d] (%b)", 2120 "blocksize %s[%d] (%b)",
2125 descr, level, p_s_bh); 2121 descr, level, bh);
2126 }
2127 2122
2128 if (p_s_bh->b_blocknr > SB_BLOCK_COUNT(sb)) { 2123 if (bh->b_blocknr > SB_BLOCK_COUNT(sb))
2129 reiserfs_panic(sb, "jmacd-6", "buffer block " 2124 reiserfs_panic(sb, "jmacd-6", "buffer block "
2130 "number too high %s[%d] (%b)", 2125 "number too high %s[%d] (%b)",
2131 descr, level, p_s_bh); 2126 descr, level, bh);
2132 }
2133 } 2127 }
2134} 2128}
2135#else 2129#else
2136static void tb_buffer_sanity_check(struct super_block *sb, 2130static void tb_buffer_sanity_check(struct super_block *sb,
2137 struct buffer_head *p_s_bh, 2131 struct buffer_head *bh,
2138 const char *descr, int level) 2132 const char *descr, int level)
2139{; 2133{;
2140} 2134}
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 00fd879c4a2a..eb6856f6d323 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -56,13 +56,13 @@
56#include <linux/quotaops.h> 56#include <linux/quotaops.h>
57 57
58/* Does the buffer contain a disk block which is in the tree. */ 58/* Does the buffer contain a disk block which is in the tree. */
59inline int B_IS_IN_TREE(const struct buffer_head *p_s_bh) 59inline int B_IS_IN_TREE(const struct buffer_head *bh)
60{ 60{
61 61
62 RFALSE(B_LEVEL(p_s_bh) > MAX_HEIGHT, 62 RFALSE(B_LEVEL(bh) > MAX_HEIGHT,
63 "PAP-1010: block (%b) has too big level (%z)", p_s_bh, p_s_bh); 63 "PAP-1010: block (%b) has too big level (%z)", bh, bh);
64 64
65 return (B_LEVEL(p_s_bh) != FREE_LEVEL); 65 return (B_LEVEL(bh) != FREE_LEVEL);
66} 66}
67 67
68// 68//
@@ -579,7 +579,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
579{ 579{
580 b_blocknr_t n_block_number; 580 b_blocknr_t n_block_number;
581 int expected_level; 581 int expected_level;
582 struct buffer_head *p_s_bh; 582 struct buffer_head *bh;
583 struct path_element *p_s_last_element; 583 struct path_element *p_s_last_element;
584 int n_node_level, n_retval; 584 int n_node_level, n_retval;
585 int right_neighbor_of_leaf_node; 585 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
626 626
627 /* Read the next tree node, and set the last element in the path to 627 /* Read the next tree node, and set the last element in the path to
628 have a pointer to it. */ 628 have a pointer to it. */
629 if ((p_s_bh = p_s_last_element->pe_buffer = 629 if ((bh = p_s_last_element->pe_buffer =
630 sb_getblk(sb, n_block_number))) { 630 sb_getblk(sb, n_block_number))) {
631 if (!buffer_uptodate(p_s_bh) && reada_count > 1) { 631 if (!buffer_uptodate(bh) && reada_count > 1)
632 search_by_key_reada(sb, reada_bh, 632 search_by_key_reada(sb, reada_bh,
633 reada_blocks, reada_count); 633 reada_blocks, reada_count);
634 } 634 ll_rw_block(READ, 1, &bh);
635 ll_rw_block(READ, 1, &p_s_bh); 635 wait_on_buffer(bh);
636 wait_on_buffer(p_s_bh); 636 if (!buffer_uptodate(bh))
637 if (!buffer_uptodate(p_s_bh))
638 goto io_error; 637 goto io_error;
639 } else { 638 } else {
640 io_error: 639 io_error:
@@ -651,8 +650,8 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
651 to search is still in the tree rooted from the current buffer. If 650 to search is still in the tree rooted from the current buffer. If
652 not then repeat search from the root. */ 651 not then repeat search from the root. */
653 if (fs_changed(fs_gen, sb) && 652 if (fs_changed(fs_gen, sb) &&
654 (!B_IS_IN_TREE(p_s_bh) || 653 (!B_IS_IN_TREE(bh) ||
655 B_LEVEL(p_s_bh) != expected_level || 654 B_LEVEL(bh) != expected_level ||
656 !key_in_buffer(p_s_search_path, p_s_key, sb))) { 655 !key_in_buffer(p_s_search_path, p_s_key, sb))) {
657 PROC_INFO_INC(sb, search_by_key_fs_changed); 656 PROC_INFO_INC(sb, search_by_key_fs_changed);
658 PROC_INFO_INC(sb, search_by_key_restarted); 657 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
686 685
687 // make sure, that the node contents look like a node of 686 // make sure, that the node contents look like a node of
688 // certain level 687 // certain level
689 if (!is_tree_node(p_s_bh, expected_level)) { 688 if (!is_tree_node(bh, expected_level)) {
690 reiserfs_error(sb, "vs-5150", 689 reiserfs_error(sb, "vs-5150",
691 "invalid format found in block %ld. " 690 "invalid format found in block %ld. "
692 "Fsck?", p_s_bh->b_blocknr); 691 "Fsck?", bh->b_blocknr);
693 pathrelse(p_s_search_path); 692 pathrelse(p_s_search_path);
694 return IO_ERROR; 693 return IO_ERROR;
695 } 694 }
696 695
697 /* ok, we have acquired next formatted node in the tree */ 696 /* ok, we have acquired next formatted node in the tree */
698 n_node_level = B_LEVEL(p_s_bh); 697 n_node_level = B_LEVEL(bh);
699 698
700 PROC_INFO_BH_STAT(sb, p_s_bh, n_node_level - 1); 699 PROC_INFO_BH_STAT(sb, bh, n_node_level - 1);
701 700
702 RFALSE(n_node_level < n_stop_level, 701 RFALSE(n_node_level < n_stop_level,
703 "vs-5152: tree level (%d) is less than stop level (%d)", 702 "vs-5152: tree level (%d) is less than stop level (%d)",
704 n_node_level, n_stop_level); 703 n_node_level, n_stop_level);
705 704
706 n_retval = bin_search(p_s_key, B_N_PITEM_HEAD(p_s_bh, 0), 705 n_retval = bin_search(p_s_key, B_N_PITEM_HEAD(bh, 0),
707 B_NR_ITEMS(p_s_bh), 706 B_NR_ITEMS(bh),
708 (n_node_level == 707 (n_node_level ==
709 DISK_LEAF_NODE_LEVEL) ? IH_SIZE : 708 DISK_LEAF_NODE_LEVEL) ? IH_SIZE :
710 KEY_SIZE, 709 KEY_SIZE,
@@ -726,13 +725,13 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
726 an internal node. Now we calculate child block number by 725 an internal node. Now we calculate child block number by
727 position in the node. */ 726 position in the node. */
728 n_block_number = 727 n_block_number =
729 B_N_CHILD_NUM(p_s_bh, p_s_last_element->pe_position); 728 B_N_CHILD_NUM(bh, p_s_last_element->pe_position);
730 729
731 /* if we are going to read leaf nodes, try for read ahead as well */ 730 /* if we are going to read leaf nodes, try for read ahead as well */
732 if ((p_s_search_path->reada & PATH_READA) && 731 if ((p_s_search_path->reada & PATH_READA) &&
733 n_node_level == DISK_LEAF_NODE_LEVEL + 1) { 732 n_node_level == DISK_LEAF_NODE_LEVEL + 1) {
734 int pos = p_s_last_element->pe_position; 733 int pos = p_s_last_element->pe_position;
735 int limit = B_NR_ITEMS(p_s_bh); 734 int limit = B_NR_ITEMS(bh);
736 struct reiserfs_key *le_key; 735 struct reiserfs_key *le_key;
737 736
738 if (p_s_search_path->reada & PATH_READA_BACK) 737 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
741 if (pos == limit) 740 if (pos == limit)
742 break; 741 break;
743 reada_blocks[reada_count++] = 742 reada_blocks[reada_count++] =
744 B_N_CHILD_NUM(p_s_bh, pos); 743 B_N_CHILD_NUM(bh, pos);
745 if (p_s_search_path->reada & PATH_READA_BACK) 744 if (p_s_search_path->reada & PATH_READA_BACK)
746 pos--; 745 pos--;
747 else 746 else
@@ -750,7 +749,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *p_s_key, /* Key
750 /* 749 /*
751 * check to make sure we're in the same object 750 * check to make sure we're in the same object
752 */ 751 */
753 le_key = B_N_PDELIM_KEY(p_s_bh, pos); 752 le_key = B_N_PDELIM_KEY(bh, pos);
754 if (le32_to_cpu(le_key->k_objectid) != 753 if (le32_to_cpu(le_key->k_objectid) !=
755 p_s_key->on_disk_key.k_objectid) { 754 p_s_key->on_disk_key.k_objectid) {
756 break; 755 break;
@@ -851,15 +850,15 @@ int search_for_position_by_key(struct super_block *sb, /* Pointer to the super b
851/* Compare given item and item pointed to by the path. */ 850/* Compare given item and item pointed to by the path. */
852int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path) 851int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path)
853{ 852{
854 struct buffer_head *p_s_bh; 853 struct buffer_head *bh = PATH_PLAST_BUFFER(p_s_path);
855 struct item_head *ih; 854 struct item_head *ih;
856 855
857 /* Last buffer at the path is not in the tree. */ 856 /* Last buffer at the path is not in the tree. */
858 if (!B_IS_IN_TREE(p_s_bh = PATH_PLAST_BUFFER(p_s_path))) 857 if (!B_IS_IN_TREE(bh))
859 return 1; 858 return 1;
860 859
861 /* Last path position is invalid. */ 860 /* Last path position is invalid. */
862 if (PATH_LAST_POSITION(p_s_path) >= B_NR_ITEMS(p_s_bh)) 861 if (PATH_LAST_POSITION(p_s_path) >= B_NR_ITEMS(bh))
863 return 1; 862 return 1;
864 863
865 /* we need only to know, whether it is the same item */ 864 /* 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
959{ 958{
960 struct super_block *sb = inode->i_sb; 959 struct super_block *sb = inode->i_sb;
961 struct item_head *p_le_ih = PATH_PITEM_HEAD(p_s_path); 960 struct item_head *p_le_ih = PATH_PITEM_HEAD(p_s_path);
962 struct buffer_head *p_s_bh = PATH_PLAST_BUFFER(p_s_path); 961 struct buffer_head *bh = PATH_PLAST_BUFFER(p_s_path);
963 962
964 BUG_ON(!th->t_trans_id); 963 BUG_ON(!th->t_trans_id);
965 964
@@ -1003,7 +1002,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
1003 do { 1002 do {
1004 need_re_search = 0; 1003 need_re_search = 0;
1005 *p_n_cut_size = 0; 1004 *p_n_cut_size = 0;
1006 p_s_bh = PATH_PLAST_BUFFER(p_s_path); 1005 bh = PATH_PLAST_BUFFER(p_s_path);
1007 copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); 1006 copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
1008 pos = I_UNFM_NUM(&s_ih); 1007 pos = I_UNFM_NUM(&s_ih);
1009 1008
@@ -1019,13 +1018,13 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
1019 break; 1018 break;
1020 } 1019 }
1021 1020
1022 unfm = (__le32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1; 1021 unfm = (__le32 *)B_I_PITEM(bh, &s_ih) + pos - 1;
1023 block = get_block_num(unfm, 0); 1022 block = get_block_num(unfm, 0);
1024 1023
1025 if (block != 0) { 1024 if (block != 0) {
1026 reiserfs_prepare_for_journal(sb, p_s_bh, 1); 1025 reiserfs_prepare_for_journal(sb, bh, 1);
1027 put_block_num(unfm, 0, 0); 1026 put_block_num(unfm, 0, 0);
1028 journal_mark_dirty (th, sb, p_s_bh); 1027 journal_mark_dirty(th, sb, bh);
1029 reiserfs_free_block(th, inode, block, 1); 1028 reiserfs_free_block(th, inode, block, 1);
1030 } 1029 }
1031 1030
@@ -1049,7 +1048,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
1049 /* a trick. If the buffer has been logged, this will do nothing. If 1048 /* a trick. If the buffer has been logged, this will do nothing. If
1050 ** we've broken the loop without logging it, it will restore the 1049 ** we've broken the loop without logging it, it will restore the
1051 ** buffer */ 1050 ** buffer */
1052 reiserfs_restore_prepared_buffer(sb, p_s_bh); 1051 reiserfs_restore_prepared_buffer(sb, bh);
1053 } while (need_re_search && 1052 } while (need_re_search &&
1054 search_for_position_by_key(sb, p_s_item_key, p_s_path) == POSITION_FOUND); 1053 search_for_position_by_key(sb, p_s_item_key, p_s_path) == POSITION_FOUND);
1055 pos_in_item(p_s_path) = pos * UNFM_P_SIZE; 1054 pos_in_item(p_s_path) = pos * UNFM_P_SIZE;
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 9bd7800d989c..9cfa518c90b6 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -751,25 +751,25 @@ struct block_head {
751#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ 751#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */
752 752
753/* Given the buffer head of a formatted node, resolve to the block head of that node. */ 753/* Given the buffer head of a formatted node, resolve to the block head of that node. */
754#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) 754#define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data))
755/* Number of items that are in buffer. */ 755/* Number of items that are in buffer. */
756#define B_NR_ITEMS(p_s_bh) (blkh_nr_item(B_BLK_HEAD(p_s_bh))) 756#define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh)))
757#define B_LEVEL(p_s_bh) (blkh_level(B_BLK_HEAD(p_s_bh))) 757#define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh)))
758#define B_FREE_SPACE(p_s_bh) (blkh_free_space(B_BLK_HEAD(p_s_bh))) 758#define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh)))
759 759
760#define PUT_B_NR_ITEMS(p_s_bh,val) do { set_blkh_nr_item(B_BLK_HEAD(p_s_bh),val); } while (0) 760#define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0)
761#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) 761#define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0)
762#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) 762#define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0)
763 763
764/* Get right delimiting key. -- little endian */ 764/* Get right delimiting key. -- little endian */
765#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)))) 765#define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh))))
766 766
767/* Does the buffer contain a disk leaf. */ 767/* Does the buffer contain a disk leaf. */
768#define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL) 768#define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL)
769 769
770/* Does the buffer contain a disk internal node */ 770/* Does the buffer contain a disk internal node */
771#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ 771#define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \
772 && B_LEVEL(p_s_bh) <= MAX_HEIGHT) 772 && B_LEVEL(bh) <= MAX_HEIGHT)
773 773
774/***************************************************************************/ 774/***************************************************************************/
775/* STAT DATA */ 775/* STAT DATA */
@@ -1119,12 +1119,13 @@ struct disk_child {
1119#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) 1119#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0)
1120 1120
1121/* Get disk child by buffer header and position in the tree node. */ 1121/* Get disk child by buffer header and position in the tree node. */
1122#define B_N_CHILD(p_s_bh,n_pos) ((struct disk_child *)\ 1122#define B_N_CHILD(bh, n_pos) ((struct disk_child *)\
1123((p_s_bh)->b_data+BLKH_SIZE+B_NR_ITEMS(p_s_bh)*KEY_SIZE+DC_SIZE*(n_pos))) 1123((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos)))
1124 1124
1125/* Get disk child number by buffer header and position in the tree node. */ 1125/* Get disk child number by buffer header and position in the tree node. */
1126#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) 1126#define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos)))
1127#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) 1127#define PUT_B_N_CHILD_NUM(bh, n_pos, val) \
1128 (put_dc_block_number(B_N_CHILD(bh, n_pos), val))
1128 1129
1129 /* maximal value of field child_size in structure disk_child */ 1130 /* maximal value of field child_size in structure disk_child */
1130 /* child size is the combined size of all items and their headers */ 1131 /* child size is the combined size of all items and their headers */
@@ -1837,7 +1838,7 @@ int search_by_key(struct super_block *, const struct cpu_key *,
1837int search_for_position_by_key(struct super_block *sb, 1838int search_for_position_by_key(struct super_block *sb,
1838 const struct cpu_key *p_s_cpu_key, 1839 const struct cpu_key *p_s_cpu_key,
1839 struct treepath *p_s_search_path); 1840 struct treepath *p_s_search_path);
1840extern void decrement_bcount(struct buffer_head *p_s_bh); 1841extern void decrement_bcount(struct buffer_head *bh);
1841void decrement_counters_in_path(struct treepath *p_s_search_path); 1842void decrement_counters_in_path(struct treepath *p_s_search_path);
1842void pathrelse(struct treepath *p_s_search_path); 1843void pathrelse(struct treepath *p_s_search_path);
1843int reiserfs_check_path(struct treepath *p); 1844int reiserfs_check_path(struct treepath *p);
@@ -1978,7 +1979,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1978#define PROC_INFO_MAX( sb, field, value ) VOID_V 1979#define PROC_INFO_MAX( sb, field, value ) VOID_V
1979#define PROC_INFO_INC( sb, field ) VOID_V 1980#define PROC_INFO_INC( sb, field ) VOID_V
1980#define PROC_INFO_ADD( sb, field, val ) VOID_V 1981#define PROC_INFO_ADD( sb, field, val ) VOID_V
1981#define PROC_INFO_BH_STAT(sb, p_s_bh, n_node_level) VOID_V 1982#define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V
1982#endif 1983#endif
1983 1984
1984/* dir.c */ 1985/* dir.c */