aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2007-02-10 02:37:33 -0500
committerTim Shimmin <tes@sgi.com>2007-02-10 02:37:33 -0500
commit2c36ddeda7f04c085d9a612cf8dab5f0a1cd5224 (patch)
tree2609264dd04c10d6c448ec0fafa2cc1c480ad980 /fs
parent7bc5306d74922d9b14f507e1164d8dd852a98ad3 (diff)
[XFS] Remove unused arguments from the XFS_BTREE_*_ADDR macros.
It makes it incrementally clearer to read the code when the top of a macro spaghetti-pile only receives the 3 arguments it uses, rather than 2 extra ones which are not used. Also when you start pulling this thread out of the sweater (i.e. remove unused args from XFS_BTREE_*_ADDR), a couple other third arms etc fall off too. If they're not used in the macro, then they sometimes don't need to be passed to the function calling the macro either, etc.... Patch provided by Eric Sandeen (sandeen@sandeen.net). SGI-PV: 960197 SGI-Modid: xfs-linux-melb:xfs-kern:28037a Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_alloc_btree.h10
-rw-r--r--fs/xfs/xfs_bmap.c35
-rw-r--r--fs/xfs/xfs_bmap_btree.c8
-rw-r--r--fs/xfs/xfs_bmap_btree.h46
-rw-r--r--fs/xfs/xfs_btree.h6
-rw-r--r--fs/xfs/xfs_fsops.c6
-rw-r--r--fs/xfs/xfs_ialloc_btree.h10
7 files changed, 39 insertions, 82 deletions
diff --git a/fs/xfs/xfs_alloc_btree.h b/fs/xfs/xfs_alloc_btree.h
index bce81c7a4fdc..5bd1a2c8bd07 100644
--- a/fs/xfs/xfs_alloc_btree.h
+++ b/fs/xfs/xfs_alloc_btree.h
@@ -58,7 +58,6 @@ typedef struct xfs_btree_sblock xfs_alloc_block_t;
58/* 58/*
59 * Real block structures have a size equal to the disk block size. 59 * Real block structures have a size equal to the disk block size.
60 */ 60 */
61#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
62#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_alloc_mxr[lev != 0]) 61#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_alloc_mxr[lev != 0])
63#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_alloc_mnr[lev != 0]) 62#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_alloc_mnr[lev != 0])
64 63
@@ -87,16 +86,13 @@ typedef struct xfs_btree_sblock xfs_alloc_block_t;
87 * Record, key, and pointer address macros for btree blocks. 86 * Record, key, and pointer address macros for btree blocks.
88 */ 87 */
89#define XFS_ALLOC_REC_ADDR(bb,i,cur) \ 88#define XFS_ALLOC_REC_ADDR(bb,i,cur) \
90 XFS_BTREE_REC_ADDR(XFS_ALLOC_BLOCK_SIZE(0,cur), xfs_alloc, \ 89 XFS_BTREE_REC_ADDR(xfs_alloc, bb, i)
91 bb, i, XFS_ALLOC_BLOCK_MAXRECS(0, cur))
92 90
93#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \ 91#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \
94 XFS_BTREE_KEY_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, \ 92 XFS_BTREE_KEY_ADDR(xfs_alloc, bb, i)
95 bb, i, XFS_ALLOC_BLOCK_MAXRECS(1, cur))
96 93
97#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \ 94#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \
98 XFS_BTREE_PTR_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, \ 95 XFS_BTREE_PTR_ADDR(xfs_alloc, bb, i, XFS_ALLOC_BLOCK_MAXRECS(1, cur))
99 bb, i, XFS_ALLOC_BLOCK_MAXRECS(1, cur))
100 96
101/* 97/*
102 * Decrement cursor by one record at the level. 98 * Decrement cursor by one record at the level.
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 20b6922e2729..27d36dc69ded 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -410,7 +410,6 @@ xfs_bmap_count_leaves(
410STATIC int 410STATIC int
411xfs_bmap_disk_count_leaves( 411xfs_bmap_disk_count_leaves(
412 xfs_ifork_t *ifp, 412 xfs_ifork_t *ifp,
413 xfs_mount_t *mp,
414 xfs_extnum_t idx, 413 xfs_extnum_t idx,
415 xfs_bmbt_block_t *block, 414 xfs_bmbt_block_t *block,
416 int numrecs, 415 int numrecs,
@@ -4533,8 +4532,7 @@ xfs_bmap_read_extents(
4533 error0); 4532 error0);
4534 if (level == 0) 4533 if (level == 0)
4535 break; 4534 break;
4536 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, 4535 pp = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, 1, mp->m_bmap_dmxr[1]);
4537 1, mp->m_bmap_dmxr[1]);
4538 bno = be64_to_cpu(*pp); 4536 bno = be64_to_cpu(*pp);
4539 XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0); 4537 XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0);
4540 xfs_trans_brelse(tp, bp); 4538 xfs_trans_brelse(tp, bp);
@@ -4577,8 +4575,7 @@ xfs_bmap_read_extents(
4577 /* 4575 /*
4578 * Copy records into the extent records. 4576 * Copy records into the extent records.
4579 */ 4577 */
4580 frp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, 4578 frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, 1);
4581 block, 1, mp->m_bmap_dmxr[0]);
4582 start = i; 4579 start = i;
4583 for (j = 0; j < num_recs; j++, i++, frp++) { 4580 for (j = 0; j < num_recs; j++, i++, frp++) {
4584 trp = xfs_iext_get_ext(ifp, i); 4581 trp = xfs_iext_get_ext(ifp, i);
@@ -6156,8 +6153,7 @@ xfs_check_block(
6156 if (root) { 6153 if (root) {
6157 keyp = XFS_BMAP_BROOT_KEY_ADDR(block, i, sz); 6154 keyp = XFS_BMAP_BROOT_KEY_ADDR(block, i, sz);
6158 } else { 6155 } else {
6159 keyp = XFS_BTREE_KEY_ADDR(mp->m_sb.sb_blocksize, 6156 keyp = XFS_BTREE_KEY_ADDR(xfs_bmbt, block, i);
6160 xfs_bmbt, block, i, dmxr);
6161 } 6157 }
6162 6158
6163 if (prevp) { 6159 if (prevp) {
@@ -6172,15 +6168,14 @@ xfs_check_block(
6172 if (root) { 6168 if (root) {
6173 pp = XFS_BMAP_BROOT_PTR_ADDR(block, i, sz); 6169 pp = XFS_BMAP_BROOT_PTR_ADDR(block, i, sz);
6174 } else { 6170 } else {
6175 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, 6171 pp = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, i, dmxr);
6176 xfs_bmbt, block, i, dmxr);
6177 } 6172 }
6178 for (j = i+1; j <= be16_to_cpu(block->bb_numrecs); j++) { 6173 for (j = i+1; j <= be16_to_cpu(block->bb_numrecs); j++) {
6179 if (root) { 6174 if (root) {
6180 thispa = XFS_BMAP_BROOT_PTR_ADDR(block, j, sz); 6175 thispa = XFS_BMAP_BROOT_PTR_ADDR(block, j, sz);
6181 } else { 6176 } else {
6182 thispa = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, 6177 thispa = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, j,
6183 xfs_bmbt, block, j, dmxr); 6178 dmxr);
6184 } 6179 }
6185 if (*thispa == *pp) { 6180 if (*thispa == *pp) {
6186 cmn_err(CE_WARN, "%s: thispa(%d) == pp(%d) %Ld", 6181 cmn_err(CE_WARN, "%s: thispa(%d) == pp(%d) %Ld",
@@ -6267,8 +6262,7 @@ xfs_bmap_check_leaf_extents(
6267 */ 6262 */
6268 6263
6269 xfs_check_block(block, mp, 0, 0); 6264 xfs_check_block(block, mp, 0, 0);
6270 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, 6265 pp = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, 1, mp->m_bmap_dmxr[1]);
6271 1, mp->m_bmap_dmxr[1]);
6272 bno = be64_to_cpu(*pp); 6266 bno = be64_to_cpu(*pp);
6273 XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0); 6267 XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0);
6274 if (bp_release) { 6268 if (bp_release) {
@@ -6305,11 +6299,9 @@ xfs_bmap_check_leaf_extents(
6305 * conform with the first entry in this one. 6299 * conform with the first entry in this one.
6306 */ 6300 */
6307 6301
6308 ep = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, 6302 ep = XFS_BTREE_REC_ADDR(xfs_bmbt, block, 1);
6309 block, 1, mp->m_bmap_dmxr[0]);
6310 for (j = 1; j < num_recs; j++) { 6303 for (j = 1; j < num_recs; j++) {
6311 nextp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, 6304 nextp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, j + 1);
6312 block, j + 1, mp->m_bmap_dmxr[0]);
6313 if (lastp) { 6305 if (lastp) {
6314 xfs_btree_check_rec(XFS_BTNUM_BMAP, 6306 xfs_btree_check_rec(XFS_BTNUM_BMAP,
6315 (void *)lastp, (void *)ep); 6307 (void *)lastp, (void *)ep);
@@ -6454,8 +6446,7 @@ xfs_bmap_count_tree(
6454 } 6446 }
6455 6447
6456 /* Dive to the next level */ 6448 /* Dive to the next level */
6457 pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, 6449 pp = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, 1, mp->m_bmap_dmxr[1]);
6458 xfs_bmbt, block, 1, mp->m_bmap_dmxr[1]);
6459 bno = be64_to_cpu(*pp); 6450 bno = be64_to_cpu(*pp);
6460 if (unlikely((error = 6451 if (unlikely((error =
6461 xfs_bmap_count_tree(mp, tp, ifp, bno, level, count)) < 0)) { 6452 xfs_bmap_count_tree(mp, tp, ifp, bno, level, count)) < 0)) {
@@ -6470,7 +6461,7 @@ xfs_bmap_count_tree(
6470 for (;;) { 6461 for (;;) {
6471 nextbno = be64_to_cpu(block->bb_rightsib); 6462 nextbno = be64_to_cpu(block->bb_rightsib);
6472 numrecs = be16_to_cpu(block->bb_numrecs); 6463 numrecs = be16_to_cpu(block->bb_numrecs);
6473 if (unlikely(xfs_bmap_disk_count_leaves(ifp, mp, 6464 if (unlikely(xfs_bmap_disk_count_leaves(ifp,
6474 0, block, numrecs, count) < 0)) { 6465 0, block, numrecs, count) < 0)) {
6475 xfs_trans_brelse(tp, bp); 6466 xfs_trans_brelse(tp, bp);
6476 XFS_ERROR_REPORT("xfs_bmap_count_tree(2)", 6467 XFS_ERROR_REPORT("xfs_bmap_count_tree(2)",
@@ -6518,7 +6509,6 @@ xfs_bmap_count_leaves(
6518int 6509int
6519xfs_bmap_disk_count_leaves( 6510xfs_bmap_disk_count_leaves(
6520 xfs_ifork_t *ifp, 6511 xfs_ifork_t *ifp,
6521 xfs_mount_t *mp,
6522 xfs_extnum_t idx, 6512 xfs_extnum_t idx,
6523 xfs_bmbt_block_t *block, 6513 xfs_bmbt_block_t *block,
6524 int numrecs, 6514 int numrecs,
@@ -6528,8 +6518,7 @@ xfs_bmap_disk_count_leaves(
6528 xfs_bmbt_rec_t *frp; 6518 xfs_bmbt_rec_t *frp;
6529 6519
6530 for (b = 1; b <= numrecs; b++) { 6520 for (b = 1; b <= numrecs; b++) {
6531 frp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, 6521 frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, idx + b);
6532 xfs_bmbt, block, idx + b, mp->m_bmap_dmxr[0]);
6533 *count += xfs_bmbt_disk_get_blockcount(frp); 6522 *count += xfs_bmbt_disk_get_blockcount(frp);
6534 } 6523 }
6535 return 0; 6524 return 0;
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 3a925100e90c..29b496594a7e 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -1731,9 +1731,9 @@ xfs_bmdr_to_bmbt(
1731 rblock->bb_leftsib = cpu_to_be64(NULLDFSBNO); 1731 rblock->bb_leftsib = cpu_to_be64(NULLDFSBNO);
1732 rblock->bb_rightsib = cpu_to_be64(NULLDFSBNO); 1732 rblock->bb_rightsib = cpu_to_be64(NULLDFSBNO);
1733 dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0); 1733 dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0);
1734 fkp = XFS_BTREE_KEY_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); 1734 fkp = XFS_BTREE_KEY_ADDR(xfs_bmdr, dblock, 1);
1735 tkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); 1735 tkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen);
1736 fpp = XFS_BTREE_PTR_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); 1736 fpp = XFS_BTREE_PTR_ADDR(xfs_bmdr, dblock, 1, dmxr);
1737 tpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); 1737 tpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen);
1738 dmxr = be16_to_cpu(dblock->bb_numrecs); 1738 dmxr = be16_to_cpu(dblock->bb_numrecs);
1739 memcpy(tkp, fkp, sizeof(*fkp) * dmxr); 1739 memcpy(tkp, fkp, sizeof(*fkp) * dmxr);
@@ -2684,9 +2684,9 @@ xfs_bmbt_to_bmdr(
2684 dblock->bb_numrecs = rblock->bb_numrecs; 2684 dblock->bb_numrecs = rblock->bb_numrecs;
2685 dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0); 2685 dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0);
2686 fkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); 2686 fkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen);
2687 tkp = XFS_BTREE_KEY_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); 2687 tkp = XFS_BTREE_KEY_ADDR(xfs_bmdr, dblock, 1);
2688 fpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); 2688 fpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen);
2689 tpp = XFS_BTREE_PTR_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); 2689 tpp = XFS_BTREE_PTR_ADDR(xfs_bmdr, dblock, 1, dmxr);
2690 dmxr = be16_to_cpu(dblock->bb_numrecs); 2690 dmxr = be16_to_cpu(dblock->bb_numrecs);
2691 memcpy(tkp, fkp, sizeof(*fkp) * dmxr); 2691 memcpy(tkp, fkp, sizeof(*fkp) * dmxr);
2692 memcpy(tpp, fpp, sizeof(*fpp) * dmxr); 2692 memcpy(tpp, fpp, sizeof(*fpp) * dmxr);
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index 49539de9525b..153480f5bc63 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -175,19 +175,11 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
175 175
176#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp)) 176#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp))
177 177
178#define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
179#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize) 178#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize)
180#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \ 179#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \
181 ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \ 180 ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \
182 (cur)->bc_private.b.whichfork)->if_broot_bytes) 181 (cur)->bc_private.b.whichfork)->if_broot_bytes)
183 182
184#define XFS_BMAP_BLOCK_DSIZE(lev,cur) \
185 (((lev) == (cur)->bc_nlevels - 1 ? \
186 XFS_BMAP_RBLOCK_DSIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur)))
187#define XFS_BMAP_BLOCK_ISIZE(lev,cur) \
188 (((lev) == (cur)->bc_nlevels - 1 ? \
189 XFS_BMAP_RBLOCK_ISIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur)))
190
191#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \ 183#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \
192 (((lev) == (cur)->bc_nlevels - 1 ? \ 184 (((lev) == (cur)->bc_nlevels - 1 ? \
193 XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ 185 XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \
@@ -210,37 +202,21 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
210 xfs_bmbt, (lev) == 0) : \ 202 xfs_bmbt, (lev) == 0) : \
211 ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0]))) 203 ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])))
212 204
213#define XFS_BMAP_REC_DADDR(bb,i,cur) \ 205#define XFS_BMAP_REC_DADDR(bb,i,cur) (XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i))
214 (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \ 206
215 be16_to_cpu((bb)->bb_level), cur), \ 207#define XFS_BMAP_REC_IADDR(bb,i,cur) (XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i))
216 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
217 be16_to_cpu((bb)->bb_level), cur)))
218#define XFS_BMAP_REC_IADDR(bb,i,cur) \
219 (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \
220 be16_to_cpu((bb)->bb_level), cur), \
221 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
222 be16_to_cpu((bb)->bb_level), cur)))
223 208
224#define XFS_BMAP_KEY_DADDR(bb,i,cur) \ 209#define XFS_BMAP_KEY_DADDR(bb,i,cur) \
225 (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \ 210 (XFS_BTREE_KEY_ADDR(xfs_bmbt, bb, i))
226 be16_to_cpu((bb)->bb_level), cur), \ 211
227 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
228 be16_to_cpu((bb)->bb_level), cur)))
229#define XFS_BMAP_KEY_IADDR(bb,i,cur) \ 212#define XFS_BMAP_KEY_IADDR(bb,i,cur) \
230 (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \ 213 (XFS_BTREE_KEY_ADDR(xfs_bmbt, bb, i))
231 be16_to_cpu((bb)->bb_level), cur), \
232 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
233 be16_to_cpu((bb)->bb_level), cur)))
234 214
235#define XFS_BMAP_PTR_DADDR(bb,i,cur) \ 215#define XFS_BMAP_PTR_DADDR(bb,i,cur) \
236 (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \ 216 (XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
237 be16_to_cpu((bb)->bb_level), cur), \
238 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
239 be16_to_cpu((bb)->bb_level), cur))) 217 be16_to_cpu((bb)->bb_level), cur)))
240#define XFS_BMAP_PTR_IADDR(bb,i,cur) \ 218#define XFS_BMAP_PTR_IADDR(bb,i,cur) \
241 (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \ 219 (XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
242 be16_to_cpu((bb)->bb_level), cur), \
243 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
244 be16_to_cpu((bb)->bb_level), cur))) 220 be16_to_cpu((bb)->bb_level), cur)))
245 221
246/* 222/*
@@ -248,11 +224,11 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
248 * we don't have a cursor. 224 * we don't have a cursor.
249 */ 225 */
250#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \ 226#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \
251 (XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) 227 (XFS_BTREE_REC_ADDR(xfs_bmbt,bb,i))
252#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \ 228#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \
253 (XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) 229 (XFS_BTREE_KEY_ADDR(xfs_bmbt,bb,i))
254#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \ 230#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \
255 (XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) 231 (XFS_BTREE_PTR_ADDR(xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
256 232
257#define XFS_BMAP_BROOT_NUMRECS(bb) be16_to_cpu((bb)->bb_numrecs) 233#define XFS_BMAP_BROOT_NUMRECS(bb) be16_to_cpu((bb)->bb_numrecs)
258#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0) 234#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h
index 892b06c54263..4e27d55a1e73 100644
--- a/fs/xfs/xfs_btree.h
+++ b/fs/xfs/xfs_btree.h
@@ -122,13 +122,13 @@ extern const __uint32_t xfs_magics[];
122 * Given block size, type prefix, block pointer, and index of requested entry 122 * Given block size, type prefix, block pointer, and index of requested entry
123 * (first entry numbered 1). 123 * (first entry numbered 1).
124 */ 124 */
125#define XFS_BTREE_REC_ADDR(bsz,t,bb,i,mxr) \ 125#define XFS_BTREE_REC_ADDR(t,bb,i) \
126 ((t ## _rec_t *)((char *)(bb) + sizeof(t ## _block_t) + \ 126 ((t ## _rec_t *)((char *)(bb) + sizeof(t ## _block_t) + \
127 ((i) - 1) * sizeof(t ## _rec_t))) 127 ((i) - 1) * sizeof(t ## _rec_t)))
128#define XFS_BTREE_KEY_ADDR(bsz,t,bb,i,mxr) \ 128#define XFS_BTREE_KEY_ADDR(t,bb,i) \
129 ((t ## _key_t *)((char *)(bb) + sizeof(t ## _block_t) + \ 129 ((t ## _key_t *)((char *)(bb) + sizeof(t ## _block_t) + \
130 ((i) - 1) * sizeof(t ## _key_t))) 130 ((i) - 1) * sizeof(t ## _key_t)))
131#define XFS_BTREE_PTR_ADDR(bsz,t,bb,i,mxr) \ 131#define XFS_BTREE_PTR_ADDR(t,bb,i,mxr) \
132 ((t ## _ptr_t *)((char *)(bb) + sizeof(t ## _block_t) + \ 132 ((t ## _ptr_t *)((char *)(bb) + sizeof(t ## _block_t) + \
133 (mxr) * sizeof(t ## _key_t) + ((i) - 1) * sizeof(t ## _ptr_t))) 133 (mxr) * sizeof(t ## _key_t) + ((i) - 1) * sizeof(t ## _ptr_t)))
134 134
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index bfde9e6d67e6..32c37c1c47ab 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -250,8 +250,7 @@ xfs_growfs_data_private(
250 block->bb_numrecs = cpu_to_be16(1); 250 block->bb_numrecs = cpu_to_be16(1);
251 block->bb_leftsib = cpu_to_be32(NULLAGBLOCK); 251 block->bb_leftsib = cpu_to_be32(NULLAGBLOCK);
252 block->bb_rightsib = cpu_to_be32(NULLAGBLOCK); 252 block->bb_rightsib = cpu_to_be32(NULLAGBLOCK);
253 arec = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_alloc, 253 arec = XFS_BTREE_REC_ADDR(xfs_alloc, block, 1);
254 block, 1, mp->m_alloc_mxr[0]);
255 arec->ar_startblock = cpu_to_be32(XFS_PREALLOC_BLOCKS(mp)); 254 arec->ar_startblock = cpu_to_be32(XFS_PREALLOC_BLOCKS(mp));
256 arec->ar_blockcount = cpu_to_be32( 255 arec->ar_blockcount = cpu_to_be32(
257 agsize - be32_to_cpu(arec->ar_startblock)); 256 agsize - be32_to_cpu(arec->ar_startblock));
@@ -272,8 +271,7 @@ xfs_growfs_data_private(
272 block->bb_numrecs = cpu_to_be16(1); 271 block->bb_numrecs = cpu_to_be16(1);
273 block->bb_leftsib = cpu_to_be32(NULLAGBLOCK); 272 block->bb_leftsib = cpu_to_be32(NULLAGBLOCK);
274 block->bb_rightsib = cpu_to_be32(NULLAGBLOCK); 273 block->bb_rightsib = cpu_to_be32(NULLAGBLOCK);
275 arec = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_alloc, 274 arec = XFS_BTREE_REC_ADDR(xfs_alloc, block, 1);
276 block, 1, mp->m_alloc_mxr[0]);
277 arec->ar_startblock = cpu_to_be32(XFS_PREALLOC_BLOCKS(mp)); 275 arec->ar_startblock = cpu_to_be32(XFS_PREALLOC_BLOCKS(mp));
278 arec->ar_blockcount = cpu_to_be32( 276 arec->ar_blockcount = cpu_to_be32(
279 agsize - be32_to_cpu(arec->ar_startblock)); 277 agsize - be32_to_cpu(arec->ar_startblock));
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h
index 2c0e49893ff7..bf8e9aff272e 100644
--- a/fs/xfs/xfs_ialloc_btree.h
+++ b/fs/xfs/xfs_ialloc_btree.h
@@ -89,7 +89,6 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t;
89/* 89/*
90 * Real block structures have a size equal to the disk block size. 90 * Real block structures have a size equal to the disk block size.
91 */ 91 */
92#define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
93#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_inobt_mxr[lev != 0]) 92#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_inobt_mxr[lev != 0])
94#define XFS_INOBT_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_inobt_mnr[lev != 0]) 93#define XFS_INOBT_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_inobt_mnr[lev != 0])
95#define XFS_INOBT_IS_LAST_REC(cur) \ 94#define XFS_INOBT_IS_LAST_REC(cur) \
@@ -110,14 +109,13 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t;
110 * Record, key, and pointer address macros for btree blocks. 109 * Record, key, and pointer address macros for btree blocks.
111 */ 110 */
112#define XFS_INOBT_REC_ADDR(bb,i,cur) \ 111#define XFS_INOBT_REC_ADDR(bb,i,cur) \
113 (XFS_BTREE_REC_ADDR(XFS_INOBT_BLOCK_SIZE(0,cur), xfs_inobt, bb, \ 112 (XFS_BTREE_REC_ADDR(xfs_inobt, bb, i))
114 i, XFS_INOBT_BLOCK_MAXRECS(0, cur))) 113
115#define XFS_INOBT_KEY_ADDR(bb,i,cur) \ 114#define XFS_INOBT_KEY_ADDR(bb,i,cur) \
116 (XFS_BTREE_KEY_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, \ 115 (XFS_BTREE_KEY_ADDR(xfs_inobt, bb, i))
117 i, XFS_INOBT_BLOCK_MAXRECS(1, cur)))
118 116
119#define XFS_INOBT_PTR_ADDR(bb,i,cur) \ 117#define XFS_INOBT_PTR_ADDR(bb,i,cur) \
120 (XFS_BTREE_PTR_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, \ 118 (XFS_BTREE_PTR_ADDR(xfs_inobt, bb, \
121 i, XFS_INOBT_BLOCK_MAXRECS(1, cur))) 119 i, XFS_INOBT_BLOCK_MAXRECS(1, cur)))
122 120
123/* 121/*