mm: call filemap_fdatawrite_range_kick() after IOCB_DONTCACHE issue
authorJens Axboe <axboe@kernel.dk>
Tue, 5 Nov 2024 21:35:11 +0000 (14:35 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 20 Dec 2024 15:30:40 +0000 (08:30 -0700)
When a buffered write submitted with IOCB_DONTCACHE has been successfully
submitted, call filemap_fdatawrite_range_kick() to kick off the IO.
File systems call generic_write_sync() for any successful buffered write
submission, hence add the logic here rather than needing to modify the
file system.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/fs.h

index 653b5efa3d3f80e2546e31191b381b23ccc2d4d3..58a6188535749f1f028e68d2d0f831aaf7fee9fc 100644 (file)
@@ -2912,6 +2912,11 @@ static inline ssize_t generic_write_sync(struct kiocb *iocb, ssize_t count)
                                (iocb->ki_flags & IOCB_SYNC) ? 0 : 1);
                if (ret)
                        return ret;
+       } else if (iocb->ki_flags & IOCB_DONTCACHE) {
+               struct address_space *mapping = iocb->ki_filp->f_mapping;
+
+               filemap_fdatawrite_range_kick(mapping, iocb->ki_pos,
+                                             iocb->ki_pos + count);
        }
 
        return count;