diff options
author | Dave Chinner <dchinner@redhat.com> | 2014-06-06 01:15:59 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-06 01:15:59 -0400 |
commit | 8f66193c89f0b0259db6b27b4df3deb828c294f9 (patch) | |
tree | 333c24e2c4d901d044e5b2c3c820cb680919f73c /fs/xfs/xfs_dir2_leaf.c | |
parent | d6cf13051f31bf1a54b65643d0e578b3ca2f0692 (diff) |
xfs: convert m_dirblksize to xfs_da_geometry
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.c')
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index a1f13103a16e..e517bd0544cd 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -92,6 +92,7 @@ xfs_dir3_leaf_check_int( | |||
92 | int i; | 92 | int i; |
93 | const struct xfs_dir_ops *ops; | 93 | const struct xfs_dir_ops *ops; |
94 | struct xfs_dir3_icleaf_hdr leafhdr; | 94 | struct xfs_dir3_icleaf_hdr leafhdr; |
95 | struct xfs_da_geometry *geo = mp->m_dir_geo; | ||
95 | 96 | ||
96 | /* | 97 | /* |
97 | * we can be passed a null dp here from a verifier, so we need to go the | 98 | * we can be passed a null dp here from a verifier, so we need to go the |
@@ -105,14 +106,14 @@ xfs_dir3_leaf_check_int( | |||
105 | } | 106 | } |
106 | 107 | ||
107 | ents = ops->leaf_ents_p(leaf); | 108 | ents = ops->leaf_ents_p(leaf); |
108 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 109 | ltp = xfs_dir2_leaf_tail_p(geo, leaf); |
109 | 110 | ||
110 | /* | 111 | /* |
111 | * XXX (dgc): This value is not restrictive enough. | 112 | * XXX (dgc): This value is not restrictive enough. |
112 | * Should factor in the size of the bests table as well. | 113 | * Should factor in the size of the bests table as well. |
113 | * We can deduce a value for that from di_size. | 114 | * We can deduce a value for that from di_size. |
114 | */ | 115 | */ |
115 | if (hdr->count > ops->leaf_max_ents(mp)) | 116 | if (hdr->count > ops->leaf_max_ents(geo)) |
116 | return false; | 117 | return false; |
117 | 118 | ||
118 | /* Leaves and bests don't overlap in leaf format. */ | 119 | /* Leaves and bests don't overlap in leaf format. */ |
@@ -323,7 +324,7 @@ xfs_dir3_leaf_init( | |||
323 | if (type == XFS_DIR2_LEAF1_MAGIC) { | 324 | if (type == XFS_DIR2_LEAF1_MAGIC) { |
324 | struct xfs_dir2_leaf_tail *ltp; | 325 | struct xfs_dir2_leaf_tail *ltp; |
325 | 326 | ||
326 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 327 | ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf); |
327 | ltp->bestcount = 0; | 328 | ltp->bestcount = 0; |
328 | bp->b_ops = &xfs_dir3_leaf1_buf_ops; | 329 | bp->b_ops = &xfs_dir3_leaf1_buf_ops; |
329 | xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DIR_LEAF1_BUF); | 330 | xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DIR_LEAF1_BUF); |
@@ -415,7 +416,7 @@ xfs_dir2_block_to_leaf( | |||
415 | leaf = lbp->b_addr; | 416 | leaf = lbp->b_addr; |
416 | hdr = dbp->b_addr; | 417 | hdr = dbp->b_addr; |
417 | xfs_dir3_data_check(dp, dbp); | 418 | xfs_dir3_data_check(dp, dbp); |
418 | btp = xfs_dir2_block_tail_p(mp, hdr); | 419 | btp = xfs_dir2_block_tail_p(args->geo, hdr); |
419 | blp = xfs_dir2_block_leaf_p(btp); | 420 | blp = xfs_dir2_block_leaf_p(btp); |
420 | bf = dp->d_ops->data_bestfree_p(hdr); | 421 | bf = dp->d_ops->data_bestfree_p(hdr); |
421 | ents = dp->d_ops->leaf_ents_p(leaf); | 422 | ents = dp->d_ops->leaf_ents_p(leaf); |
@@ -443,7 +444,7 @@ xfs_dir2_block_to_leaf( | |||
443 | */ | 444 | */ |
444 | xfs_dir2_data_make_free(tp, dp, dbp, | 445 | xfs_dir2_data_make_free(tp, dp, dbp, |
445 | (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), | 446 | (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), |
446 | (xfs_dir2_data_aoff_t)((char *)hdr + mp->m_dirblksize - | 447 | (xfs_dir2_data_aoff_t)((char *)hdr + args->geo->blksize - |
447 | (char *)blp), | 448 | (char *)blp), |
448 | &needlog, &needscan); | 449 | &needlog, &needscan); |
449 | /* | 450 | /* |
@@ -461,7 +462,7 @@ xfs_dir2_block_to_leaf( | |||
461 | /* | 462 | /* |
462 | * Set up leaf tail and bests table. | 463 | * Set up leaf tail and bests table. |
463 | */ | 464 | */ |
464 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 465 | ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); |
465 | ltp->bestcount = cpu_to_be32(1); | 466 | ltp->bestcount = cpu_to_be32(1); |
466 | bestsp = xfs_dir2_leaf_bests_p(ltp); | 467 | bestsp = xfs_dir2_leaf_bests_p(ltp); |
467 | bestsp[0] = bf[0].length; | 468 | bestsp[0] = bf[0].length; |
@@ -653,7 +654,7 @@ xfs_dir2_leaf_addname( | |||
653 | */ | 654 | */ |
654 | index = xfs_dir2_leaf_search_hash(args, lbp); | 655 | index = xfs_dir2_leaf_search_hash(args, lbp); |
655 | leaf = lbp->b_addr; | 656 | leaf = lbp->b_addr; |
656 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 657 | ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); |
657 | ents = dp->d_ops->leaf_ents_p(leaf); | 658 | ents = dp->d_ops->leaf_ents_p(leaf); |
658 | dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); | 659 | dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); |
659 | bestsp = xfs_dir2_leaf_bests_p(ltp); | 660 | bestsp = xfs_dir2_leaf_bests_p(ltp); |
@@ -1066,7 +1067,7 @@ xfs_dir3_leaf_log_bests( | |||
1066 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || | 1067 | ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || |
1067 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC)); | 1068 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC)); |
1068 | 1069 | ||
1069 | ltp = xfs_dir2_leaf_tail_p(tp->t_mountp, leaf); | 1070 | ltp = xfs_dir2_leaf_tail_p(tp->t_mountp->m_dir_geo, leaf); |
1070 | firstb = xfs_dir2_leaf_bests_p(ltp) + first; | 1071 | firstb = xfs_dir2_leaf_bests_p(ltp) + first; |
1071 | lastb = xfs_dir2_leaf_bests_p(ltp) + last; | 1072 | lastb = xfs_dir2_leaf_bests_p(ltp) + last; |
1072 | xfs_trans_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf), | 1073 | xfs_trans_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf), |
@@ -1138,9 +1139,9 @@ xfs_dir3_leaf_log_tail( | |||
1138 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || | 1139 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || |
1139 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); | 1140 | leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); |
1140 | 1141 | ||
1141 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 1142 | ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf); |
1142 | xfs_trans_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf), | 1143 | xfs_trans_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf), |
1143 | (uint)(mp->m_dirblksize - 1)); | 1144 | (uint)(mp->m_dir_geo->blksize - 1)); |
1144 | } | 1145 | } |
1145 | 1146 | ||
1146 | /* | 1147 | /* |
@@ -1388,7 +1389,7 @@ xfs_dir2_leaf_removename( | |||
1388 | xfs_dir2_dataptr_to_off(args->geo, be32_to_cpu(lep->address))); | 1389 | xfs_dir2_dataptr_to_off(args->geo, be32_to_cpu(lep->address))); |
1389 | needscan = needlog = 0; | 1390 | needscan = needlog = 0; |
1390 | oldbest = be16_to_cpu(bf[0].length); | 1391 | oldbest = be16_to_cpu(bf[0].length); |
1391 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 1392 | ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); |
1392 | bestsp = xfs_dir2_leaf_bests_p(ltp); | 1393 | bestsp = xfs_dir2_leaf_bests_p(ltp); |
1393 | ASSERT(be16_to_cpu(bestsp[db]) == oldbest); | 1394 | ASSERT(be16_to_cpu(bestsp[db]) == oldbest); |
1394 | /* | 1395 | /* |
@@ -1428,7 +1429,7 @@ xfs_dir2_leaf_removename( | |||
1428 | * If the data block is now empty then get rid of the data block. | 1429 | * If the data block is now empty then get rid of the data block. |
1429 | */ | 1430 | */ |
1430 | if (be16_to_cpu(bf[0].length) == | 1431 | if (be16_to_cpu(bf[0].length) == |
1431 | mp->m_dirblksize - dp->d_ops->data_entry_offset) { | 1432 | args->geo->blksize - dp->d_ops->data_entry_offset) { |
1432 | ASSERT(db != args->geo->datablk); | 1433 | ASSERT(db != args->geo->datablk); |
1433 | if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { | 1434 | if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { |
1434 | /* | 1435 | /* |
@@ -1618,7 +1619,7 @@ xfs_dir2_leaf_trim_data( | |||
1618 | return error; | 1619 | return error; |
1619 | 1620 | ||
1620 | leaf = lbp->b_addr; | 1621 | leaf = lbp->b_addr; |
1621 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 1622 | ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); |
1622 | 1623 | ||
1623 | #ifdef DEBUG | 1624 | #ifdef DEBUG |
1624 | { | 1625 | { |
@@ -1628,7 +1629,7 @@ xfs_dir2_leaf_trim_data( | |||
1628 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || | 1629 | ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || |
1629 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)); | 1630 | hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)); |
1630 | ASSERT(be16_to_cpu(bf[0].length) == | 1631 | ASSERT(be16_to_cpu(bf[0].length) == |
1631 | mp->m_dirblksize - dp->d_ops->data_entry_offset); | 1632 | args->geo->blksize - dp->d_ops->data_entry_offset); |
1632 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); | 1633 | ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); |
1633 | } | 1634 | } |
1634 | #endif | 1635 | #endif |
@@ -1740,7 +1741,7 @@ xfs_dir2_node_to_leaf( | |||
1740 | /* | 1741 | /* |
1741 | * If it's not the single leaf block, give up. | 1742 | * If it's not the single leaf block, give up. |
1742 | */ | 1743 | */ |
1743 | if (XFS_FSB_TO_B(mp, fo) > XFS_DIR2_LEAF_OFFSET + mp->m_dirblksize) | 1744 | if (XFS_FSB_TO_B(mp, fo) > XFS_DIR2_LEAF_OFFSET + args->geo->blksize) |
1744 | return 0; | 1745 | return 0; |
1745 | lbp = state->path.blk[0].bp; | 1746 | lbp = state->path.blk[0].bp; |
1746 | leaf = lbp->b_addr; | 1747 | leaf = lbp->b_addr; |
@@ -1764,7 +1765,7 @@ xfs_dir2_node_to_leaf( | |||
1764 | * Now see if the leafn and free data will fit in a leaf1. | 1765 | * Now see if the leafn and free data will fit in a leaf1. |
1765 | * If not, release the buffer and give up. | 1766 | * If not, release the buffer and give up. |
1766 | */ | 1767 | */ |
1767 | if (xfs_dir3_leaf_size(&leafhdr, freehdr.nvalid) > mp->m_dirblksize) { | 1768 | if (xfs_dir3_leaf_size(&leafhdr, freehdr.nvalid) > args->geo->blksize) { |
1768 | xfs_trans_brelse(tp, fbp); | 1769 | xfs_trans_brelse(tp, fbp); |
1769 | return 0; | 1770 | return 0; |
1770 | } | 1771 | } |
@@ -1784,7 +1785,7 @@ xfs_dir2_node_to_leaf( | |||
1784 | /* | 1785 | /* |
1785 | * Set up the leaf tail from the freespace block. | 1786 | * Set up the leaf tail from the freespace block. |
1786 | */ | 1787 | */ |
1787 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 1788 | ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); |
1788 | ltp->bestcount = cpu_to_be32(freehdr.nvalid); | 1789 | ltp->bestcount = cpu_to_be32(freehdr.nvalid); |
1789 | 1790 | ||
1790 | /* | 1791 | /* |