diff options
author | Christoph Hellwig <hch@lst.de> | 2020-09-21 09:19:56 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-09-23 10:43:19 -0600 |
commit | 21bd900572f3708e281ea25f051fc92462eb1193 (patch) | |
tree | 6a35266ebc9c5c5c49d7245861a80f391900934c /include/linux/swap.h | |
parent | bb3247a399801ebba20bef101c89e563f5fe7f02 (diff) |
mm: split swap_type_of
swap_type_of is used for two entirely different purposes:
(1) check what swap type a given device/offset corresponds to
(2) find the first available swap device that can be written to
Mixing both in a single function creates an unreadable mess. Create two
separate functions instead, and switch both to pass a dev_t instead of
a struct block_device to further simplify the code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r-- | include/linux/swap.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index 661046994db4..4340a7b6e7a1 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -467,7 +467,8 @@ extern int swapcache_prepare(swp_entry_t); extern void swap_free(swp_entry_t); extern void swapcache_free_entries(swp_entry_t *entries, int n); extern int free_swap_and_cache(swp_entry_t); -extern int swap_type_of(dev_t, sector_t, struct block_device **); +int swap_type_of(dev_t device, sector_t offset); +int find_first_swap(dev_t *device); extern unsigned int count_swap_pages(int, int); extern sector_t map_swap_page(struct page *, struct block_device **); extern sector_t swapdev_block(int, pgoff_t); |