Re: [PATCH 7/7] xfs: use shifting and masking when converting rt extents, if possible

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

 



On Thu, Oct 12, 2023 at 07:25:11AM +0200, Christoph Hellwig wrote:
> On Wed, Oct 11, 2023 at 11:06:14AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@xxxxxxxxxx>
> > 
> > Avoid the costs of integer division (32-bit and 64-bit) if the realtime
> > extent size is a power of two.
> 
> Looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> 
> Do you have any data on how common non-power of two rtext sizes are?
> Might it be worth to add unlikely annotations?

I don't really know about the historical uses.  There might be old
filesystems out there with a non-power-of-2 raid stripe size that are
set up for full stripe allocations for speed.

We (oracle) are interested in using rt for PMD allocations on pmem/cxl
devices and atomic writes on scsi/nvme devices.  Both of those cases
will only ever use powers of 2.

I'll add some if-test annotations and we'll see if anyone notices. ;)

--D

> > @@ -11,6 +11,9 @@ xfs_rtx_to_rtb(
> >  	struct xfs_mount	*mp,
> >  	xfs_rtxnum_t		rtx)
> >  {
> > +	if (mp->m_rtxblklog >= 0)
> > +		return rtx << mp->m_rtxblklog;
> > +
> >  	return rtx * mp->m_sb.sb_rextsize;
> 
> i.e.
> 
> 	if (unlikely(mp->m_rtxblklog == ‐1))
> 	  	return rtx * mp->m_sb.sb_rextsize;
> 	return rtx << mp->m_rtxblklog;
> 



[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