unsigned int    magicpct;       /* 37% of block size in bytes */
        xfs_dablk_t     datablk;        /* blockno of dir data v2 */
        unsigned int    leaf_hdr_size;  /* dir2 leaf header size */
+       unsigned int    leaf_max_ents;  /* # of entries in dir2 leaf */
        xfs_dablk_t     leafblk;        /* blockno of leaf data v2 */
        xfs_dablk_t     freeblk;        /* blockno of free data v2 */
 };
 
 }
 
 
-/*
- * Directory Leaf block operations
- */
-static int
-xfs_dir2_max_leaf_ents(struct xfs_da_geometry *geo)
-{
-       return (geo->blksize - sizeof(struct xfs_dir2_leaf_hdr)) /
-               (uint)sizeof(struct xfs_dir2_leaf_entry);
-}
-
-static int
-xfs_dir3_max_leaf_ents(struct xfs_da_geometry *geo)
-{
-       return (geo->blksize - sizeof(struct xfs_dir3_leaf_hdr)) /
-               (uint)sizeof(struct xfs_dir2_leaf_entry);
-}
-
 /*
  * Directory free space block operations
  */
        .data_entry_p = xfs_dir2_data_entry_p,
        .data_unused_p = xfs_dir2_data_unused_p,
 
-       .leaf_max_ents = xfs_dir2_max_leaf_ents,
-
        .free_hdr_size = sizeof(struct xfs_dir2_free_hdr),
        .free_hdr_to_disk = xfs_dir2_free_hdr_to_disk,
        .free_hdr_from_disk = xfs_dir2_free_hdr_from_disk,
        .data_entry_p = xfs_dir2_data_entry_p,
        .data_unused_p = xfs_dir2_data_unused_p,
 
-       .leaf_max_ents = xfs_dir2_max_leaf_ents,
-
        .free_hdr_size = sizeof(struct xfs_dir2_free_hdr),
        .free_hdr_to_disk = xfs_dir2_free_hdr_to_disk,
        .free_hdr_from_disk = xfs_dir2_free_hdr_from_disk,
        .data_entry_p = xfs_dir3_data_entry_p,
        .data_unused_p = xfs_dir3_data_unused_p,
 
-       .leaf_max_ents = xfs_dir3_max_leaf_ents,
-
        .free_hdr_size = sizeof(struct xfs_dir3_free_hdr),
        .free_hdr_to_disk = xfs_dir3_free_hdr_to_disk,
        .free_hdr_from_disk = xfs_dir3_free_hdr_from_disk,
 
        struct xfs_dir2_leaf            *leaf;
        struct xfs_buf                  *dbp;
        struct xfs_buf                  *bp;
-       const struct xfs_dir_ops        *d_ops = sc->ip->d_ops;
        struct xfs_da_geometry          *geo = sc->mp->m_dir_geo;
        __be16                          *bestp;
        __u16                           best;
        }
 
        /* Is the leaf count even remotely sane? */
-       if (leafhdr.count > d_ops->leaf_max_ents(geo)) {
+       if (leafhdr.count > geo->leaf_max_ents) {
                xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
                goto out;
        }