nfs: Convert to migrate_folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 6 Jun 2022 13:22:19 +0000 (09:22 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 2 Aug 2022 16:34:03 +0000 (12:34 -0400)
Use a folio throughout this function.  migrate_page() will be converted
later.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/nfs/file.c
fs/nfs/internal.h
fs/nfs/write.c

index 2d72b1b..549baed 100644 (file)
@@ -533,9 +533,7 @@ const struct address_space_operations nfs_file_aops = {
        .write_end = nfs_write_end,
        .invalidate_folio = nfs_invalidate_folio,
        .release_folio = nfs_release_folio,
-#ifdef CONFIG_MIGRATION
-       .migratepage = nfs_migrate_page,
-#endif
+       .migrate_folio = nfs_migrate_folio,
        .launder_folio = nfs_launder_folio,
        .is_dirty_writeback = nfs_check_dirty_writeback,
        .error_remove_page = generic_error_remove_page,
index 8f8cd6e..437ebe5 100644 (file)
@@ -578,8 +578,10 @@ void nfs_clear_pnfs_ds_commit_verifiers(struct pnfs_ds_commit_info *cinfo)
 #endif
 
 #ifdef CONFIG_MIGRATION
-extern int nfs_migrate_page(struct address_space *,
-               struct page *, struct page *, enum migrate_mode);
+int nfs_migrate_folio(struct address_space *, struct folio *dst,
+               struct folio *src, enum migrate_mode);
+#else
+#define nfs_migrate_folio NULL
 #endif
 
 static inline int
index 1c70646..649b9e6 100644 (file)
@@ -2119,27 +2119,27 @@ out_error:
 }
 
 #ifdef CONFIG_MIGRATION
-int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
-               struct page *page, enum migrate_mode mode)
+int nfs_migrate_folio(struct address_space *mapping, struct folio *dst,
+               struct folio *src, enum migrate_mode mode)
 {
        /*
-        * If PagePrivate is set, then the page is currently associated with
+        * If the private flag is set, the folio is currently associated with
         * an in-progress read or write request. Don't try to migrate it.
         *
         * FIXME: we could do this in principle, but we'll need a way to ensure
         *        that we can safely release the inode reference while holding
-        *        the page lock.
+        *        the folio lock.
         */
-       if (PagePrivate(page))
+       if (folio_test_private(src))
                return -EBUSY;
 
-       if (PageFsCache(page)) {
+       if (folio_test_fscache(src)) {
                if (mode == MIGRATE_ASYNC)
                        return -EBUSY;
-               wait_on_page_fscache(page);
+               folio_wait_fscache(src);
        }
 
-       return migrate_page(mapping, newpage, page, mode);
+       return migrate_page(mapping, &dst->page, &src->page, mode);
 }
 #endif