mm/truncate: add folio_unmap_invalidate() helper
authorJens Axboe <axboe@kernel.dk>
Fri, 8 Nov 2024 15:21:09 +0000 (08:21 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 13 Dec 2024 15:18:56 +0000 (08:18 -0700)
commita0741b860e796e2d20f986418cd31a60ade00336
tree326b35caa4c2fe71c65eac5cc370c6ae34739e6b
parent29109abfef4fce0c8d6958d755aae87939fe764e
mm/truncate: add folio_unmap_invalidate() helper

Add a folio_unmap_invalidate() helper, which unmaps and invalidates a
given folio. The caller must already have locked the folio. Embed the
old invalidate_complete_folio2() helper in there as well, as nobody else
calls it.

Use this new helper in invalidate_inode_pages2_range(), rather than
duplicate the code there.

In preparation for using this elsewhere as well, have it take a gfp_t
mask rather than assume GFP_KERNEL is the right choice. This bubbles
back to invalidate_complete_folio2() as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
mm/internal.h
mm/truncate.c