]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: xfs_bmap_finish_one should map unwritten extents properly
authorDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:45:00 +0000 (12:45 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:45:00 +0000 (12:45 -0800)
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>
fs/xfs/libxfs/xfs_bmap.c

index 8d62fd626be5178ec5ce845c501467be806c5d9d..d78e02a3b4d62bd82fc8409ebf6caf8bd0f9886c 100644 (file)
@@ -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);