]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: xfs_bmap_finish_one should map unwritten extents properly
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:01:13 +0000 (10:01 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:41 +0000 (11:37 -0700)
Source kernel commit: 6c8127e93e3ac9c2cf6a13b885dd2d057b7e7d50

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>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
libxfs/xfs_bmap.c

index f09ec3dfe0c9080e8a3673e41a79caef535d9efa..70476c54927aa0f51490c65a1ab2874432cc1b2b 100644 (file)
@@ -6239,6 +6239,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);