summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_format.h
diff options
context:
space:
mode:
authorChandan Babu R <chandan.babu@oracle.com>2021-08-09 12:05:22 +0530
committerChandan Babu R <chandan.babu@oracle.com>2022-04-11 04:11:17 +0000
commit95f0b95e2b686ceaa3f465e9fa079f22e0fe7665 (patch)
tree6ad802b3e0cc7f9cccc1d7e051bc7d5c6f003955 /fs/xfs/libxfs/xfs_format.h
parent3b0d9fd369ea48419ccb578e0bafa4c54df63ba6 (diff)
xfs: Define max extent length based on on-disk format definition
The maximum extent length depends on maximum block count that can be stored in a BMBT record. Hence this commit defines MAXEXTLEN based on BMBT_BLOCKCOUNT_BITLEN. While at it, the commit also renames MAXEXTLEN to XFS_MAX_BMBT_EXTLEN. Suggested-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_format.h')
-rw-r--r--fs/xfs/libxfs/xfs_format.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index d75e5b16da7e..66594853a88b 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -870,9 +870,8 @@ enum xfs_dinode_fmt {
{ XFS_DINODE_FMT_UUID, "uuid" }
/*
- * Max values for extlen, extnum, aextnum.
+ * Max values for extnum and aextnum.
*/
-#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
@@ -1603,6 +1602,8 @@ typedef struct xfs_bmdr_block {
#define BMBT_STARTOFF_MASK ((1ULL << BMBT_STARTOFF_BITLEN) - 1)
#define BMBT_BLOCKCOUNT_MASK ((1ULL << BMBT_BLOCKCOUNT_BITLEN) - 1)
+#define XFS_MAX_BMBT_EXTLEN ((xfs_extlen_t)(BMBT_BLOCKCOUNT_MASK))
+
/*
* bmbt records have a file offset (block) field that is 54 bits wide, so this
* is the largest xfs_fileoff_t that we ever expect to see.