On Tue, Mar 01, 2022 at 04:09:24PM +0530, Chandan Babu R wrote: > xfs_extnum_t is the type to use to declare variables which have values > obtained from xfs_dinode->di_[a]nextents. This commit replaces basic > types (e.g. uint32_t) with xfs_extnum_t for such variables. > > Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> > Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx> > --- > fs/xfs/libxfs/xfs_bmap.c | 2 +- > fs/xfs/libxfs/xfs_inode_buf.c | 2 +- > fs/xfs/libxfs/xfs_inode_fork.c | 2 +- > fs/xfs/scrub/inode.c | 2 +- > fs/xfs/xfs_trace.h | 2 +- > 5 files changed, 5 insertions(+), 5 deletions(-) Nice little cleanup. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> Something to think about for a followup - how do we ensure we catch this sort type mismatch in future as it could end up with overflow bugs? > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c > index 703ab9a84530..98541be873d8 100644 > --- a/fs/xfs/libxfs/xfs_bmap.c > +++ b/fs/xfs/libxfs/xfs_bmap.c > @@ -54,7 +54,7 @@ xfs_bmap_compute_maxlevels( > { > int level; /* btree level */ > uint maxblocks; /* max blocks at this level */ > - uint maxleafents; /* max leaf entries possible */ > + xfs_extnum_t maxleafents; /* max leaf entries possible */ > int maxrootrecs; /* max records in root block */ > int minleafrecs; /* min records in leaf block */ > int minnoderecs; /* min records in node block */ > diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c > index e6f9bdc4558f..5c95a5428fc7 100644 > --- a/fs/xfs/libxfs/xfs_inode_buf.c > +++ b/fs/xfs/libxfs/xfs_inode_buf.c > @@ -336,7 +336,7 @@ xfs_dinode_verify_fork( > struct xfs_mount *mp, > int whichfork) > { > - uint32_t di_nextents = XFS_DFORK_NEXTENTS(dip, whichfork); > + xfs_extnum_t di_nextents = XFS_DFORK_NEXTENTS(dip, whichfork); e.g. should we convert macros like this to static inline functions so that we get type checking of the returned value? Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx