Re: [RFC PATCH v4 6/8] xfs: correct the truncate blocksize of realtime inode

From: Zhang Yi
Date: Mon Jun 03 2024 - 10:35:55 EST


On 2024/5/31 21:36, Christoph Hellwig wrote:
> On Wed, May 29, 2024 at 05:52:04PM +0800, Zhang Yi wrote:
>> + if (xfs_inode_has_bigrtalloc(ip))
>> + first_unmap_block = xfs_rtb_roundup_rtx(mp, first_unmap_block);
>
> Given that first_unmap_block is a xfs_fileoff_t and not a xfs_rtblock_t,
> this looks a bit confusing. I'd suggest to just open code the
> arithmetics in xfs_rtb_roundup_rtx. For future proofing my also
> use xfs_inode_alloc_unitsize() as in the hunk below instead of hard
> coding the rtextsize. I.e.:
>
> first_unmap_block = XFS_B_TO_FSB(mp,
> roundup_64(new_size, xfs_inode_alloc_unitsize(ip)));
>
Sure, makes sense to me.

Thanks,
Yi.