xfs: fix xfs_bunmapi to allow unmapping of partial rt extents
authorDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:44:22 +0000 (12:44 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:44:22 +0000 (12:44 -0800)
commit2b6a5ec26887cba195022286b039f2cc0ec683b1
tree79149a9e1fbf6a37a4a4d1eede0be4934025d4f8
parentc75f1a2c154979287ee12c336e2b8c3122832bf7
xfs: fix xfs_bunmapi to allow unmapping of partial rt extents

When XFS_BMAPI_REMAP is passed to bunmapi, that means that we want to
remove part of a block mapping without touching the allocator.  For
realtime files with rtextsize > 1, that also means that we should skip
all the code that changes a partial remove request into an unwritten
extent conversion.  IOWs, bunmapi in this mode should handle removing
the mapping from the rt file and nothing else.

Note that XFS_BMAPI_REMAP callers are required to decrement the
reference count and/or free the space manually.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_bmap.c