diff options
author | Chandan Babu R <chandan.babu@oracle.com> | 2021-11-16 09:54:37 +0000 |
---|---|---|
committer | Chandan Babu R <chandan.babu@oracle.com> | 2022-04-11 04:11:19 +0000 |
commit | df9ad5cc7a524048ea7ff983d6feeb6d8c47a761 (patch) | |
tree | 770a196d7b4b5c9607d81e7f8103676e57f6efc6 /fs/xfs/libxfs/xfs_format.h | |
parent | 0c35e7ba18508e9344a1f27b412924bc8b34eba8 (diff) | |
download | linux-stable-df9ad5cc7a524048ea7ff983d6feeb6d8c47a761.tar.gz linux-stable-df9ad5cc7a524048ea7ff983d6feeb6d8c47a761.tar.bz2 linux-stable-df9ad5cc7a524048ea7ff983d6feeb6d8c47a761.zip |
xfs: Introduce macros to represent new maximum extent counts for data/attr forks
This commit defines new macros to represent maximum extent counts allowed by
filesystems which have support for large per-inode extent counters.
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.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 57b24744a7c2..eb85bc9b229b 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -872,9 +872,29 @@ enum xfs_dinode_fmt { /* * Max values for extnum and aextnum. + * + * The original on-disk extent counts were held in signed fields, resulting in + * maximum extent counts of 2^31 and 2^15 for the data and attr forks + * respectively. Similarly the maximum extent length is limited to 2^21 blocks + * by the 21-bit wide blockcount field of a BMBT extent record. + * + * The newly introduced data fork extent counter can hold a 64-bit value, + * however the maximum number of extents in a file is also limited to 2^54 + * extents by the 54-bit wide startoff field of a BMBT extent record. + * + * It is further limited by the maximum supported file size of 2^63 + * *bytes*. This leads to a maximum extent count for maximally sized filesystem + * blocks (64kB) of: + * + * 2^63 bytes / 2^16 bytes per block = 2^47 blocks + * + * Rounding up 47 to the nearest multiple of bits-per-byte results in 48. Hence + * 2^48 was chosen as the maximum data fork extent count. */ -#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */ -#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */ +#define XFS_MAX_EXTCNT_DATA_FORK_LARGE ((xfs_extnum_t)((1ULL << 48) - 1)) +#define XFS_MAX_EXTCNT_ATTR_FORK_LARGE ((xfs_extnum_t)((1ULL << 32) - 1)) +#define XFS_MAX_EXTCNT_DATA_FORK_SMALL ((xfs_extnum_t)((1ULL << 31) - 1)) +#define XFS_MAX_EXTCNT_ATTR_FORK_SMALL ((xfs_extnum_t)((1ULL << 15) - 1)) /* * Inode minimum and maximum sizes. |