diff options
author | Christoph Hellwig <hch@lst.de> | 2011-07-13 13:43:48 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2011-07-13 13:43:48 +0200 |
commit | a00b7745c6e68ee89a123cd81e1dbc52fb55868e (patch) | |
tree | 9a58811ca53f674ca479ef088d1caa7f572ba43d /fs/xfs/xfs_dir2_format.h | |
parent | 5792664070c62479b088e4909000582de3686396 (diff) |
xfs: cleanup struct xfs_dir2_free
Change the bests array to be a proper variable sized entry. This is done
easily as no one relies on the size of the structure. Also change
XFS_DIR2_MAX_FREE_BESTS to an inline function while we're at it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_format.h')
-rw-r--r-- | fs/xfs/xfs_dir2_format.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/xfs/xfs_dir2_format.h b/fs/xfs/xfs_dir2_format.h index c3c4839eebd..07270981f48 100644 --- a/fs/xfs/xfs_dir2_format.h +++ b/fs/xfs/xfs_dir2_format.h @@ -516,13 +516,15 @@ typedef struct xfs_dir2_free_hdr { typedef struct xfs_dir2_free { xfs_dir2_free_hdr_t hdr; /* block header */ - __be16 bests[1]; /* best free counts */ + __be16 bests[]; /* best free counts */ /* unused entries are -1 */ } xfs_dir2_free_t; -#define XFS_DIR2_MAX_FREE_BESTS(mp) \ - (((mp)->m_dirblksize - (uint)sizeof(struct xfs_dir2_free_hdr)) / \ - (uint)sizeof(xfs_dir2_data_off_t)) +static inline int xfs_dir2_free_max_bests(struct xfs_mount *mp) +{ + return (mp->m_dirblksize - sizeof(struct xfs_dir2_free_hdr)) / + sizeof(xfs_dir2_data_off_t); +} /* * Convert data space db to the corresponding free db. @@ -530,7 +532,7 @@ typedef struct xfs_dir2_free { static inline xfs_dir2_db_t xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db) { - return XFS_DIR2_FREE_FIRSTDB(mp) + db / XFS_DIR2_MAX_FREE_BESTS(mp); + return XFS_DIR2_FREE_FIRSTDB(mp) + db / xfs_dir2_free_max_bests(mp); } /* @@ -539,7 +541,7 @@ xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db) static inline int xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db) { - return db % XFS_DIR2_MAX_FREE_BESTS(mp); + return db % xfs_dir2_free_max_bests(mp); } /* |