mm/pagemap: add write_begin_get_folio() helper function
authorTaotao Chen <chentaotao@didiglobal.com>
Wed, 16 Jul 2025 09:36:08 +0000 (09:36 +0000)
committerChristian Brauner <brauner@kernel.org>
Wed, 16 Jul 2025 12:48:18 +0000 (14:48 +0200)
commitb799474b9aeb46ec698874d4de1a799de8b5f64f
tree5dec99eb477cd5ee21c21bb7fae96731a838b0e0
parente9d8e2bf23206825ca9b4d3caf587945ba807939
mm/pagemap: add write_begin_get_folio() helper function

Add write_begin_get_folio() to simplify the common folio lookup logic
used by filesystem ->write_begin() implementations.

This helper wraps __filemap_get_folio() with common flags such as
FGP_WRITEBEGIN, conditional FGP_DONTCACHE, and set folio order based
on the write length.

Part of a series refactoring address_space_operations write_begin and
write_end callbacks to use struct kiocb for passing write context and
flags.

Signed-off-by: Taotao Chen <chentaotao@didiglobal.com>
Link: https://lore.kernel.org/20250716093559.217344-5-chentaotao@didiglobal.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/pagemap.h