Re: [PATCH 14/16] mm, swap: refactor swapoff + add xswap_destroy
From: Youngjun Park
Date: Thu Sep 03 2026 - 03:08:23 EST
On Thu, Aug 27, 2026 at 05:45:04PM +0800, Baoquan He wrote:
> +/* Tear down a file-less xswap device by its swap type. */
> +static int xswap_destroy(int type)
> +{
> + struct swap_info_struct *p;
> +
> + p = swap_type_to_info(type);
> + if (!p)
> + return -EINVAL;
> +
> + spin_lock(&swap_lock);
> + if (!(p->flags & SWP_WRITEOK) || !(p->flags & SWP_XSWAP)) {
> + spin_unlock(&swap_lock);
> + return -EINVAL;
> + }
> + /* Refuse swapoff while the device is pinned for hibernation */
> + if (p->flags & SWP_HIBERNATION) {
> + spin_unlock(&swap_lock);
> + return -EBUSY;
> + }
non-blockfile swap device must not be chosen for Hibernation.
There is no space to hibernate.
Thanks
Youngjun