[PATCH 07/24] mm/swap: move swap_count to header to be shared
From: Kairui Song
Date: Sun Nov 19 2023 - 14:48:47 EST
From: Kairui Song <kasong@xxxxxxxxxxx>
No feature change, prepare for later commits.
Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
---
mm/swap.h | 5 +++++
mm/swapfile.c | 5 -----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/mm/swap.h b/mm/swap.h
index f82d43d7b52a..a9a654af791e 100644
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -61,6 +61,11 @@ static inline unsigned int folio_swap_flags(struct folio *folio)
{
return page_swap_info(&folio->page)->flags;
}
+
+static inline unsigned char swap_count(unsigned char ent)
+{
+ return ent & ~SWAP_HAS_CACHE; /* may include COUNT_CONTINUED flag */
+}
#else /* CONFIG_SWAP */
struct swap_iocb;
static inline void swap_readpage(struct page *page, bool do_poll,
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 0142bfc71b81..a8ae472ed2b6 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -114,11 +114,6 @@ static struct swap_info_struct *swap_type_to_swap_info(int type)
return READ_ONCE(swap_info[type]); /* rcu_dereference() */
}
-static inline unsigned char swap_count(unsigned char ent)
-{
- return ent & ~SWAP_HAS_CACHE; /* may include COUNT_CONTINUED flag */
-}
-
/* Reclaim the swap entry anyway if possible */
#define TTRS_ANYWAY 0x1
/*
--
2.42.0