From: Darrick J. Wong Date: Thu, 22 Feb 2024 20:45:00 +0000 (-0800) Subject: xfs: xfs_bmap_finish_one should map unwritten extents properly X-Git-Tag: v6.9-rc1~129^2~8^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c8127e93e3ac9c2cf6a13b885dd2d057b7e7d50;p=thirdparty%2Flinux.git 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 Reviewed-by: Christoph Hellwig --- diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 8d62fd626be51..d78e02a3b4d62 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);