for (i = 0; i < nr_swapfiles; i++) {
struct swap_info_struct *q = swap_info[i];
- if (i == type || !q->swap_file)
+ if (q == p || !q->swap_file)
continue;
if (mapping == q->swap_file->f_mapping)
goto bad_swap;
}
}
- error = swap_cgroup_swapon(type, maxpages);
+ error = swap_cgroup_swapon(p->type, maxpages);
if (error)
goto bad_swap;
}
p->next = i;
if (prev < 0)
- swap_list.head = swap_list.next = type;
+ swap_list.head = swap_list.next = p->type;
else
- swap_info[prev]->next = type;
+ swap_info[prev]->next = p->type;
spin_unlock(&swap_lock);
mutex_unlock(&swapon_mutex);
atomic_inc(&proc_poll_event);
blkdev_put(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL);
}
destroy_swap_extents(p);
- swap_cgroup_swapoff(type);
+ swap_cgroup_swapoff(p->type);
bad_swap_2:
spin_lock(&swap_lock);
p->swap_file = NULL;