aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 18:26:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 18:26:46 -0400
commitd79df0b1eda0099a22cbcece01ce5e7d222450de (patch)
treeeb9c938fa5faf285fb091d7446508a32229ceea4 /mm/swapfile.c
parent6e80e8ed5eb92d0112674aabe82951266a6a1051 (diff)
parentc8d1a126924fcbc1d61ceb830226e0c7afdcc841 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (577 commits) Staging: ramzswap: Handler for swap slot free callback swap: Add swap slot free callback to block_device_operations swap: Add flag to identify block swap devices Staging: vt6655: use ETH_FRAME_LEN macro instead of custom one Staging: vt6655: use ETH_DATA_LEN macro instead of custom one Staging: vt6655: use ETH_FCS_LEN macro instead of custom one Staging: vt6656: use ETH_HLEN macro instead of custom one Staging: comedi: quatech_daqp_cs.c Replace eos semaphore with a completion. Staging: dt3155v4l: remove private memory allocator Staging: crystalhd: Remove typedefs from driver Staging: winbond: Fix for pointer name format issue in mds.c Staging: vt6656: removed custom UCHAR/USHORT/UINT/ULONG/ULONGLONG typedefs Staging: vt6656: removed custom CHAR/SHORT/INT/LONG typedefs Staging: comedi: Altered the way printk is used in 8255.c staging: iio: adis16350 and similar IMU driver Staging: iio: max1363 Fix two bugs in single_channel_from_ring Staging: iio: adis16220 extract bin_attribute structures from state Staging: iio: adis16220 vibration sensor driver Staging: comedi: Kconfig dependancy fixes Staging: comedi: fix up build error from last Kconfig changes ...
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 eb086e0f4dcc..03aa2d55f1a2 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -577,6 +577,7 @@ static unsigned char swap_entry_free(struct swap_info_struct *p,
577 577
578 /* free if no reference */ 578 /* free if no reference */
579 if (!usage) { 579 if (!usage) {
580 struct gendisk *disk = p->bdev->bd_disk;
580 if (offset < p->lowest_bit) 581 if (offset < p->lowest_bit)
581 p->lowest_bit = offset; 582 p->lowest_bit = offset;
582 if (offset > p->highest_bit) 583 if (offset > p->highest_bit)
@@ -586,6 +587,9 @@ static unsigned char swap_entry_free(struct swap_info_struct *p,
586 swap_list.next = p->type; 587 swap_list.next = p->type;
587 nr_swap_pages++; 588 nr_swap_pages++;
588 p->inuse_pages--; 589 p->inuse_pages--;
590 if ((p->flags & SWP_BLKDEV) &&
591 disk->fops->swap_slot_free_notify)
592 disk->fops->swap_slot_free_notify(p->bdev, offset);
589 } 593 }
590 594
591 return usage; 595 return usage;
@@ -1887,6 +1891,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
1887 if (error < 0) 1891 if (error < 0)
1888 goto bad_swap; 1892 goto bad_swap;
1889 p->bdev = bdev; 1893 p->bdev = bdev;
1894 p->flags |= SWP_BLKDEV;
1890 } else if (S_ISREG(inode->i_mode)) { 1895 } else if (S_ISREG(inode->i_mode)) {
1891 p->bdev = inode->i_sb->s_bdev; 1896 p->bdev = inode->i_sb->s_bdev;
1892 mutex_lock(&inode->i_mutex); 1897 mutex_lock(&inode->i_mutex);