aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 6cd0a8f90dc7..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;
@@ -1884,6 +1888,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
1884 if (error < 0) 1888 if (error < 0)
1885 goto bad_swap; 1889 goto bad_swap;
1886 p->bdev = bdev; 1890 p->bdev = bdev;
1891 p->flags |= SWP_BLKDEV;
1887 } else if (S_ISREG(inode->i_mode)) { 1892 } else if (S_ISREG(inode->i_mode)) {
1888 p->bdev = inode->i_sb->s_bdev; 1893 p->bdev = inode->i_sb->s_bdev;
1889 mutex_lock(&inode->i_mutex); 1894 mutex_lock(&inode->i_mutex);