]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xfs: also call xfs_file_iomap_end_delalloc for zeroing operations
authorChristoph Hellwig <hch@lst.de>
Sat, 19 Oct 2019 16:09:42 +0000 (09:09 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 21 Oct 2019 16:04:58 +0000 (09:04 -0700)
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>
fs/xfs/xfs_iomap.c

index 95719e161286c74a4552c60bc7a1353eb2115173..f1d32bcf48bdfed99edb71064f3c4cc5a8751b8d 100644 (file)
@@ -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;