The patch titled Subject: pagemap: add filemap_grab_folio() has been added to the -mm mm-unstable branch. Its filename is pagemap-add-filemap_grab_folio.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/pagemap-add-filemap_grab_folio.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Vishal Moola (Oracle)" <vishal.moola@xxxxxxxxx> Subject: pagemap: add filemap_grab_folio() Date: Wed, 4 Jan 2023 13:14:26 -0800 Patch series "Convert to filemap_get_folios_tag()", v5. This patch series replaces find_get_pages_range_tag() with filemap_get_folios_tag(). This also allows the removal of multiple calls to compound_head() throughout. It also makes a good chunk of the straightforward conversions to folios, and takes the opportunity to introduce a function that grabs a folio from the pagecache. This patch (of 23): Add function filemap_grab_folio() to grab a folio from the page cache. This function is meant to serve as a folio replacement for grab_cache_page, and is used to facilitate the removal of find_get_pages_range_tag(). Link: https://lkml.kernel.org/r/20230104211448.4804-1-vishal.moola@xxxxxxxxx Link: https://lkml.kernel.org/r/20230104211448.4804-2-vishal.moola@xxxxxxxxx Signed-off-by: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx> Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/include/linux/pagemap.h~pagemap-add-filemap_grab_folio +++ a/include/linux/pagemap.h @@ -547,6 +547,26 @@ static inline struct folio *filemap_lock } /** + * filemap_grab_folio - grab a folio from the page cache + * @mapping: The address space to search + * @index: The page index + * + * Looks up the page cache entry at @mapping & @index. If no folio is found, + * a new folio is created. The folio is locked, marked as accessed, and + * returned. + * + * Return: A found or created folio. NULL if no folio is found and failed to + * create a folio. + */ +static inline struct folio *filemap_grab_folio(struct address_space *mapping, + pgoff_t index) +{ + return __filemap_get_folio(mapping, index, + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, + mapping_gfp_mask(mapping)); +} + +/** * find_get_page - find and get a page reference * @mapping: the address_space to search * @offset: the page index _ Patches currently in -mm which might be from vishal.moola@xxxxxxxxx are mm-memory-add-vm_normal_folio.patch madvise-convert-madvise_cold_or_pageout_pte_range-to-use-folios.patch mm-damon-convert-damon_pa_mark_accessed_or_deactivate-to-use-folios.patch mm-swap-convert-deactivate_page-to-folio_deactivate.patch ext4-convert-mext_page_double_lock-to-mext_folio_double_lock.patch mm-khugepaged-introduce-release_pte_folio-to-replace-release_pte_page.patch mm-khugepaged-convert-release_pte_pages-to-use-folios.patch pagemap-add-filemap_grab_folio.patch filemap-added-filemap_get_folios_tag.patch filemap-convert-__filemap_fdatawait_range-to-use-filemap_get_folios_tag.patch page-writeback-convert-write_cache_pages-to-use-filemap_get_folios_tag.patch afs-convert-afs_writepages_region-to-use-filemap_get_folios_tag.patch btrfs-convert-btree_write_cache_pages-to-use-filemap_get_folio_tag.patch btrfs-convert-extent_write_cache_pages-to-use-filemap_get_folios_tag.patch ceph-convert-ceph_writepages_start-to-use-filemap_get_folios_tag.patch cifs-convert-wdata_alloc_and_fillpages-to-use-filemap_get_folios_tag.patch ext4-convert-mpage_prepare_extent_to_map-to-use-filemap_get_folios_tag.patch f2fs-convert-f2fs_fsync_node_pages-to-use-filemap_get_folios_tag.patch f2fs-convert-f2fs_flush_inline_data-to-use-filemap_get_folios_tag.patch f2fs-convert-f2fs_sync_node_pages-to-use-filemap_get_folios_tag.patch f2fs-convert-f2fs_write_cache_pages-to-use-filemap_get_folios_tag.patch f2fs-convert-last_fsync_dnode-to-use-filemap_get_folios_tag.patch f2fs-convert-f2fs_sync_meta_pages-to-use-filemap_get_folios_tag.patch gfs2-convert-gfs2_write_cache_jdata-to-use-filemap_get_folios_tag.patch nilfs2-convert-nilfs_lookup_dirty_data_buffers-to-use-filemap_get_folios_tag.patch nilfs2-convert-nilfs_lookup_dirty_node_buffers-to-use-filemap_get_folios_tag.patch nilfs2-convert-nilfs_btree_lookup_dirty_buffers-to-use-filemap_get_folios_tag.patch nilfs2-convert-nilfs_copy_dirty_pages-to-use-filemap_get_folios_tag.patch nilfs2-convert-nilfs_clear_dirty_pages-to-use-filemap_get_folios_tag.patch filemap-remove-find_get_pages_range_tag.patch