diff options
author | 2025-03-06 10:59:18 +0100 | |
---|---|---|
committer | 2025-03-06 10:59:18 +0100 | |
commit | 1743d385e704c41ef028697ef44eeab987d5f5a2 (patch) | |
tree | ececf9769480028751a4ae7ceb47c9f633c950b3 | |
parent | Merge patch series "iomap: incremental advance conversion -- phase 2" (diff) | |
parent | Merge patch series "iomap: make buffered writes work with RWF_DONTCACHE" (diff) | |
download | wireguard-linux-1743d385e704c41ef028697ef44eeab987d5f5a2.tar.xz wireguard-linux-1743d385e704c41ef028697ef44eeab987d5f5a2.zip |
Merge branch 'vfs-6.15.shared.iomap' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs
Bring in iomap changes that xfs relies on.
Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r-- | Documentation/filesystems/iomap/design.rst | 5 | ||||
-rw-r--r-- | Documentation/filesystems/iomap/operations.rst | 2 | ||||
-rw-r--r-- | fs/iomap/buffered-io.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 3 | ||||
-rw-r--r-- | include/linux/iomap.h | 1 |
5 files changed, 14 insertions, 1 deletions
diff --git a/Documentation/filesystems/iomap/design.rst b/Documentation/filesystems/iomap/design.rst index 28ab3758c474..e29651a42eec 100644 --- a/Documentation/filesystems/iomap/design.rst +++ b/Documentation/filesystems/iomap/design.rst @@ -356,6 +356,11 @@ operations: ``IOMAP_NOWAIT`` is often set on behalf of ``IOCB_NOWAIT`` or ``RWF_NOWAIT``. + * ``IOMAP_DONTCACHE`` is set when the caller wishes to perform a + buffered file I/O and would like the kernel to drop the pagecache + after the I/O completes, if it isn't already being used by another + thread. + If it is necessary to read existing file contents from a `different <https://lore.kernel.org/all/20191008071527.29304-9-hch@lst.de/>`_ device or address range on a device, the filesystem should return that diff --git a/Documentation/filesystems/iomap/operations.rst b/Documentation/filesystems/iomap/operations.rst index 04fc7a49067d..d1535109587a 100644 --- a/Documentation/filesystems/iomap/operations.rst +++ b/Documentation/filesystems/iomap/operations.rst @@ -131,6 +131,8 @@ These ``struct kiocb`` flags are significant for buffered I/O with iomap: * ``IOCB_NOWAIT``: Turns on ``IOMAP_NOWAIT``. + * ``IOCB_DONTCACHE``: Turns on ``IOMAP_DONTCACHE``. + Internal per-Folio State ------------------------ diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index ea5e32d810d5..d52cfdc299c4 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -594,6 +594,8 @@ struct folio *iomap_get_folio(struct iomap_iter *iter, loff_t pos, size_t len) if (iter->flags & IOMAP_NOWAIT) fgp |= FGP_NOWAIT; + if (iter->flags & IOMAP_DONTCACHE) + fgp |= FGP_DONTCACHE; fgp |= fgf_set_order(len); return __filemap_get_folio(iter->inode->i_mapping, pos >> PAGE_SHIFT, @@ -1019,6 +1021,8 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, if (iocb->ki_flags & IOCB_NOWAIT) iter.flags |= IOMAP_NOWAIT; + if (iocb->ki_flags & IOCB_DONTCACHE) + iter.flags |= IOMAP_DONTCACHE; while ((ret = iomap_iter(&iter, ops)) > 0) iter.status = iomap_write_iter(&iter, i); diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 785f6bbf1406..a81c3e943f20 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1627,7 +1627,8 @@ const struct file_operations xfs_file_operations = { .fadvise = xfs_file_fadvise, .remap_file_range = xfs_file_remap_range, .fop_flags = FOP_MMAP_SYNC | FOP_BUFFER_RASYNC | - FOP_BUFFER_WASYNC | FOP_DIO_PARALLEL_WRITE, + FOP_BUFFER_WASYNC | FOP_DIO_PARALLEL_WRITE | + FOP_DONTCACHE, }; const struct file_operations xfs_dir_file_operations = { diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 1fd66bc29cc1..ea29388b2fba 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -190,6 +190,7 @@ struct iomap_folio_ops { #define IOMAP_DAX 0 #endif /* CONFIG_FS_DAX */ #define IOMAP_ATOMIC (1 << 9) +#define IOMAP_DONTCACHE (1 << 10) struct iomap_ops { /* |