Skip to content

Commit 9b7d16e

Browse files
author
Chandan Babu R
committed
xfs: Introduce XFS_DIFLAG2_NREXT64 and associated helpers
This commit adds the new per-inode flag XFS_DIFLAG2_NREXT64 to indicate that an inode supports 64-bit extent counters. This flag is also enabled by default on newly created inodes when the corresponding filesystem has large extent counter feature bit (i.e. XFS_FEAT_NREXT64) set. 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>
1 parent 7c05aa9 commit 9b7d16e

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

fs/xfs/libxfs/xfs_format.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,22 +991,31 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev)
991991
#define XFS_DIFLAG2_REFLINK_BIT 1 /* file's blocks may be shared */
992992
#define XFS_DIFLAG2_COWEXTSIZE_BIT 2 /* copy on write extent size hint */
993993
#define XFS_DIFLAG2_BIGTIME_BIT 3 /* big timestamps */
994+
#define XFS_DIFLAG2_NREXT64_BIT 4 /* large extent counters */
994995

995996
#define XFS_DIFLAG2_DAX (1 << XFS_DIFLAG2_DAX_BIT)
996997
#define XFS_DIFLAG2_REFLINK (1 << XFS_DIFLAG2_REFLINK_BIT)
997998
#define XFS_DIFLAG2_COWEXTSIZE (1 << XFS_DIFLAG2_COWEXTSIZE_BIT)
998999
#define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT)
1000+
#define XFS_DIFLAG2_NREXT64 (1 << XFS_DIFLAG2_NREXT64_BIT)
9991001

10001002
#define XFS_DIFLAG2_ANY \
10011003
(XFS_DIFLAG2_DAX | XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE | \
1002-
XFS_DIFLAG2_BIGTIME)
1004+
XFS_DIFLAG2_BIGTIME | XFS_DIFLAG2_NREXT64)
10031005

10041006
static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip)
10051007
{
10061008
return dip->di_version >= 3 &&
10071009
(dip->di_flags2 & cpu_to_be64(XFS_DIFLAG2_BIGTIME));
10081010
}
10091011

1012+
static inline bool xfs_dinode_has_large_extent_counts(
1013+
const struct xfs_dinode *dip)
1014+
{
1015+
return dip->di_version >= 3 &&
1016+
(dip->di_flags2 & cpu_to_be64(XFS_DIFLAG2_NREXT64));
1017+
}
1018+
10101019
/*
10111020
* Inode number format:
10121021
* low inopblog bits - offset in block

fs/xfs/libxfs/xfs_ialloc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,6 +2772,8 @@ xfs_ialloc_setup_geometry(
27722772
igeo->new_diflags2 = 0;
27732773
if (xfs_has_bigtime(mp))
27742774
igeo->new_diflags2 |= XFS_DIFLAG2_BIGTIME;
2775+
if (xfs_has_large_extent_counts(mp))
2776+
igeo->new_diflags2 |= XFS_DIFLAG2_NREXT64;
27752777

27762778
/* Compute inode btree geometry. */
27772779
igeo->agino_log = sbp->sb_inopblog + sbp->sb_agblklog;

fs/xfs/xfs_inode.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
218218
return ip->i_diflags2 & XFS_DIFLAG2_BIGTIME;
219219
}
220220

221+
static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip)
222+
{
223+
return ip->i_diflags2 & XFS_DIFLAG2_NREXT64;
224+
}
225+
221226
/*
222227
* Return the buftarg used for data allocations on a given inode.
223228
*/

fs/xfs/xfs_inode_item_recover.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ xfs_log_dinode_to_disk_ts(
142142
return ts;
143143
}
144144

145+
static inline bool xfs_log_dinode_has_large_extent_counts(
146+
const struct xfs_log_dinode *ld)
147+
{
148+
return ld->di_version >= 3 &&
149+
(ld->di_flags2 & XFS_DIFLAG2_NREXT64);
150+
}
151+
145152
STATIC void
146153
xfs_log_dinode_to_disk(
147154
struct xfs_log_dinode *from,

0 commit comments

Comments
 (0)