Skip to content

Commit 2b6a5ec

Browse files
author
Darrick J. Wong
committed
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>
1 parent c75f1a2 commit 2b6a5ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5459,7 +5459,7 @@ __xfs_bunmapi(
54595459
if (del.br_startoff + del.br_blockcount > end + 1)
54605460
del.br_blockcount = end + 1 - del.br_startoff;
54615461

5462-
if (!isrt)
5462+
if (!isrt || (flags & XFS_BMAPI_REMAP))
54635463
goto delete;
54645464

54655465
mod = xfs_rtb_to_rtxoff(mp,
@@ -5477,7 +5477,7 @@ __xfs_bunmapi(
54775477
* This piece is unwritten, or we're not
54785478
* using unwritten extents. Skip over it.
54795479
*/
5480-
ASSERT(end >= mod);
5480+
ASSERT((flags & XFS_BMAPI_REMAP) || end >= mod);
54815481
end -= mod > del.br_blockcount ?
54825482
del.br_blockcount : mod;
54835483
if (end < got.br_startoff &&

0 commit comments

Comments
 (0)