In preparation for introducing larger extent count limits, this commit renames existing extent count limits based on their signedness and width. Signed-off-by: Chandan Babu R <chandanrlinux@xxxxxxxxx> --- fs/xfs/libxfs/xfs_bmap.c | 4 ++-- fs/xfs/libxfs/xfs_format.h | 8 ++++---- fs/xfs/libxfs/xfs_inode_buf.c | 4 ++-- fs/xfs/libxfs/xfs_inode_fork.c | 3 ++- fs/xfs/scrub/inode_repair.c | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index f3c9a0ebb0a5..8f262405a5b5 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -76,10 +76,10 @@ xfs_bmap_compute_maxlevels( * available. */ if (whichfork == XFS_DATA_FORK) { - maxleafents = MAXEXTNUM; + maxleafents = XFS_IFORK_EXTCNT_MAXS32; sz = xfs_bmdr_space_calc(MINDBTPTRS); } else { - maxleafents = MAXAEXTNUM; + maxleafents = XFS_IFORK_EXTCNT_MAXS16; sz = xfs_bmdr_space_calc(MINABTPTRS); } maxrootrecs = xfs_bmdr_maxrecs(sz, 0); diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 37cca918d2ba..920e3f9c418f 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -1110,11 +1110,11 @@ enum xfs_dinode_fmt { { XFS_DINODE_FMT_UUID, "uuid" } /* - * Max values for extlen, extnum, aextnum. + * Max values for extlen and disk inode's extent counters. */ -#define MAXEXTLEN ((uint32_t)0x001fffff) /* 21 bits */ -#define MAXEXTNUM ((int32_t)0x7fffffff) /* signed int */ -#define MAXAEXTNUM ((int16_t)0x7fff) /* signed short */ +#define MAXEXTLEN ((uint32_t)0x1fffff) /* 21 bits */ +#define XFS_IFORK_EXTCNT_MAXS32 ((int32_t)0x7fffffff) /* Signed 32-bits */ +#define XFS_IFORK_EXTCNT_MAXS16 ((int16_t)0x7fff) /* Signed 16-bits */ /* * Inode minimum and maximum sizes. diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index 5625df1ddd95..66d13e8fa420 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c @@ -365,9 +365,9 @@ xfs_dinode_verify_fork( break; case XFS_DINODE_FMT_BTREE: if (whichfork == XFS_ATTR_FORK) { - if (di_nextents > MAXAEXTNUM) + if (di_nextents > XFS_IFORK_EXTCNT_MAXS16) return __this_address; - } else if (di_nextents > MAXEXTNUM) { + } else if (di_nextents > XFS_IFORK_EXTCNT_MAXS32) { return __this_address; } break; diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c index 801a6f7dbd0c..6f4b14d3d381 100644 --- a/fs/xfs/libxfs/xfs_inode_fork.c +++ b/fs/xfs/libxfs/xfs_inode_fork.c @@ -736,7 +736,8 @@ xfs_iext_count_may_overflow( if (whichfork == XFS_COW_FORK) return 0; - max_exts = (whichfork == XFS_ATTR_FORK) ? MAXAEXTNUM : MAXEXTNUM; + max_exts = (whichfork == XFS_ATTR_FORK) ? + XFS_IFORK_EXTCNT_MAXS16 : XFS_IFORK_EXTCNT_MAXS32; if (XFS_TEST_ERROR(false, ip->i_mount, XFS_ERRTAG_REDUCE_MAX_IEXTENTS)) max_exts = 10; diff --git a/fs/xfs/scrub/inode_repair.c b/fs/xfs/scrub/inode_repair.c index a80cd633fe59..c44f8d06939b 100644 --- a/fs/xfs/scrub/inode_repair.c +++ b/fs/xfs/scrub/inode_repair.c @@ -1198,7 +1198,7 @@ xrep_inode_blockcounts( return error; if (count >= sc->mp->m_sb.sb_dblocks) return -EFSCORRUPTED; - if (nextents >= MAXAEXTNUM) + if (nextents >= XFS_IFORK_EXTCNT_MAXS16) return -EFSCORRUPTED; ifp->if_nextents = nextents; } else { -- 2.30.2