]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/swapfile: move scan_swap_map() under CONFIG_HIBERNATION
authorMiaohe Lin <linmiaohe@huawei.com>
Wed, 2 Jun 2021 03:52:11 +0000 (13:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 2 Jun 2021 03:52:11 +0000 (13:52 +1000)
We should move scan_swap_map() under CONFIG_HIBERNATION since the only
caller of this function is get_swap_page_of_type() which is also under
CONFIG_HIBERNATION.  And this fixes the unused-function warning of
scan_swap_map().

Link: https://lkml.kernel.org/r/20210521070855.2015094-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/swapfile.c

index 4e7628b82e6338d7e0cd837938610dfc0cde12ef..53d2161edfc0861dccb4511f8fd58010e6f5a21b 100644 (file)
@@ -1037,21 +1037,6 @@ static void swap_free_cluster(struct swap_info_struct *si, unsigned long idx)
        swap_range_free(si, offset, SWAPFILE_CLUSTER);
 }
 
-static unsigned long scan_swap_map(struct swap_info_struct *si,
-                                  unsigned char usage)
-{
-       swp_entry_t entry;
-       int n_ret;
-
-       n_ret = scan_swap_map_slots(si, usage, 1, &entry);
-
-       if (n_ret)
-               return swp_offset(entry);
-       else
-               return 0;
-
-}
-
 int get_swap_pages(int n_goal, swp_entry_t swp_entries[], int entry_size)
 {
        unsigned long size = swap_entry_size(entry_size);
@@ -1789,6 +1774,21 @@ int free_swap_and_cache(swp_entry_t entry)
 
 #ifdef CONFIG_HIBERNATION
 
+static unsigned long scan_swap_map(struct swap_info_struct *si,
+                                  unsigned char usage)
+{
+       swp_entry_t entry;
+       int n_ret;
+
+       n_ret = scan_swap_map_slots(si, usage, 1, &entry);
+
+       if (n_ret)
+               return swp_offset(entry);
+       else
+               return 0;
+
+}
+
 swp_entry_t get_swap_page_of_type(int type)
 {
        struct swap_info_struct *si = swap_type_to_swap_info(type);