xfs: move the dir2 free header size to struct xfs_da_geometry
authorChristoph Hellwig <hch@lst.de>
Fri, 8 Nov 2019 23:01:29 +0000 (15:01 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 11 Nov 2019 00:54:21 +0000 (16:54 -0800)
Move the free header size towards our structure for dir/attr geometry
parameters.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_da_btree.h
fs/xfs/libxfs/xfs_da_format.c
fs/xfs/libxfs/xfs_dir2.c
fs/xfs/libxfs/xfs_dir2.h
fs/xfs/libxfs/xfs_dir2_node.c

index c6ff5329e92b8ffe3a978646677f43c7ccfb9139..e8f0b7ac051c8d4ba20fd3f4390c5c2a74ca1628 100644 (file)
@@ -29,6 +29,7 @@ struct xfs_da_geometry {
        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 */
+       unsigned int    free_hdr_size;  /* dir2 free header size */
        xfs_dablk_t     freeblk;        /* blockno of free data v2 */
 };
 
index 7263b6d6a1355f36be49f50f60f01ce2d682a26c..1fc8982c830f22da27705a9425e19959d636863a 100644 (file)
@@ -486,7 +486,6 @@ static const struct xfs_dir_ops xfs_dir2_ops = {
        .data_entry_p = xfs_dir2_data_entry_p,
        .data_unused_p = xfs_dir2_data_unused_p,
 
-       .free_hdr_size = sizeof(struct xfs_dir2_free_hdr),
        .free_max_bests = xfs_dir2_free_max_bests,
        .db_to_fdb = xfs_dir2_db_to_fdb,
        .db_to_fdindex = xfs_dir2_db_to_fdindex,
@@ -522,7 +521,6 @@ static const struct xfs_dir_ops xfs_dir2_ftype_ops = {
        .data_entry_p = xfs_dir2_data_entry_p,
        .data_unused_p = xfs_dir2_data_unused_p,
 
-       .free_hdr_size = sizeof(struct xfs_dir2_free_hdr),
        .free_max_bests = xfs_dir2_free_max_bests,
        .db_to_fdb = xfs_dir2_db_to_fdb,
        .db_to_fdindex = xfs_dir2_db_to_fdindex,
@@ -558,7 +556,6 @@ static const struct xfs_dir_ops xfs_dir3_ops = {
        .data_entry_p = xfs_dir3_data_entry_p,
        .data_unused_p = xfs_dir3_data_unused_p,
 
-       .free_hdr_size = sizeof(struct xfs_dir3_free_hdr),
        .free_max_bests = xfs_dir3_free_max_bests,
        .db_to_fdb = xfs_dir3_db_to_fdb,
        .db_to_fdindex = xfs_dir3_db_to_fdindex,
index 8093afb389a1c28bee0b903b50de3ddd450c18f7..eee75ec9707f5a63c96c0ac3e9addd6f1c973483 100644 (file)
@@ -125,9 +125,11 @@ xfs_da_mount(
        if (xfs_sb_version_hascrc(&mp->m_sb)) {
                dageo->node_hdr_size = sizeof(struct xfs_da3_node_hdr);
                dageo->leaf_hdr_size = sizeof(struct xfs_dir3_leaf_hdr);
+               dageo->free_hdr_size = sizeof(struct xfs_dir3_free_hdr);
        } else {
                dageo->node_hdr_size = sizeof(struct xfs_da_node_hdr);
                dageo->leaf_hdr_size = sizeof(struct xfs_dir2_leaf_hdr);
+               dageo->free_hdr_size = sizeof(struct xfs_dir2_free_hdr);
        }
        dageo->leaf_max_ents = (dageo->blksize - dageo->leaf_hdr_size) /
                        sizeof(struct xfs_dir2_leaf_entry);
index 402f00326b642d29bc806729837a559b57b003ea..d87cd71e3cf1879dbe66dfdbda1ded7ede92e728 100644 (file)
@@ -72,7 +72,6 @@ struct xfs_dir_ops {
        struct xfs_dir2_data_unused *
                (*data_unused_p)(struct xfs_dir2_data_hdr *hdr);
 
-       int     free_hdr_size;
        int     (*free_max_bests)(struct xfs_da_geometry *geo);
        xfs_dir2_db_t (*db_to_fdb)(struct xfs_da_geometry *geo,
                                   xfs_dir2_db_t db);
index 78900ba3db712b20e4587e8dab0ba4f3efdca32c..b9d5f4ae9a8d1f970e2ddab5915b779b05e96b82 100644 (file)
@@ -372,7 +372,7 @@ xfs_dir2_free_log_header(
               free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
 #endif
        xfs_trans_log_buf(args->trans, bp, 0,
-                         args->dp->d_ops->free_hdr_size - 1);
+                         args->geo->free_hdr_size - 1);
 }
 
 /*