]> Gentwo Git Trees - linux/.git/commit
filemap: add helper to look up dirty folios in a range
authorBrian Foster <bfoster@redhat.com>
Fri, 3 Oct 2025 13:46:35 +0000 (09:46 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 5 Nov 2025 11:57:24 +0000 (12:57 +0100)
commitf8d98072feee32722086ddae4f288b6c45ae4330
treef9b53d277bb26d496efe4a4aa12ab0620fa2554e
parent4966b46652680b2d86b8a59319d4f529edf20187
filemap: add helper to look up dirty folios in a range

Add a new filemap_get_folios_dirty() helper to look up existing dirty
folios in a range and add them to a folio_batch. This is to support
optimization of certain iomap operations that only care about dirty
folios in a target range. For example, zero range only zeroes the subset
of dirty pages over unwritten mappings, seek hole/data may use similar
logic in the future, etc.

Note that the helper is intended for use under internal fs locks.
Therefore it trylocks folios in order to filter out clean folios.
This loosely follows the logic from filemap_range_has_writeback().

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/pagemap.h
mm/filemap.c