diff options
| author | Brian Foster <bfoster@redhat.com> | 2025-10-03 09:46:35 -0400 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-11-05 12:57:24 +0100 |
| commit | f8d98072feee32722086ddae4f288b6c45ae4330 (patch) | |
| tree | f9b53d277bb26d496efe4a4aa12ab0620fa2554e /include/linux | |
| parent | 4966b46652680b2d86b8a59319d4f529edf20187 (diff) | |
| download | linux-next-f8d98072feee32722086ddae4f288b6c45ae4330.tar.gz linux-next-f8d98072feee32722086ddae4f288b6c45ae4330.zip | |
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>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/pagemap.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 09b581c1d878..7274a86b4871 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -977,6 +977,8 @@ unsigned filemap_get_folios_contig(struct address_space *mapping, pgoff_t *start, pgoff_t end, struct folio_batch *fbatch); unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, pgoff_t end, xa_mark_t tag, struct folio_batch *fbatch); +unsigned filemap_get_folios_dirty(struct address_space *mapping, + pgoff_t *start, pgoff_t end, struct folio_batch *fbatch); struct folio *read_cache_folio(struct address_space *, pgoff_t index, filler_t *filler, struct file *file); |
