On Tue, Nov 28, 2023 at 10:05:06PM -0800, Christoph Hellwig wrote: > On Tue, Nov 28, 2023 at 03:27:40PM -0800, Darrick J. Wong wrote: > > > All these will be 0 if mp->m_sb.sb_rblocks, and rtb is zeroed allocation > > > right above, so calculating the values seems a bit odd. Why not simply: > > > > > > if (mp->m_sb.sb_rblocks) { > > > rtb->rextents = xfs_rtb_to_rtx(mp, mp->m_sb.sb_rblocks); > > > rtb->rextslog = xfs_highbit32(rtb->rextents); > > > > Well... xfs_highbit32 returns -1 if its argument is zero, which is > > possible for the nasty edge case of (say) a 64k block device and a > > realtime extent size of 1MB, which results in rblocks > 0 and > > rextents == 0. > > Eww. How do we even allow creating a mounting that? Such a > configuration doesn't make any sense. $ truncate -s 64k /tmp/realtime $ truncate -s 1g /tmp/data $ mkfs.xfs -f /tmp/data -r rtdev=/tmp/realtime,extsize=1m Pre 4.19 mkfs.xfs would actually write out the fs and pre-4.19 kernels would mount it (and ENOSPC). Since then, due to buggy sb validation code on my part now it just fails verifiers and crashes/doesn't mount. --D