Re: [PATCH 2/2] xfs: provide helper for counting extents from if_bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);"?

Otherwise looks good - a needed cleanup.

Cheers,

Dave.

-- 
Dave Chinner
david@xxxxxxxxxxxxx
--
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



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux