]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/migrate, swap: drop usage of folio_index
authorKairui Song <kasong@tencent.com>
Mon, 6 Oct 2025 20:02:36 +0000 (04:02 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 15 Oct 2025 04:28:32 +0000 (21:28 -0700)
This helper was used when swap cache was mixed with page cache.  Now they
are completely separate from each other, access to the swap cache is all
wrapped by the swap_cache_* helpers, which expect the folio's swap entry
as a parameter.

This helper is no longer used, remove the last redundant user and drop it.

Link: https://lkml.kernel.org/r/20251007-swap-clean-after-swap-table-p1-v1-4-74860ef8ba74@tencent.com
Signed-off-by: Kairui Song <kasong@tencent.com>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Acked-by: Chris Li <chrisl@kernel.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/migrate.c
mm/swap.h

index c0e9f15be2a229798f0492e922b5f1f8f7e5258e..7c5d2efb9d47add9d795a36eec7a6906c1cae705 100644 (file)
@@ -562,7 +562,7 @@ unlock:
 static int __folio_migrate_mapping(struct address_space *mapping,
                struct folio *newfolio, struct folio *folio, int expected_count)
 {
-       XA_STATE(xas, &mapping->i_pages, folio_index(folio));
+       XA_STATE(xas, &mapping->i_pages, folio->index);
        struct swap_cluster_info *ci = NULL;
        struct zone *oldzone, *newzone;
        int dirty;
@@ -715,7 +715,7 @@ EXPORT_SYMBOL(folio_migrate_mapping);
 int migrate_huge_page_move_mapping(struct address_space *mapping,
                                   struct folio *dst, struct folio *src)
 {
-       XA_STATE(xas, &mapping->i_pages, folio_index(src));
+       XA_STATE(xas, &mapping->i_pages, src->index);
        int rc, expected_count = folio_expected_ref_count(src) + 1;
 
        if (folio_ref_count(src) != expected_count)
index 8d8efdf1297a7f7a6adb7fa71f175aeffe5f2984..d034c13d8dd260cea2a1e95010a9df1e3011bfe4 100644 (file)
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -445,25 +445,4 @@ static inline int non_swapcache_batch(swp_entry_t entry, int max_nr)
        return 0;
 }
 #endif /* CONFIG_SWAP */
-
-/**
- * folio_index - File index of a folio.
- * @folio: The folio.
- *
- * For a folio which is either in the page cache or the swap cache,
- * return its index within the address_space it belongs to.  If you know
- * the folio is definitely in the page cache, you can look at the folio's
- * index directly.
- *
- * Return: The index (offset in units of pages) of a folio in its file.
- */
-static inline pgoff_t folio_index(struct folio *folio)
-{
-#ifdef CONFIG_SWAP
-       if (unlikely(folio_test_swapcache(folio)))
-               return swp_offset(folio->swap);
-#endif
-       return folio->index;
-}
-
 #endif /* _MM_SWAP_H */