package/compcache: use mainline modules for kernels >=2.6.33 (thank you nbd)
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-2.6.33 / 040-compcache_swap_notify_core_support.patch
1 --- a/include/linux/blkdev.h
2 +++ b/include/linux/blkdev.h
3 @@ -1301,6 +1301,8 @@ struct block_device_operations {
4 unsigned long long);
5 int (*revalidate_disk) (struct gendisk *);
6 int (*getgeo)(struct block_device *, struct hd_geometry *);
7 + /* this callback is with swap_lock and sometimes page table lock held */
8 + void (*swap_slot_free_notify) (struct block_device *, unsigned long);
9 struct module *owner;
10 };
11
12 --- a/mm/swapfile.c
13 +++ b/mm/swapfile.c
14 @@ -574,6 +574,7 @@ static unsigned char swap_entry_free(struct swap_info_struct *p,
15
16 /* free if no reference */
17 if (!usage) {
18 + struct gendisk *disk = p->bdev->bd_disk;
19 if (offset < p->lowest_bit)
20 p->lowest_bit = offset;
21 if (offset > p->highest_bit)
22 @@ -583,6 +584,8 @@ static unsigned char swap_entry_free(struct swap_info_struct *p,
23 swap_list.next = p->type;
24 nr_swap_pages++;
25 p->inuse_pages--;
26 + if (disk->fops->swap_slot_free_notify)
27 + disk->fops->swap_slot_free_notify(p->bdev, offset);
28 }
29
30 return usage;