Re: [PATCH 6/8] xfs: use accessor functions for bitmap words

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

 



On Thu, Oct 12, 2023 at 03:11:06PM -0700, Darrick J. Wong wrote:
> Hmm, so you want to go from:
> 
> 	union xfs_rtword_ondisk *start, *end, *b;
> 
> 	start = b = xfs_rbmblock_wordptr(bp, startword);
> 	end = xfs_rbmblock_wordptr(bp, endword);
> 
> 	while (b < end) {
> 		somevalue = xfs_rtbitmap_getword(mp, b);
> 		somevalue |= somemask;
> 		xfs_rtbitmap_setword(mp, b, somevalue);
> 		b++;
> 	}
> 
> 	xfs_trans_log_buf(tp, bp, start - bp->b_addr, b - bp->b_addr);
> 
> to something like:
> 
> 	for (word = startword; word <= endword; word++) {
> 		somevalue = xfs_rtbitmap_getword(mp, b);
> 		somevalue |= somemask;
> 		xfs_rtbitmap_setword(mp, bp, word, somevalue);
> 	}
> 	xfs_rtbitmap_log_buf(tp, bp, startword, endword);

Yes. (although xfs_rtbitmap_log_buf can't just take the words directly
of course, and the xfs_rtbitmap_getword needs word and not the now
not existing b).

> I think that could be done with relatively little churn, though it's
> unfortunate that the second version does 2x(shift + addition) each time
> it goes through the loop instead of the pointer increment that the first
> version does.

I don't really think it matter compared to all the other overhead,
and it keeps a much nicer API.




[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