2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/fs/iomap
Jens Axboe 34ecde3c56
iomap: don't lose folio dropbehind state for overwrites
DONTCACHE I/O must have the completion punted to a workqueue, just like
what is done for unwritten extents, as the completion needs task context
to perform the invalidation of the folio(s). However, if writeback is
started off filemap_fdatawrite_range() off generic_sync() and it's an
overwrite, then the DONTCACHE marking gets lost as iomap_add_to_ioend()
don't look at the folio being added and no further state is passed down
to help it know that this is a dropbehind/DONTCACHE write.

Check if the folio being added is marked as dropbehind, and set
IOMAP_IOEND_DONTCACHE if that is the case. Then XFS can factor this into
the decision making of completion context in xfs_submit_ioend().
Additionally include this ioend flag in the NOMERGE flags, to avoid
mixing it with unrelated IO.

Since this is the 3rd flag that will cause XFS to punt the completion to
a workqueue, add a helper so that each one of them can get appropriately
commented.

This fixes extra page cache being instantiated when the write performed
is an overwrite, rather than newly instantiated blocks.

Fixes: b2cd5ae693 ("iomap: make buffered writes work with RWF_DONTCACHE")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/5153f6e8-274d-4546-bf55-30a5018e0d03@kernel.dk
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-05-28 09:26:07 +02:00
..
buffered-io.c iomap: don't lose folio dropbehind state for overwrites 2025-05-28 09:26:07 +02:00
direct-io.c vfs-6.15-rc1.iomap 2025-03-24 10:19:31 -07:00
fiemap.c iomap: introduce a full map advance helper 2025-02-26 09:42:37 +01:00
internal.h iomap: optionally use ioends for direct I/O 2025-02-06 13:02:14 +01:00
ioend.c iomap: add a io_private field to struct iomap_ioend 2025-02-06 13:02:15 +01:00
iter.c iomap: rename iomap_iter processed field to status 2025-02-26 09:42:37 +01:00
Makefile iomap: split bios to zone append limits in the submission handlers 2025-02-06 13:02:14 +01:00
seek.c iomap: rename iomap_iter processed field to status 2025-02-26 09:42:37 +01:00
swapfile.c iomap: introduce a full map advance helper 2025-02-26 09:42:37 +01:00
trace.c iomap: Add DIO tracepoints 2023-04-21 08:54:47 -07:00
trace.h iomap: trace: Add missing flags to [IOMAP_|IOMAP_F_]FLAGS_STRINGS 2025-04-15 10:30:49 +02:00