diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-02-22 12:44:22 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-02-22 12:44:22 -0800 |
commit | 2b6a5ec26887cba195022286b039f2cc0ec683b1 (patch) | |
tree | 79149a9e1fbf6a37a4a4d1eede0be4934025d4f8 /fs/xfs/libxfs | |
parent | c75f1a2c154979287ee12c336e2b8c3122832bf7 (diff) | |
download | linux-stable-2b6a5ec26887cba195022286b039f2cc0ec683b1.tar.gz linux-stable-2b6a5ec26887cba195022286b039f2cc0ec683b1.tar.bz2 linux-stable-2b6a5ec26887cba195022286b039f2cc0ec683b1.zip |
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>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index fb99b75f02e2..939947d00bc9 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5459,7 +5459,7 @@ __xfs_bunmapi( if (del.br_startoff + del.br_blockcount > end + 1) del.br_blockcount = end + 1 - del.br_startoff; - if (!isrt) + if (!isrt || (flags & XFS_BMAPI_REMAP)) goto delete; mod = xfs_rtb_to_rtxoff(mp, @@ -5477,7 +5477,7 @@ __xfs_bunmapi( * This piece is unwritten, or we're not * using unwritten extents. Skip over it. */ - ASSERT(end >= mod); + ASSERT((flags & XFS_BMAPI_REMAP) || end >= mod); end -= mod > del.br_blockcount ? del.br_blockcount : mod; if (end < got.br_startoff && |