}
 
+/*
+ * Only functions with "_nr" suffix are able to free entries spanning
+ * cross multi clusters, so ensure the range is within a single cluster
+ * when freeing entries with functions without "_nr" suffix.
+ */
 static bool swap_entries_put_map_nr(struct swap_info_struct *si,
                                    swp_entry_t entry, int nr)
 {
                partial_free_cluster(si, ci);
 }
 
-static void cluster_swap_free_nr(struct swap_info_struct *si,
-               unsigned long offset, int nr_pages,
-               unsigned char usage)
-{
-       struct swap_cluster_info *ci;
-       unsigned long end = offset + nr_pages;
-
-       ci = lock_cluster(si, offset);
-       do {
-               swap_entry_put_locked(si, ci, swp_entry(si->type, offset),
-                                     usage);
-       } while (++offset < end);
-       unlock_cluster(ci);
-}
-
 /*
  * Caller has made sure that the swap device corresponding to entry
  * is still around or has not been recycled.
 
        while (nr_pages) {
                nr = min_t(int, nr_pages, SWAPFILE_CLUSTER - offset % SWAPFILE_CLUSTER);
-               cluster_swap_free_nr(sis, offset, nr, 1);
+               swap_entries_put_map(sis, swp_entry(sis->type, offset), nr);
                offset += nr;
                nr_pages -= nr;
        }
        return __swap_duplicate(entry, SWAP_HAS_CACHE, nr);
 }
 
+/*
+ * Caller should ensure entries belong to the same folio so
+ * the entries won't span cross cluster boundary.
+ */
 void swapcache_clear(struct swap_info_struct *si, swp_entry_t entry, int nr)
 {
-       unsigned long offset = swp_offset(entry);
-
-       cluster_swap_free_nr(si, offset, nr, SWAP_HAS_CACHE);
+       swap_entries_put_cache(si, entry, nr);
 }
 
 struct swap_info_struct *swp_swap_info(swp_entry_t entry)