From 3dba3c0c883e28d96f778c3208e638f56679a554 Mon Sep 17 00:00:00 2001 From: freexperia Date: Wed, 11 Jul 2012 09:33:09 +0300 Subject: [PATCH] msm7x30: swap patch --- include/linux/blkdev.h | 1 + mm/swapfile.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 912b8ff3..1ac81718 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1274,6 +1274,7 @@ struct block_device_operations { unsigned long long); int (*revalidate_disk) (struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); + void (*swap_slot_free_notify) (struct block_device *, unsigned long); struct module *owner; }; diff --git a/mm/swapfile.c b/mm/swapfile.c index 9c590eef..2c82f906 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -577,6 +577,7 @@ static int swap_entry_free(struct swap_info_struct *p, count = p->swap_map[offset]; /* free if no reference */ if (!count) { + struct gendisk *disk = p->bdev->bd_disk; if (offset < p->lowest_bit) p->lowest_bit = offset; if (offset > p->highest_bit) @@ -585,6 +586,9 @@ static int swap_entry_free(struct swap_info_struct *p, swap_list.next = p - swap_info; nr_swap_pages++; p->inuse_pages--; + if (disk->fops->swap_slot_free_notify) + disk->fops->swap_slot_free_notify(p->bdev, + offset); } if (!swap_count(count)) mem_cgroup_uncharge_swap(ent);