Commit 3e3126cf authored by Jens Axboe's avatar Jens Axboe

mm: only make map_swap_entry available for CONFIG_HIBERNATION

Current tree spews this on compile:

mm/swapfile.c:2290:17: warning: ‘map_swap_entry’ defined but not used [-Wunused-function]
 2290 | static sector_t map_swap_entry(swp_entry_t entry, struct block_device **bdev)
       |                 ^~~~~~~~~~~~~~

if !CONFIG_HIBERNATION, as we don't use the function unless we have that
config option set.

Fixes: 48d15436 ("mm: remove get_swap_bio")
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 48d15436
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
static bool swap_count_continued(struct swap_info_struct *, pgoff_t, static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
unsigned char); unsigned char);
static void free_swap_count_continuations(struct swap_info_struct *); static void free_swap_count_continuations(struct swap_info_struct *);
static sector_t map_swap_entry(swp_entry_t, struct block_device**);
DEFINE_SPINLOCK(swap_lock); DEFINE_SPINLOCK(swap_lock);
static unsigned int nr_swapfiles; static unsigned int nr_swapfiles;
...@@ -1791,6 +1790,9 @@ int free_swap_and_cache(swp_entry_t entry) ...@@ -1791,6 +1790,9 @@ int free_swap_and_cache(swp_entry_t entry)
} }
#ifdef CONFIG_HIBERNATION #ifdef CONFIG_HIBERNATION
static sector_t map_swap_entry(swp_entry_t, struct block_device**);
/* /*
* Find the swap type that corresponds to given device (if any). * Find the swap type that corresponds to given device (if any).
* *
...@@ -2281,6 +2283,7 @@ static void drain_mmlist(void) ...@@ -2281,6 +2283,7 @@ static void drain_mmlist(void)
spin_unlock(&mmlist_lock); spin_unlock(&mmlist_lock);
} }
#ifdef CONFIG_HIBERNATION
/* /*
* Use this swapdev's extent info to locate the (PAGE_SIZE) block which * Use this swapdev's extent info to locate the (PAGE_SIZE) block which
* corresponds to page offset for the specified swap entry. * corresponds to page offset for the specified swap entry.
...@@ -2300,6 +2303,7 @@ static sector_t map_swap_entry(swp_entry_t entry, struct block_device **bdev) ...@@ -2300,6 +2303,7 @@ static sector_t map_swap_entry(swp_entry_t entry, struct block_device **bdev)
se = offset_to_swap_extent(sis, offset); se = offset_to_swap_extent(sis, offset);
return se->start_block + (offset - se->start_page); return se->start_block + (offset - se->start_page);
} }
#endif
/* /*
* Free all of a swapdev's extent information * Free all of a swapdev's extent information
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment