Commit 1c9a5b2e authored by Dave Chinner's avatar Dave Chinner Committed by Ben Myers

xfs: convert directory vector functions to constants

Many of the vectorised function calls now take no parameters and
return a constant value. There is no reason for these to be vectored
functions, so convert them to constants

Binary sizes:

   text    data     bss     dec     hex filename
 794490   96802    1096  892388   d9de4 fs/xfs/xfs.o.orig
 792986   96802    1096  890884   d9804 fs/xfs/xfs.o.p1
 792350   96802    1096  890248   d9588 fs/xfs/xfs.o.p2
 789293   96802    1096  887191   d8997 fs/xfs/xfs.o.p3
 789005   96802    1096  886903   d8997 fs/xfs/xfs.o.p4
 789061   96802    1096  886959   d88af fs/xfs/xfs.o.p5
 789733   96802    1096  887631   d8b4f fs/xfs/xfs.o.p6
 791421   96802    1096  889319   d91e7 fs/xfs/xfs.o.p7
 791701   96802    1096  889599   d92ff fs/xfs/xfs.o.p8
 791205   96802    1096  889103   d91cf fs/xfs/xfs.o.p9
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 24dd0f54
...@@ -333,8 +333,7 @@ xfs_da3_node_create( ...@@ -333,8 +333,7 @@ xfs_da3_node_create(
dp->d_ops->node_hdr_to_disk(node, &ichdr); dp->d_ops->node_hdr_to_disk(node, &ichdr);
xfs_trans_log_buf(tp, bp, xfs_trans_log_buf(tp, bp,
XFS_DA_LOGRANGE(node, &node->hdr, XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size));
dp->d_ops->node_hdr_size()));
*bpp = bp; *bpp = bp;
return(0); return(0);
...@@ -838,13 +837,12 @@ xfs_da3_node_rebalance( ...@@ -838,13 +837,12 @@ xfs_da3_node_rebalance(
*/ */
dp->d_ops->node_hdr_to_disk(node1, &nodehdr1); dp->d_ops->node_hdr_to_disk(node1, &nodehdr1);
xfs_trans_log_buf(tp, blk1->bp, xfs_trans_log_buf(tp, blk1->bp,
XFS_DA_LOGRANGE(node1, &node1->hdr, XFS_DA_LOGRANGE(node1, &node1->hdr, dp->d_ops->node_hdr_size));
dp->d_ops->node_hdr_size()));
dp->d_ops->node_hdr_to_disk(node2, &nodehdr2); dp->d_ops->node_hdr_to_disk(node2, &nodehdr2);
xfs_trans_log_buf(tp, blk2->bp, xfs_trans_log_buf(tp, blk2->bp,
XFS_DA_LOGRANGE(node2, &node2->hdr, XFS_DA_LOGRANGE(node2, &node2->hdr,
dp->d_ops->node_hdr_size() + dp->d_ops->node_hdr_size +
(sizeof(btree2[0]) * nodehdr2.count))); (sizeof(btree2[0]) * nodehdr2.count)));
/* /*
...@@ -915,7 +913,7 @@ xfs_da3_node_add( ...@@ -915,7 +913,7 @@ xfs_da3_node_add(
nodehdr.count += 1; nodehdr.count += 1;
dp->d_ops->node_hdr_to_disk(node, &nodehdr); dp->d_ops->node_hdr_to_disk(node, &nodehdr);
xfs_trans_log_buf(state->args->trans, oldblk->bp, xfs_trans_log_buf(state->args->trans, oldblk->bp,
XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size())); XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size));
/* /*
* Copy the last hash value from the oldblk to propagate upwards. * Copy the last hash value from the oldblk to propagate upwards.
...@@ -1350,7 +1348,7 @@ xfs_da3_node_remove( ...@@ -1350,7 +1348,7 @@ xfs_da3_node_remove(
nodehdr.count -= 1; nodehdr.count -= 1;
dp->d_ops->node_hdr_to_disk(node, &nodehdr); dp->d_ops->node_hdr_to_disk(node, &nodehdr);
xfs_trans_log_buf(state->args->trans, drop_blk->bp, xfs_trans_log_buf(state->args->trans, drop_blk->bp,
XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size())); XFS_DA_LOGRANGE(node, &node->hdr, dp->d_ops->node_hdr_size));
/* /*
* Copy the last hash value from the block to propagate upwards. * Copy the last hash value from the block to propagate upwards.
...@@ -1423,7 +1421,7 @@ xfs_da3_node_unbalance( ...@@ -1423,7 +1421,7 @@ xfs_da3_node_unbalance(
dp->d_ops->node_hdr_to_disk(save_node, &save_hdr); dp->d_ops->node_hdr_to_disk(save_node, &save_hdr);
xfs_trans_log_buf(tp, save_blk->bp, xfs_trans_log_buf(tp, save_blk->bp,
XFS_DA_LOGRANGE(save_node, &save_node->hdr, XFS_DA_LOGRANGE(save_node, &save_node->hdr,
dp->d_ops->node_hdr_size())); dp->d_ops->node_hdr_size));
/* /*
* Save the last hashval in the remaining block for upward propagation. * Save the last hashval in the remaining block for upward propagation.
......
This diff is collapsed.
...@@ -105,7 +105,7 @@ xfs_dir_mount( ...@@ -105,7 +105,7 @@ xfs_dir_mount(
mp->m_dirleafblk = xfs_dir2_db_to_da(mp, XFS_DIR2_LEAF_FIRSTDB(mp)); mp->m_dirleafblk = xfs_dir2_db_to_da(mp, XFS_DIR2_LEAF_FIRSTDB(mp));
mp->m_dirfreeblk = xfs_dir2_db_to_da(mp, XFS_DIR2_FREE_FIRSTDB(mp)); mp->m_dirfreeblk = xfs_dir2_db_to_da(mp, XFS_DIR2_FREE_FIRSTDB(mp));
nodehdr_size = mp->m_dir_inode_ops->node_hdr_size(); nodehdr_size = mp->m_dir_inode_ops->node_hdr_size;
mp->m_attr_node_ents = (mp->m_sb.sb_blocksize - nodehdr_size) / mp->m_attr_node_ents = (mp->m_sb.sb_blocksize - nodehdr_size) /
(uint)sizeof(xfs_da_node_entry_t); (uint)sizeof(xfs_da_node_entry_t);
mp->m_dir_node_ents = (mp->m_dirblksize - nodehdr_size) / mp->m_dir_node_ents = (mp->m_dirblksize - nodehdr_size) /
......
...@@ -59,10 +59,10 @@ struct xfs_dir_ops { ...@@ -59,10 +59,10 @@ struct xfs_dir_ops {
struct xfs_dir2_data_free * struct xfs_dir2_data_free *
(*data_bestfree_p)(struct xfs_dir2_data_hdr *hdr); (*data_bestfree_p)(struct xfs_dir2_data_hdr *hdr);
xfs_dir2_data_aoff_t (*data_dot_offset)(void); xfs_dir2_data_aoff_t data_dot_offset;
xfs_dir2_data_aoff_t (*data_dotdot_offset)(void); xfs_dir2_data_aoff_t data_dotdot_offset;
xfs_dir2_data_aoff_t (*data_first_offset)(void); xfs_dir2_data_aoff_t data_first_offset;
size_t (*data_entry_offset)(void); size_t data_entry_offset;
struct xfs_dir2_data_entry * struct xfs_dir2_data_entry *
(*data_dot_entry_p)(struct xfs_dir2_data_hdr *hdr); (*data_dot_entry_p)(struct xfs_dir2_data_hdr *hdr);
...@@ -75,7 +75,7 @@ struct xfs_dir_ops { ...@@ -75,7 +75,7 @@ struct xfs_dir_ops {
struct xfs_dir2_data_unused * struct xfs_dir2_data_unused *
(*data_unused_p)(struct xfs_dir2_data_hdr *hdr); (*data_unused_p)(struct xfs_dir2_data_hdr *hdr);
int (*leaf_hdr_size)(void); int leaf_hdr_size;
void (*leaf_hdr_to_disk)(struct xfs_dir2_leaf *to, void (*leaf_hdr_to_disk)(struct xfs_dir2_leaf *to,
struct xfs_dir3_icleaf_hdr *from); struct xfs_dir3_icleaf_hdr *from);
void (*leaf_hdr_from_disk)(struct xfs_dir3_icleaf_hdr *to, void (*leaf_hdr_from_disk)(struct xfs_dir3_icleaf_hdr *to,
...@@ -84,7 +84,7 @@ struct xfs_dir_ops { ...@@ -84,7 +84,7 @@ struct xfs_dir_ops {
struct xfs_dir2_leaf_entry * struct xfs_dir2_leaf_entry *
(*leaf_ents_p)(struct xfs_dir2_leaf *lp); (*leaf_ents_p)(struct xfs_dir2_leaf *lp);
int (*node_hdr_size)(void); int node_hdr_size;
void (*node_hdr_to_disk)(struct xfs_da_intnode *to, void (*node_hdr_to_disk)(struct xfs_da_intnode *to,
struct xfs_da3_icnode_hdr *from); struct xfs_da3_icnode_hdr *from);
void (*node_hdr_from_disk)(struct xfs_da3_icnode_hdr *to, void (*node_hdr_from_disk)(struct xfs_da3_icnode_hdr *to,
...@@ -92,7 +92,7 @@ struct xfs_dir_ops { ...@@ -92,7 +92,7 @@ struct xfs_dir_ops {
struct xfs_da_node_entry * struct xfs_da_node_entry *
(*node_tree_p)(struct xfs_da_intnode *dap); (*node_tree_p)(struct xfs_da_intnode *dap);
int (*free_hdr_size)(void); int free_hdr_size;
void (*free_hdr_to_disk)(struct xfs_dir2_free *to, void (*free_hdr_to_disk)(struct xfs_dir2_free *to,
struct xfs_dir3_icfree_hdr *from); struct xfs_dir3_icfree_hdr *from);
void (*free_hdr_from_disk)(struct xfs_dir3_icfree_hdr *to, void (*free_hdr_from_disk)(struct xfs_dir3_icfree_hdr *to,
......
...@@ -951,7 +951,7 @@ xfs_dir2_leaf_to_block( ...@@ -951,7 +951,7 @@ xfs_dir2_leaf_to_block(
while (dp->i_d.di_size > mp->m_dirblksize) { while (dp->i_d.di_size > mp->m_dirblksize) {
int hdrsz; int hdrsz;
hdrsz = dp->d_ops->data_entry_offset(); hdrsz = dp->d_ops->data_entry_offset;
bestsp = xfs_dir2_leaf_bests_p(ltp); bestsp = xfs_dir2_leaf_bests_p(ltp);
if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) == if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) ==
mp->m_dirblksize - hdrsz) { mp->m_dirblksize - hdrsz) {
...@@ -1185,7 +1185,7 @@ xfs_dir2_sf_to_block( ...@@ -1185,7 +1185,7 @@ xfs_dir2_sf_to_block(
blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
(char *)dep - (char *)hdr)); (char *)dep - (char *)hdr));
offset = dp->d_ops->data_first_offset(); offset = dp->d_ops->data_first_offset;
/* /*
* Loop over existing entries, stuff them in. * Loop over existing entries, stuff them in.
*/ */
......
...@@ -598,7 +598,7 @@ xfs_dir3_data_init( ...@@ -598,7 +598,7 @@ xfs_dir3_data_init(
hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC);
bf = dp->d_ops->data_bestfree_p(hdr); bf = dp->d_ops->data_bestfree_p(hdr);
bf[0].offset = cpu_to_be16(dp->d_ops->data_entry_offset()); bf[0].offset = cpu_to_be16(dp->d_ops->data_entry_offset);
for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) {
bf[i].length = 0; bf[i].length = 0;
bf[i].offset = 0; bf[i].offset = 0;
...@@ -610,7 +610,7 @@ xfs_dir3_data_init( ...@@ -610,7 +610,7 @@ xfs_dir3_data_init(
dup = dp->d_ops->data_unused_p(hdr); dup = dp->d_ops->data_unused_p(hdr);
dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
t = mp->m_dirblksize - (uint)dp->d_ops->data_entry_offset(); t = mp->m_dirblksize - (uint)dp->d_ops->data_entry_offset;
bf[0].length = cpu_to_be16(t); bf[0].length = cpu_to_be16(t);
dup->length = cpu_to_be16(t); dup->length = cpu_to_be16(t);
*xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)hdr); *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)hdr);
...@@ -663,7 +663,7 @@ xfs_dir2_data_log_header( ...@@ -663,7 +663,7 @@ xfs_dir2_data_log_header(
hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
#endif #endif
xfs_trans_log_buf(tp, bp, 0, dp->d_ops->data_entry_offset() - 1); xfs_trans_log_buf(tp, bp, 0, dp->d_ops->data_entry_offset - 1);
} }
/* /*
...@@ -742,7 +742,7 @@ xfs_dir2_data_make_free( ...@@ -742,7 +742,7 @@ xfs_dir2_data_make_free(
* If this isn't the start of the block, then back up to * If this isn't the start of the block, then back up to
* the previous entry and see if it's free. * the previous entry and see if it's free.
*/ */
if (offset > dp->d_ops->data_entry_offset()) { if (offset > dp->d_ops->data_entry_offset) {
__be16 *tagp; /* tag just before us */ __be16 *tagp; /* tag just before us */
tagp = (__be16 *)((char *)hdr + offset) - 1; tagp = (__be16 *)((char *)hdr + offset) - 1;
......
...@@ -1116,7 +1116,7 @@ xfs_dir3_leaf_log_header( ...@@ -1116,7 +1116,7 @@ xfs_dir3_leaf_log_header(
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC));
xfs_trans_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf), xfs_trans_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf),
dp->d_ops->leaf_hdr_size() - 1); dp->d_ops->leaf_hdr_size - 1);
} }
/* /*
...@@ -1424,7 +1424,7 @@ xfs_dir2_leaf_removename( ...@@ -1424,7 +1424,7 @@ xfs_dir2_leaf_removename(
* If the data block is now empty then get rid of the data block. * If the data block is now empty then get rid of the data block.
*/ */
if (be16_to_cpu(bf[0].length) == if (be16_to_cpu(bf[0].length) ==
mp->m_dirblksize - dp->d_ops->data_entry_offset()) { mp->m_dirblksize - dp->d_ops->data_entry_offset) {
ASSERT(db != mp->m_dirdatablk); ASSERT(db != mp->m_dirdatablk);
if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { if ((error = xfs_dir2_shrink_inode(args, db, dbp))) {
/* /*
...@@ -1623,7 +1623,7 @@ xfs_dir2_leaf_trim_data( ...@@ -1623,7 +1623,7 @@ xfs_dir2_leaf_trim_data(
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC));
ASSERT(be16_to_cpu(bf[0].length) == ASSERT(be16_to_cpu(bf[0].length) ==
mp->m_dirblksize - dp->d_ops->data_entry_offset()); mp->m_dirblksize - dp->d_ops->data_entry_offset);
ASSERT(db == be32_to_cpu(ltp->bestcount) - 1); ASSERT(db == be32_to_cpu(ltp->bestcount) - 1);
} }
#endif #endif
......
...@@ -274,7 +274,7 @@ xfs_dir2_free_log_header( ...@@ -274,7 +274,7 @@ xfs_dir2_free_log_header(
ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
#endif #endif
xfs_trans_log_buf(tp, bp, 0, dp->d_ops->free_hdr_size() - 1); xfs_trans_log_buf(tp, bp, 0, dp->d_ops->free_hdr_size - 1);
} }
/* /*
...@@ -1268,7 +1268,7 @@ xfs_dir2_leafn_remove( ...@@ -1268,7 +1268,7 @@ xfs_dir2_leafn_remove(
* (usually). * (usually).
*/ */
if (longest == mp->m_dirblksize - if (longest == mp->m_dirblksize -
dp->d_ops->data_entry_offset()) { dp->d_ops->data_entry_offset) {
/* /*
* Try to punch out the data block. * Try to punch out the data block.
*/ */
...@@ -1300,7 +1300,7 @@ xfs_dir2_leafn_remove( ...@@ -1300,7 +1300,7 @@ xfs_dir2_leafn_remove(
* Return indication of whether this leaf block is empty enough * Return indication of whether this leaf block is empty enough
* to justify trying to join it with a neighbor. * to justify trying to join it with a neighbor.
*/ */
*rval = (dp->d_ops->leaf_hdr_size() + *rval = (dp->d_ops->leaf_hdr_size +
(uint)sizeof(ents[0]) * (leafhdr.count - leafhdr.stale)) < (uint)sizeof(ents[0]) * (leafhdr.count - leafhdr.stale)) <
mp->m_dir_magicpct; mp->m_dir_magicpct;
return 0; return 0;
...@@ -1409,7 +1409,7 @@ xfs_dir2_leafn_toosmall( ...@@ -1409,7 +1409,7 @@ xfs_dir2_leafn_toosmall(
xfs_dir3_leaf_check(dp, blk->bp); xfs_dir3_leaf_check(dp, blk->bp);
count = leafhdr.count - leafhdr.stale; count = leafhdr.count - leafhdr.stale;
bytes = dp->d_ops->leaf_hdr_size() + count * sizeof(ents[0]); bytes = dp->d_ops->leaf_hdr_size + count * sizeof(ents[0]);
if (bytes > (state->blocksize >> 1)) { if (bytes > (state->blocksize >> 1)) {
/* /*
* Blk over 50%, don't try to join. * Blk over 50%, don't try to join.
......
...@@ -119,9 +119,9 @@ xfs_dir2_sf_getdents( ...@@ -119,9 +119,9 @@ xfs_dir2_sf_getdents(
* mp->m_dirdatablk. * mp->m_dirdatablk.
*/ */
dot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, dot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
dp->d_ops->data_dot_offset()); dp->d_ops->data_dot_offset);
dotdot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, dotdot_offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
dp->d_ops->data_dotdot_offset()); dp->d_ops->data_dotdot_offset);
/* /*
* Put . entry unless we're starting past it. * Put . entry unless we're starting past it.
...@@ -584,7 +584,7 @@ xfs_dir2_leaf_getdents( ...@@ -584,7 +584,7 @@ xfs_dir2_leaf_getdents(
* Skip past the header. * Skip past the header.
*/ */
if (byteoff == 0) if (byteoff == 0)
curoff += dp->d_ops->data_entry_offset(); curoff += dp->d_ops->data_entry_offset;
/* /*
* Skip past entries until we reach our offset. * Skip past entries until we reach our offset.
*/ */
......
...@@ -473,7 +473,7 @@ xfs_dir2_sf_addname_hard( ...@@ -473,7 +473,7 @@ xfs_dir2_sf_addname_hard(
* to insert the new entry. * to insert the new entry.
* If it's going to end up at the end then oldsfep will point there. * If it's going to end up at the end then oldsfep will point there.
*/ */
for (offset = dp->d_ops->data_first_offset(), for (offset = dp->d_ops->data_first_offset,
oldsfep = xfs_dir2_sf_firstentry(oldsfp), oldsfep = xfs_dir2_sf_firstentry(oldsfp),
add_datasize = dp->d_ops->data_entsize(args->namelen), add_datasize = dp->d_ops->data_entsize(args->namelen),
eof = (char *)oldsfep == &buf[old_isize]; eof = (char *)oldsfep == &buf[old_isize];
...@@ -556,7 +556,7 @@ xfs_dir2_sf_addname_pick( ...@@ -556,7 +556,7 @@ xfs_dir2_sf_addname_pick(
sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
size = dp->d_ops->data_entsize(args->namelen); size = dp->d_ops->data_entsize(args->namelen);
offset = dp->d_ops->data_first_offset(); offset = dp->d_ops->data_first_offset;
sfep = xfs_dir2_sf_firstentry(sfp); sfep = xfs_dir2_sf_firstentry(sfp);
holefit = 0; holefit = 0;
/* /*
...@@ -629,7 +629,7 @@ xfs_dir2_sf_check( ...@@ -629,7 +629,7 @@ xfs_dir2_sf_check(
mp = dp->i_mount; mp = dp->i_mount;
sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
offset = dp->d_ops->data_first_offset(); offset = dp->d_ops->data_first_offset;
ino = dp->d_ops->sf_get_parent_ino(sfp); ino = dp->d_ops->sf_get_parent_ino(sfp);
i8count = ino > XFS_DIR2_MAX_SHORT_INUM; i8count = ino > XFS_DIR2_MAX_SHORT_INUM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment