On 11/6/16 4:02 PM, Dave Chinner wrote: > On Fri, Nov 04, 2016 at 09:27:18PM -0500, Eric Sandeen wrote: >> The open-coded pattern: >> >> ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t) >> >> is all over the xfs code; provide a new helper >> xfs_iext_count(ifp) to count the number of inline extents >> in an inode fork. > .... >> diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c >> index 5dd56d3..a9e4904 100644 >> --- a/fs/xfs/libxfs/xfs_inode_fork.c >> +++ b/fs/xfs/libxfs/xfs_inode_fork.c >> @@ -775,6 +775,16 @@ >> } >> } >> >> +/* Count number of inline extents based on if_bytes */ >> +xfs_extnum_t >> +xfs_iext_count(struct xfs_ifork *ifp) >> +{ >> + xfs_extnum_t nextents; >> + >> + nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); >> + return nextents; >> +} > > Why not just "return ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);"? No real reason -I started that way and for some reason it seemed more cryptic and less self-documenting, but can't put my finger on why. ;) Happy to send V2 if that's what's preferred. -Eric > Otherwise looks good - a needed cleanup. > > Cheers, > > Dave. > -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html