[PATCH v2] mm/swap: Fix swap_cluster_lock() !CONFIG_SWAP stub signature mismatch

From: Hongfu Li

Date: Fri Jul 17 2026 - 03:11:47 EST


From: Hongfu Li <lihongfu@xxxxxxxxxx>

The !CONFIG_SWAP stub for swap_cluster_lock() has mismatched prototype:
it has an extra unused irq argument and uses pgoff_t instead of unsigned
long for offset. All callers are under CONFIG_SWAP so the extra parameter
is dead.

Delete the unused stub function entirely.

Signed-off-by: Hongfu Li <lihongfu@xxxxxxxxxx>
Reviewed-by: Baoquan He <baoquan.he@xxxxxxxxx>
---
v2:
- Drop the stub entirely instead of fixing its signature. All callers are under
CONFIG_SWAP, so the stub is dead code. (Suggested by Kairui Song)
- Add Reviewed-by tag
- Update commit message
---
mm/swap.h | 6 ------
1 file changed, 6 deletions(-)

diff --git a/mm/swap.h b/mm/swap.h
index 77d2d14eda42..d7834888e0d2 100644
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -336,12 +336,6 @@ static inline unsigned int folio_swap_flags(struct folio *folio)

#else /* CONFIG_SWAP */
struct swap_iocb;
-static inline struct swap_cluster_info *swap_cluster_lock(
- struct swap_info_struct *si, pgoff_t offset, bool irq)
-{
- return NULL;
-}
-
static inline struct swap_cluster_info *swap_cluster_get_and_lock(
struct folio *folio)
{
--
2.54.0