From 9ac7538aac047fbcce77c2e90748b88e039360b6 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 5 Jan 2021 17:45:06 -0800 Subject: 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 --- fs/xfs/libxfs/xfs_bmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 271023303fe3..2e3f89b1e961 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -6288,6 +6288,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); -- cgit v1.2.3