summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 10:46:55 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-09-17 18:54:57 -0700
commitcdc1e27f8b93d233be0784bcc45a4e2ce4316a02 (patch)
treef41ff66157f97cc3f01395a1089f8d8cc7e877a5
parent00ac8bbc4e562f7f41cd5397acbb222fd75d28cb (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 a36be18585c5..ccf43f95e4c2 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);