summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-02-22 12:45:00 -0800
committerDarrick J. Wong <djwong@kernel.org>2024-02-22 12:45:00 -0800
commit6c8127e93e3ac9c2cf6a13b885dd2d057b7e7d50 (patch)
tree4508d412726e597da37425a8b1f472c195381fdf /fs/xfs
parent52f807067ba4a122e75bf1e0e0595c78e6a3d8b6 (diff)
downloadlinux-6c8127e93e3ac9c2cf6a13b885dd2d057b7e7d50.tar.gz
linux-6c8127e93e3ac9c2cf6a13b885dd2d057b7e7d50.tar.bz2
linux-6c8127e93e3ac9c2cf6a13b885dd2d057b7e7d50.zip
xfs: xfs_bmap_finish_one should map unwritten extents properly
The deferred bmap work state and the log item can transmit unwritten state, so the XFS_BMAP_MAP handler must map in extents with that unwritten state. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 8d62fd626be5..d78e02a3b4d6 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -6245,6 +6245,8 @@ xfs_bmap_finish_one(
switch (bi->bi_type) {
case XFS_BMAP_MAP:
+ if (bi->bi_bmap.br_state == XFS_EXT_UNWRITTEN)
+ flags |= XFS_BMAPI_PREALLOC;
error = xfs_bmapi_remap(tp, bi->bi_owner, bmap->br_startoff,
bmap->br_blockcount, bmap->br_startblock,
flags);