aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index c5431072f422..a2d9bb4e80df 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -434,7 +434,7 @@ void free_swap_and_cache(swp_entry_t entry)
434 * 434 *
435 * This is needed for the suspend to disk (aka swsusp). 435 * This is needed for the suspend to disk (aka swsusp).
436 */ 436 */
437int swap_type_of(dev_t device, sector_t offset) 437int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
438{ 438{
439 struct block_device *bdev = NULL; 439 struct block_device *bdev = NULL;
440 int i; 440 int i;
@@ -450,6 +450,9 @@ int swap_type_of(dev_t device, sector_t offset)
450 continue; 450 continue;
451 451
452 if (!bdev) { 452 if (!bdev) {
453 if (bdev_p)
454 *bdev_p = sis->bdev;
455
453 spin_unlock(&swap_lock); 456 spin_unlock(&swap_lock);
454 return i; 457 return i;
455 } 458 }
@@ -459,6 +462,9 @@ int swap_type_of(dev_t device, sector_t offset)
459 se = list_entry(sis->extent_list.next, 462 se = list_entry(sis->extent_list.next,
460 struct swap_extent, list); 463 struct swap_extent, list);
461 if (se->start_block == offset) { 464 if (se->start_block == offset) {
465 if (bdev_p)
466 *bdev_p = sis->bdev;
467
462 spin_unlock(&swap_lock); 468 spin_unlock(&swap_lock);
463 bdput(bdev); 469 bdput(bdev);
464 return i; 470 return i;
@@ -1357,10 +1363,10 @@ static int swap_show(struct seq_file *swap, void *v)
1357 } 1363 }
1358 1364
1359 file = ptr->swap_file; 1365 file = ptr->swap_file;
1360 len = seq_path(swap, file->f_vfsmnt, file->f_dentry, " \t\n\\"); 1366 len = seq_path(swap, file->f_path.mnt, file->f_path.dentry, " \t\n\\");
1361 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", 1367 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
1362 len < 40 ? 40 - len : 1, " ", 1368 len < 40 ? 40 - len : 1, " ",
1363 S_ISBLK(file->f_dentry->d_inode->i_mode) ? 1369 S_ISBLK(file->f_path.dentry->d_inode->i_mode) ?
1364 "partition" : "file\t", 1370 "partition" : "file\t",
1365 ptr->pages << (PAGE_SHIFT - 10), 1371 ptr->pages << (PAGE_SHIFT - 10),
1366 ptr->inuse_pages << (PAGE_SHIFT - 10), 1372 ptr->inuse_pages << (PAGE_SHIFT - 10),