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

Hongfu Li posted 1 patch 1 week ago
mm/swap.h | 6 ------
1 file changed, 6 deletions(-)
[PATCH v2] mm/swap: Fix swap_cluster_lock() !CONFIG_SWAP stub signature mismatch
Posted by Hongfu Li 1 week ago
From: Hongfu Li <lihongfu@kylinos.cn>

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@kylinos.cn>
Reviewed-by: Baoquan He <baoquan.he@linux.dev>
---
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
Re: [PATCH v2] mm/swap: Fix swap_cluster_lock() !CONFIG_SWAP stub signature mismatch
Posted by Kairui Song 1 week ago
On Fri, Jul 17, 2026 at 3:13 PM Hongfu Li <hongfu.li@linux.dev> wrote:
>
> From: Hongfu Li <lihongfu@kylinos.cn>
>
> 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@kylinos.cn>
> Reviewed-by: Baoquan He <baoquan.he@linux.dev>
> ---
> 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
>

Acked-by: Kairui Song <kasong@tencent.com>