aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r--fs/xfs/xfs_bmap.c35
1 files changed, 12 insertions, 23 deletions
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;