Re: [PATCH 2/4] xfs: use accessor functions for bitmap words

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

 



On Wed, Oct 18, 2023 at 06:54:25AM +0200, Christoph Hellwig wrote:
> > +/* Convert an ondisk bitmap word to its incore representation. */
> > +static inline xfs_rtword_t
> > +xfs_rtbitmap_getword(
> > +	struct xfs_buf		*bp,
> > +	unsigned int		index)
> > +{
> > +	union xfs_rtword_raw	*word = xfs_rbmblock_wordptr(bp, index);
> > +
> > +	return word->old;
> > +}
> > +
> > +/* Set an ondisk bitmap word from an incore representation. */
> > +static inline void
> > +xfs_rtbitmap_setword(
> > +	struct xfs_buf		*bp,
> > +	unsigned int		index,
> > +	xfs_rtword_t		value)
> > +{
> > +	union xfs_rtword_raw	*word = xfs_rbmblock_wordptr(bp, index);
> > +
> > +	word->old = value;
> > +}
> 
> Before getting rid of xfs_rbmblock_wordptr I initially did this as:
> 
> 	return xfs_rbmblock_wordptr(bp, index)->old;
> 
> and
> 	xfs_rbmblock_wordptr(bp, index)->old = value;
> 
> which looks a little neater to me.

I set up the function in that (for now) verbose manner to reduce the
diff when the rtgroups patchset redefines the ondisk format to include a
block header (and crcs) and enforces endiannness:

/* Convert an ondisk bitmap word to its incore representation. */
static inline xfs_rtword_t
xfs_rtbitmap_getword(
        struct xfs_buf          *bp,
        unsigned int            index)
{
        union xfs_rtword_raw    *word = xfs_rbmblock_wordptr(bp, index);

        if (xfs_has_rtgroups(bp->b_mount))
                return le32_to_cpu(word->rtg);
        return word->old;
}

So I hope you don't mind if I leave it the way it is now. :)

--D

> Otherwise looks good:
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>



[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