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.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 3c4beb3a4326..a1aab9275d5a 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -384,14 +384,14 @@ xfs_bmap_count_tree(
384 int levelin, 384 int levelin,
385 int *count); 385 int *count);
386 386
387STATIC int 387STATIC void
388xfs_bmap_count_leaves( 388xfs_bmap_count_leaves(
389 xfs_ifork_t *ifp, 389 xfs_ifork_t *ifp,
390 xfs_extnum_t idx, 390 xfs_extnum_t idx,
391 int numrecs, 391 int numrecs,
392 int *count); 392 int *count);
393 393
394STATIC int 394STATIC void
395xfs_bmap_disk_count_leaves( 395xfs_bmap_disk_count_leaves(
396 xfs_extnum_t idx, 396 xfs_extnum_t idx,
397 xfs_bmbt_block_t *block, 397 xfs_bmbt_block_t *block,
@@ -4000,7 +4000,7 @@ xfs_bmap_add_attrfork(
4000 ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; 4000 ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
4001 } 4001 }
4002 ASSERT(ip->i_d.di_anextents == 0); 4002 ASSERT(ip->i_d.di_anextents == 0);
4003 VN_HOLD(XFS_ITOV(ip)); 4003 IHOLD(ip);
4004 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 4004 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
4005 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 4005 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
4006 switch (ip->i_d.di_format) { 4006 switch (ip->i_d.di_format) {
@@ -6096,7 +6096,7 @@ xfs_bmap_get_bp(
6096 tp = cur->bc_tp; 6096 tp = cur->bc_tp;
6097 licp = &tp->t_items; 6097 licp = &tp->t_items;
6098 while (!bp && licp != NULL) { 6098 while (!bp && licp != NULL) {
6099 if (XFS_LIC_ARE_ALL_FREE(licp)) { 6099 if (xfs_lic_are_all_free(licp)) {
6100 licp = licp->lic_next; 6100 licp = licp->lic_next;
6101 continue; 6101 continue;
6102 } 6102 }
@@ -6106,11 +6106,11 @@ xfs_bmap_get_bp(
6106 xfs_buf_log_item_t *bip; 6106 xfs_buf_log_item_t *bip;
6107 xfs_buf_t *lbp; 6107 xfs_buf_t *lbp;
6108 6108
6109 if (XFS_LIC_ISFREE(licp, i)) { 6109 if (xfs_lic_isfree(licp, i)) {
6110 continue; 6110 continue;
6111 } 6111 }
6112 6112
6113 lidp = XFS_LIC_SLOT(licp, i); 6113 lidp = xfs_lic_slot(licp, i);
6114 lip = lidp->lid_item; 6114 lip = lidp->lid_item;
6115 if (lip->li_type != XFS_LI_BUF) 6115 if (lip->li_type != XFS_LI_BUF)
6116 continue; 6116 continue;
@@ -6367,13 +6367,9 @@ xfs_bmap_count_blocks(
6367 mp = ip->i_mount; 6367 mp = ip->i_mount;
6368 ifp = XFS_IFORK_PTR(ip, whichfork); 6368 ifp = XFS_IFORK_PTR(ip, whichfork);
6369 if ( XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS ) { 6369 if ( XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS ) {
6370 if (unlikely(xfs_bmap_count_leaves(ifp, 0, 6370 xfs_bmap_count_leaves(ifp, 0,
6371 ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t), 6371 ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t),
6372 count) < 0)) { 6372 count);
6373 XFS_ERROR_REPORT("xfs_bmap_count_blocks(1)",
6374 XFS_ERRLEVEL_LOW, mp);
6375 return XFS_ERROR(EFSCORRUPTED);
6376 }
6377 return 0; 6373 return 0;
6378 } 6374 }
6379 6375
@@ -6454,13 +6450,7 @@ xfs_bmap_count_tree(
6454 for (;;) { 6450 for (;;) {
6455 nextbno = be64_to_cpu(block->bb_rightsib); 6451 nextbno = be64_to_cpu(block->bb_rightsib);
6456 numrecs = be16_to_cpu(block->bb_numrecs); 6452 numrecs = be16_to_cpu(block->bb_numrecs);
6457 if (unlikely(xfs_bmap_disk_count_leaves(0, 6453 xfs_bmap_disk_count_leaves(0, block, numrecs, count);
6458 block, numrecs, count) < 0)) {
6459 xfs_trans_brelse(tp, bp);
6460 XFS_ERROR_REPORT("xfs_bmap_count_tree(2)",
6461 XFS_ERRLEVEL_LOW, mp);
6462 return XFS_ERROR(EFSCORRUPTED);
6463 }
6464 xfs_trans_brelse(tp, bp); 6454 xfs_trans_brelse(tp, bp);
6465 if (nextbno == NULLFSBLOCK) 6455 if (nextbno == NULLFSBLOCK)
6466 break; 6456 break;
@@ -6478,7 +6468,7 @@ xfs_bmap_count_tree(
6478/* 6468/*
6479 * Count leaf blocks given a range of extent records. 6469 * Count leaf blocks given a range of extent records.
6480 */ 6470 */
6481STATIC int 6471STATIC void
6482xfs_bmap_count_leaves( 6472xfs_bmap_count_leaves(
6483 xfs_ifork_t *ifp, 6473 xfs_ifork_t *ifp,
6484 xfs_extnum_t idx, 6474 xfs_extnum_t idx,
@@ -6491,14 +6481,13 @@ xfs_bmap_count_leaves(
6491 xfs_bmbt_rec_host_t *frp = xfs_iext_get_ext(ifp, idx + b); 6481 xfs_bmbt_rec_host_t *frp = xfs_iext_get_ext(ifp, idx + b);
6492 *count += xfs_bmbt_get_blockcount(frp); 6482 *count += xfs_bmbt_get_blockcount(frp);
6493 } 6483 }
6494 return 0;
6495} 6484}
6496 6485
6497/* 6486/*
6498 * Count leaf blocks given a range of extent records originally 6487 * Count leaf blocks given a range of extent records originally
6499 * in btree format. 6488 * in btree format.
6500 */ 6489 */
6501STATIC int 6490STATIC void
6502xfs_bmap_disk_count_leaves( 6491xfs_bmap_disk_count_leaves(
6503 xfs_extnum_t idx, 6492 xfs_extnum_t idx,
6504 xfs_bmbt_block_t *block, 6493 xfs_bmbt_block_t *block,
@@ -6512,5 +6501,4 @@ xfs_bmap_disk_count_leaves(
6512 frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, idx + b); 6501 frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, idx + b);
6513 *count += xfs_bmbt_disk_get_blockcount(frp); 6502 *count += xfs_bmbt_disk_get_blockcount(frp);
6514 } 6503 }
6515 return 0;
6516} 6504}