[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:
Rafael J. Wysocki
2007-01-05 16:36:28 -08:00
committed by Linus Torvalds
parent 3223ea8cca
commit 7bf2368742
4 changed files with 17 additions and 9 deletions

View File

@@ -165,14 +165,15 @@ static int swsusp_swap_check(void) /* This is called before saving image */
{
int res;
res = swap_type_of(swsusp_resume_device, swsusp_resume_block);
res = swap_type_of(swsusp_resume_device, swsusp_resume_block,
&resume_bdev);
if (res < 0)
return res;
root_swap = res;
resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_WRITE);
if (IS_ERR(resume_bdev))
return PTR_ERR(resume_bdev);
res = blkdev_get(resume_bdev, FMODE_WRITE, O_RDWR);
if (res)
return res;
res = set_blocksize(resume_bdev, PAGE_SIZE);
if (res < 0)