diff options
| -rw-r--r-- | include/linux/blkdev.h | 2 | ||||
| -rw-r--r-- | mm/swapfile.c | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 6690e8bae7bb..413284a51ccc 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -1287,6 +1287,8 @@ struct block_device_operations { | |||
| 1287 | unsigned long long); | 1287 | unsigned long long); |
| 1288 | int (*revalidate_disk) (struct gendisk *); | 1288 | int (*revalidate_disk) (struct gendisk *); |
| 1289 | int (*getgeo)(struct block_device *, struct hd_geometry *); | 1289 | int (*getgeo)(struct block_device *, struct hd_geometry *); |
| 1290 | /* this callback is with swap_lock and sometimes page table lock held */ | ||
| 1291 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); | ||
| 1290 | struct module *owner; | 1292 | struct module *owner; |
| 1291 | }; | 1293 | }; |
| 1292 | 1294 | ||
diff --git a/mm/swapfile.c b/mm/swapfile.c index ecb069e213d0..f5ccc476aa51 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
| @@ -574,6 +574,7 @@ static unsigned char swap_entry_free(struct swap_info_struct *p, | |||
| 574 | 574 | ||
| 575 | /* free if no reference */ | 575 | /* free if no reference */ |
| 576 | if (!usage) { | 576 | if (!usage) { |
| 577 | struct gendisk *disk = p->bdev->bd_disk; | ||
| 577 | if (offset < p->lowest_bit) | 578 | if (offset < p->lowest_bit) |
| 578 | p->lowest_bit = offset; | 579 | p->lowest_bit = offset; |
| 579 | if (offset > p->highest_bit) | 580 | if (offset > p->highest_bit) |
| @@ -583,6 +584,9 @@ static unsigned char swap_entry_free(struct swap_info_struct *p, | |||
| 583 | swap_list.next = p->type; | 584 | swap_list.next = p->type; |
| 584 | nr_swap_pages++; | 585 | nr_swap_pages++; |
| 585 | p->inuse_pages--; | 586 | p->inuse_pages--; |
| 587 | if ((p->flags & SWP_BLKDEV) && | ||
| 588 | disk->fops->swap_slot_free_notify) | ||
| 589 | disk->fops->swap_slot_free_notify(p->bdev, offset); | ||
| 586 | } | 590 | } |
| 587 | 591 | ||
| 588 | return usage; | 592 | return usage; |
