xfs: don't do delayed allocations for uncached buffered writes buffered-uncached
authorJens Axboe <axboe@kernel.dk>
Tue, 17 Dec 2019 14:30:04 +0000 (07:30 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 31 Jan 2020 22:44:11 +0000 (15:44 -0700)
This data is going to be written immediately, so don't bother trying
to do delayed allocation for it.

Suggested-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/xfs/xfs_iomap.c

index bb590a267a7f92a2a8ebf43592fd9aec4ca3e81f..1916240e2d05cd0fcfe0d1268288b0e1e9f85875 100644 (file)
@@ -847,8 +847,11 @@ xfs_buffered_write_iomap_begin(
        int                     allocfork = XFS_DATA_FORK;
        int                     error = 0;
 
-       /* we can't use delayed allocations when using extent size hints */
-       if (xfs_get_extsz_hint(ip))
+       /*
+        * Don't do delayed allocations when using extent size hints, or
+        * if we were asked to do uncached buffered writes.
+        */
+       if (xfs_get_extsz_hint(ip) || (flags & IOMAP_UNCACHED))
                return xfs_direct_write_iomap_begin(inode, offset, count,
                                flags, iomap, srcmap);