Skip to content

Commit 3577da4

Browse files
author
Matthew Wilcox (Oracle)
committed
nfs: Convert to release_folio
Use folios throughout the release_folio paths. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Jeff Layton <jlayton@kernel.org>
1 parent a613b86 commit 3577da4

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

fs/nfs/file.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -415,19 +415,19 @@ static void nfs_invalidate_folio(struct folio *folio, size_t offset,
415415
}
416416

417417
/*
418-
* Attempt to release the private state associated with a page
419-
* - Called if either PG_private or PG_fscache is set on the page
420-
* - Caller holds page lock
421-
* - Return true (may release page) or false (may not)
418+
* Attempt to release the private state associated with a folio
419+
* - Called if either private or fscache flags are set on the folio
420+
* - Caller holds folio lock
421+
* - Return true (may release folio) or false (may not)
422422
*/
423-
static int nfs_release_page(struct page *page, gfp_t gfp)
423+
static bool nfs_release_folio(struct folio *folio, gfp_t gfp)
424424
{
425-
dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
425+
dfprintk(PAGECACHE, "NFS: release_folio(%p)\n", folio);
426426

427-
/* If PagePrivate() is set, then the page is not freeable */
428-
if (PagePrivate(page))
429-
return 0;
430-
return nfs_fscache_release_page(page, gfp);
427+
/* If the private flag is set, then the folio is not freeable */
428+
if (folio_test_private(folio))
429+
return false;
430+
return nfs_fscache_release_folio(folio, gfp);
431431
}
432432

433433
static void nfs_check_dirty_writeback(struct folio *folio,
@@ -522,7 +522,7 @@ const struct address_space_operations nfs_file_aops = {
522522
.write_begin = nfs_write_begin,
523523
.write_end = nfs_write_end,
524524
.invalidate_folio = nfs_invalidate_folio,
525-
.releasepage = nfs_release_page,
525+
.release_folio = nfs_release_folio,
526526
.direct_IO = nfs_direct_IO,
527527
#ifdef CONFIG_MIGRATION
528528
.migratepage = nfs_migrate_page,

fs/nfs/fscache.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ extern void nfs_fscache_release_file(struct inode *, struct file *);
4848
extern int __nfs_fscache_read_page(struct inode *, struct page *);
4949
extern void __nfs_fscache_write_page(struct inode *, struct page *);
5050

51-
static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
51+
static inline bool nfs_fscache_release_folio(struct folio *folio, gfp_t gfp)
5252
{
53-
if (PageFsCache(page)) {
53+
if (folio_test_fscache(folio)) {
5454
if (current_is_kswapd() || !(gfp & __GFP_FS))
5555
return false;
56-
wait_on_page_fscache(page);
57-
fscache_note_page_release(nfs_i_fscache(page->mapping->host));
58-
nfs_inc_fscache_stats(page->mapping->host,
56+
folio_wait_fscache(folio);
57+
fscache_note_page_release(nfs_i_fscache(folio->mapping->host));
58+
nfs_inc_fscache_stats(folio->mapping->host,
5959
NFSIOS_FSCACHE_PAGES_UNCACHED);
6060
}
6161
return true;
@@ -129,9 +129,9 @@ static inline void nfs_fscache_open_file(struct inode *inode,
129129
struct file *filp) {}
130130
static inline void nfs_fscache_release_file(struct inode *inode, struct file *file) {}
131131

132-
static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
132+
static inline bool nfs_fscache_release_folio(struct folio *folio, gfp_t gfp)
133133
{
134-
return 1; /* True: may release page */
134+
return true; /* may release folio */
135135
}
136136
static inline int nfs_fscache_read_page(struct inode *inode, struct page *page)
137137
{

0 commit comments

Comments
 (0)