Re: [PATCH 3/8] xfs: convert open-coded xfs_rtword_t pointer accesses to helper

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

 



On Wed, Oct 11, 2023 at 11:07:01AM -0700, Darrick J. Wong wrote:
> +/* Return a pointer to a bitmap word within a rt bitmap block buffer. */
> +static inline xfs_rtword_t *
> +xfs_rbmbuf_wordptr(
> +	void			*buf,
> +	unsigned int		rbmword)
> +{
> +	xfs_rtword_t		*wordp = buf;
> +
> +	return &wordp[rbmword];

Superficial nitpick, I find the array dereference syntax here highly
confusing as the passed in pointer is not an array at all.

In fact I wonder what the xfs_rbmbuf_wordptr helper is for?  Even
looking at your full patch stack xfs_rbmblock_wordptr seems like
the only user.

> +/* Return a pointer to a bitmap word within a rt bitmap block. */
> +static inline xfs_rtword_t *
> +xfs_rbmblock_wordptr(
> +	struct xfs_buf		*bp,
> +	unsigned int		rbmword)
> +{
> +	return xfs_rbmbuf_wordptr(bp->b_addr, rbmword);

So I'd much rather just open code this as:

	xfs_rtword_t		*words = bp->b_addr;

	return words + rbmword;

and if I want to get really fancy I'd maybe rename rbmword to
something like index which feels more readable than rbmword.

That beeing said the xfs_rbmblock_wordptr abstraction is very welcome.



[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