summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-07-14 11:06:39 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-10-14 14:16:49 -0700
commit1e139d476d88f13d97b0d1007c4b21379ef8b26f (patch)
treed2ca667ca6ce140da0ccf2605fc87d7de7ae4dc3
parent3eb3870cf80f9e00fd23a6ba342c42754bc72d93 (diff)
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>
-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 888c698e1ed0..2bec038d3d47 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -6227,6 +6227,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);