[-V2,0/5] swap: cleanup get/put_swap_device() usage

Message ID 20230522070905.16773-1-ying.huang@intel.com
Headers
Series swap: cleanup get/put_swap_device() usage |

Message

Huang, Ying May 22, 2023, 7:09 a.m. UTC
  The general rule to use a swap entry is as follows.

When we get a swap entry, if there isn't some other way to prevent
swapoff, such as page lock for swap cache, page table lock, etc., the
swap entry may become invalid because of swapoff.  Then, we need to
enclose all swap related functions with get_swap_device() and
put_swap_device(), unless the swap functions call
get/put_swap_device() by themselves.

Based on the above rule, all get/put_swap_device() usage are checked
and cleaned up if necessary.

Changelogs:

v2:

- Split patch per David's comments.  Thanks!

Best Regards,
Huang, Ying