if (count >= SWAP_MAP_MAX)
return count;
-@@ -283,28 +295,39 @@ static int swap_entry_free(struct swap_i
+@@ -283,28 +296,40 @@ static int swap_entry_free(struct swap_i
if (count)
return count;
- swap_list.next = p - swap_info;
- nr_swap_pages++;
- p->inuse_pages--;
-+ if (!p->swap_remap) {
++ if (p->swap_remap) {
++ spin_lock(&p->remap_lock);
++ swap_entry_update(p, offset);
++ }
++ else {
+ swap_entry_update(p, offset);
+ if (disk->fops->swap_slot_free_notify)
+ disk->fops->swap_slot_free_notify(p->bdev, offset);
+ return 0;
+ }
-+
-+ spin_lock(&p->remap_lock);
-+ swap_entry_update(p, offset);
/* Re-map the page number */
old = p->swap_remap[offset] & 0x7FFFFFFF;