Re: [PATCH 1/4] xfs: create a helper to handle logging parts of rt bitmap/summary blocks

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

 



On Fri, Oct 20, 2023 at 08:20:23AM +0200, Christoph Hellwig wrote:
> On Thu, Oct 19, 2023 at 09:27:48AM -0700, Darrick J. Wong wrote:
> > +	size_t			first, last;
> > +
> > +	first = (void *)xfs_rsumblock_infoptr(bp, infoword) - bp->b_addr;
> > +	last = first + sizeof(xfs_suminfo_t) - 1;
> 
> > +	size_t			first, last;
> > +
> > +	first = (void *)xfs_rbmblock_wordptr(bp, from) - bp->b_addr;
> > +	last = ((void *)xfs_rbmblock_wordptr(bp, next) - 1) - bp->b_addr;
> > +
> > +	xfs_trans_log_buf(tp, bp, first, last);
> 
> Going to pointers and back looks a bit confusing and rather inefficient
> to me.  But given how late we are in the cycle I don't want to derail
> your series, so let's keep this as-is for now, and I'll add a TODO
> list item to my ever growing list to eventually lean this up.

<nod> I think this function ultimately becomes:

/* Log rtbitmap block from the word @from to the byte before @next. */
static inline void
xfs_trans_log_rtbitmap(
	struct xfs_rtalloc_args	*args,
	unsigned int		from,
	unsigned int		next)
{
	struct xfs_buf		*bp = args->rbmbp;
	size_t			first = from * sizeof(xfs_rtword_t);
	size_t			last = next * sizeof(xfs_rtword_t) - 1;

	if (xfs_has_rtgroup(args->mp)) {
		first += sizeof(struct xfs_rtbuf_blkinfo);
		last += sizeof(struct xfs_rtbuf_blkinfo);
	}

	xfs_trans_log_buf(args->tp, bp, first, last);
}

I'll go play with the compiler to see what asm it generates.

--D



[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