From: Darrick J. Wong <djwong@xxxxxxxxxx> Update the ondisk format documentation to discuss the larger maximum extent counts that were added in 2022. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- .../allocation_groups.asciidoc | 4 + .../XFS_Filesystem_Structure/ondisk_inode.asciidoc | 61 ++++++++++++++++++-- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/design/XFS_Filesystem_Structure/allocation_groups.asciidoc b/design/XFS_Filesystem_Structure/allocation_groups.asciidoc index 7ee5d561..c64b4fad 100644 --- a/design/XFS_Filesystem_Structure/allocation_groups.asciidoc +++ b/design/XFS_Filesystem_Structure/allocation_groups.asciidoc @@ -454,6 +454,10 @@ xref:Timestamps[timestamps] for more information. The filesystem is not in operable condition, and must be run through xfs_repair before it can be mounted. +| +XFS_SB_FEAT_INCOMPAT_NREXT64+ | +Large file fork extent counts. This greatly expands the maximum number of +space mappings allowed in data and extended attribute file forks. + |===== *sb_features_log_incompat*:: diff --git a/design/XFS_Filesystem_Structure/ondisk_inode.asciidoc b/design/XFS_Filesystem_Structure/ondisk_inode.asciidoc index 1922954e..34c06487 100644 --- a/design/XFS_Filesystem_Structure/ondisk_inode.asciidoc +++ b/design/XFS_Filesystem_Structure/ondisk_inode.asciidoc @@ -84,14 +84,41 @@ struct xfs_dinode_core { __uint32_t di_nlink; __uint16_t di_projid; __uint16_t di_projid_hi; - __uint8_t di_pad[6]; - __uint16_t di_flushiter; + union { + /* Number of data fork extents if NREXT64 is set */ + __be64 di_big_nextents; + + /* Padding for V3 inodes without NREXT64 set. */ + __be64 di_v3_pad; + + /* Padding and inode flush counter for V2 inodes. */ + struct { + __u8 di_v2_pad[6]; + __be16 di_flushiter; + }; + }; xfs_timestamp_t di_atime; xfs_timestamp_t di_mtime; xfs_timestamp_t di_ctime; xfs_fsize_t di_size; xfs_rfsblock_t di_nblocks; xfs_extlen_t di_extsize; + union { + /* + * For V2 inodes and V3 inodes without NREXT64 set, this + * is the number of data and attr fork extents. + */ + struct { + __be32 di_nextents; + __be16 di_anextents; + } __packed; + + /* Number of attr fork extents if NREXT64 is set. */ + struct { + __be32 di_big_anextents; + __be16 di_nrext64_pad; + } __packed; + } __packed; xfs_extnum_t di_nextents; xfs_aextnum_t di_anextents; __uint8_t di_forkoff; @@ -162,7 +189,7 @@ When the number exceeds 65535, the inode is converted to v2 and the link count is stored in +di_nlink+. *di_uid*:: -Specifies the owner's UID of the inode. +Specifies the owner's UID of the inode. *di_gid*:: Specifies the owner's GID of the inode. @@ -181,10 +208,17 @@ Specifies the high 16 bits of the owner's project ID in v2 inodes, if the +XFS_SB_VERSION2_PROJID32BIT+ feature is set; and zero otherwise. *di_pad[6]*:: -Reserved, must be zero. +Reserved, must be zero. Only exists for v2 inodes. *di_flushiter*:: -Incremented on flush. +Incremented on flush. Only exists for v2 inodes. + +*di_v3_pad*:: +Must be zero for v3 inodes without the NREXT64 flag set. + +*di_big_nextents*:: +Specifies the number of data extents associated with this inode if the NREXT64 +flag is set. This allows for up to 2^48^ - 1 extent mappings. *di_atime*:: @@ -231,10 +265,19 @@ file is written to beyond allocated space, XFS will attempt to allocate additional disk space based on this value. *di_nextents*:: -Specifies the number of data extents associated with this inode. +Specifies the number of data extents associated with this inode if the NREXT64 +flag is not set. Supports up to 2^31^ - 1 extents. *di_anextents*:: -Specifies the number of extended attribute extents associated with this inode. +Specifies the number of extended attribute extents associated with this inode +if the NREXT64 flag is not set. Supports up to 2^15^ - 1 extents. + +*di_big_anextents*:: +Specifies the number of extended attribute extents associated with this inode +if the NREXT64 flag is set. Supports up to 2^32^ - 1 extents. + +*di_nrext64_pad*:: +Must be zero if the NREXT64 flag is set. *di_forkoff*:: Specifies the offset into the inode's literal area where the extended attribute @@ -336,6 +379,10 @@ This inode shares (or has shared) data blocks with another inode. For files, this is the extent size hint for copy on write operations; see +di_cowextsize+ for details. For directories, the value in +di_cowextsize+ will be copied to all newly created files and directories. +| +XFS_DIFLAG2_NREXT64+ | +Files with this flag set may have up to (2^48^ - 1) extents mapped to the data +fork and up to (2^32^ - 1) extents mapped to the attribute fork. This flag +requires the +XFS_SB_FEAT_INCOMPAT_NREXT64+ feature to be enabled. |===== *di_cowextsize*::