mm: split swap_type_of
authorChristoph Hellwig <hch@lst.de>
Mon, 21 Sep 2020 07:19:56 +0000 (09:19 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 23 Sep 2020 16:43:19 +0000 (10:43 -0600)
commit21bd900572f3708e281ea25f051fc92462eb1193
tree6a35266ebc9c5c5c49d7245861a80f391900934c
parentbb3247a399801ebba20bef101c89e563f5fe7f02
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>
include/linux/swap.h
kernel/power/swap.c
kernel/power/user.c
mm/swapfile.c