@@ -34,6 +34,8 @@ int kiocb_invalidate_pages(struct kiocb *iocb, size_t count);
void kiocb_invalidate_post_direct_write(struct kiocb *iocb, size_t count);
int filemap_invalidate_pages(struct address_space *mapping,
loff_t pos, loff_t end, bool nowait);
+int invalidate_complete_folio2(struct address_space *mapping,
+ struct folio *folio, gfp_t gfp_mask);
int write_inode_now(struct inode *, int sync);
int filemap_fdatawrite(struct address_space *);
@@ -546,13 +546,13 @@ EXPORT_SYMBOL(invalidate_mapping_pages);
* shrink_folio_list() has a temp ref on them, or because they're transiently
* sitting in the folio_add_lru() caches.
*/
-static int invalidate_complete_folio2(struct address_space *mapping,
- struct folio *folio)
+int invalidate_complete_folio2(struct address_space *mapping,
+ struct folio *folio, gfp_t gfp_mask)
{
if (folio->mapping != mapping)
return 0;
- if (!filemap_release_folio(folio, GFP_KERNEL))
+ if (!filemap_release_folio(folio, gfp_mask))
return 0;
spin_lock(&mapping->host->i_lock);
@@ -650,7 +650,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
ret2 = folio_launder(mapping, folio);
if (ret2 == 0) {
- if (!invalidate_complete_folio2(mapping, folio))
+ if (!invalidate_complete_folio2(mapping, folio,
+ GFP_KERNEL))
ret2 = -EBUSY;
}
if (ret2 < 0)
Make invalidate_complete_folio2() be publicly available, and have it take a gfp_t mask as well rather than hardcode GFP_KERNEL. The only caller just passes in GFP_KERNEL, no functional changes in this patch. Signed-off-by: Jens Axboe <axboe@kernel.dk> --- include/linux/pagemap.h | 2 ++ mm/truncate.c | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-)