return NULL;
 }
 
+static void swap_entries_put_cache(struct swap_info_struct *si,
+                                  swp_entry_t entry, int nr)
+{
+       unsigned long offset = swp_offset(entry);
+       struct swap_cluster_info *ci;
+
+       ci = lock_cluster(si, offset);
+       if (swap_only_has_cache(si, offset, nr))
+               swap_entries_free(si, ci, entry, nr);
+       else {
+               for (int i = 0; i < nr; i++, entry.val++)
+                       swap_entry_put_locked(si, ci, entry, SWAP_HAS_CACHE);
+       }
+       unlock_cluster(ci);
+}
+
 static bool swap_entries_put_map(struct swap_info_struct *si,
                                 swp_entry_t entry, int nr)
 {
  */
 void put_swap_folio(struct folio *folio, swp_entry_t entry)
 {
-       unsigned long offset = swp_offset(entry);
-       struct swap_cluster_info *ci;
        struct swap_info_struct *si;
        int size = 1 << swap_entry_order(folio_order(folio));
 
        if (!si)
                return;
 
-       ci = lock_cluster(si, offset);
-       if (swap_only_has_cache(si, offset, size))
-               swap_entries_free(si, ci, entry, size);
-       else {
-               for (int i = 0; i < size; i++, entry.val++)
-                       swap_entry_put_locked(si, ci, entry, SWAP_HAS_CACHE);
-       }
-       unlock_cluster(ci);
+       swap_entries_put_cache(si, entry, size);
 }
 
 int __swap_count(swp_entry_t entry)