From 0d45e3a2082225ad8e8b211b7f00ee9bb99ea748 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Sat, 19 Oct 2019 09:09:42 -0700
Subject: [PATCH] xfs: also call xfs_file_iomap_end_delalloc for zeroing
operations
Git-commit: 0d45e3a2082225ad8e8b211b7f00ee9bb99ea748
Patch-mainline: v5.5-rc1
References: bsc#1166144
There is no reason not to punch out stale delalloc blocks for zeroing
operations, as they otherwise behave exactly like normal writes.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Anthony Iliopoulos <ailiopoulos@suse.com>
---
fs/xfs/xfs_iomap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 95719e161286..f1d32bcf48bd 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1145,7 +1145,8 @@ xfs_file_iomap_end(
unsigned flags,
struct iomap *iomap)
{
- if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC)
+ if ((flags & (IOMAP_WRITE | IOMAP_ZERO)) &&
+ iomap->type == IOMAP_DELALLOC)
return xfs_file_iomap_end_delalloc(XFS_I(inode), offset,
length, written, iomap);
return 0;
--
2.16.4