[PATCH] swsusp: Do not fail if resume device is not set
In the kernels later than 2.6.19 there is a regression that makes swsusp fail if the resume device is not explicitly specified. It can be fixed by adding an additional parameter to mm/swapfile.c:swap_type_of() allowing us to pass the (struct block_device *) corresponding to the first available swap back to the caller. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
3223ea8cca
commit
7bf2368742
@@ -434,7 +434,7 @@ void free_swap_and_cache(swp_entry_t entry)
|
||||
*
|
||||
* This is needed for the suspend to disk (aka swsusp).
|
||||
*/
|
||||
int swap_type_of(dev_t device, sector_t offset)
|
||||
int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
|
||||
{
|
||||
struct block_device *bdev = NULL;
|
||||
int i;
|
||||
@@ -450,6 +450,9 @@ int swap_type_of(dev_t device, sector_t offset)
|
||||
continue;
|
||||
|
||||
if (!bdev) {
|
||||
if (bdev_p)
|
||||
*bdev_p = sis->bdev;
|
||||
|
||||
spin_unlock(&swap_lock);
|
||||
return i;
|
||||
}
|
||||
@@ -459,6 +462,9 @@ int swap_type_of(dev_t device, sector_t offset)
|
||||
se = list_entry(sis->extent_list.next,
|
||||
struct swap_extent, list);
|
||||
if (se->start_block == offset) {
|
||||
if (bdev_p)
|
||||
*bdev_p = sis->bdev;
|
||||
|
||||
spin_unlock(&swap_lock);
|
||||
bdput(bdev);
|
||||
return i;
|
||||
|
Reference in New Issue
Block a user