[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241108174505.1214230-7-axboe@kernel.dk>
Date: Fri, 8 Nov 2024 10:43:29 -0700
From: Jens Axboe <axboe@...nel.dk>
To: linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org
Cc: hannes@...xchg.org,
clm@...a.com,
linux-kernel@...r.kernel.org,
Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 06/13] mm/truncate: make invalidate_complete_folio2() public
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@...nel.dk>
---
include/linux/pagemap.h | 2 ++
mm/truncate.c | 9 +++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 8afacb7520d4..0122b3fbe2ac 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -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 *);
diff --git a/mm/truncate.c b/mm/truncate.c
index 0668cd340a46..e084f7aa9370 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -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)
--
2.45.2
Powered by blists - more mailing lists