Re: [PATCH 04/13] xfs: move RT inode locking out of __xfs_bunmapi

Darrick J. Wong
2024-03-27T18:06:01Z

On Wed, Mar 27, 2024 at 06:06:32PM +0100, Christoph Hellwig wrote:
> On Wed, Mar 27, 2024 at 08:07:55AM -0700, Darrick J. Wong wrote:
> > How does it happen that xfs_rtfree_blocks gets called more than once in
> > the same transaction? Is that simply the effect of xfs_bunmapi_range
> > and xfs_unmap_exten calling __xfs_bunmapi with
> > nextents == XFS_ITRUNC_MAX_EXTENTS==2?
>
> Yes.
>
> > What if we simply didn't unmap multiple extents per bunmapi call for
> > realtime files? Would that eliminate the need for
> > XFS_TRANS_RTBITMAP_LOCKED?
>
> Probably. Not that I really want to rock that boat now when we'll
> also have the extent free item / defer ops based path soon.

<nod> I think once we get to the rtgroups patchset then all we have to
do in __xfs_bunmapi is:

if (XFS_IS_REALTIME_INODE(ip) && whichfork == XFS_DATA_FORK &&
!xfs_has_rtgroups(mp))
nexts = 1;

and then the XFS_TRANS_RTBITMAP_LOCKED flag can go away?

If so, then
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D