diff options
Diffstat (limited to 'kernel/power/swap.c')
-rw-r--r-- | kernel/power/swap.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 1b08f46bbb7e..aa5a9bff01f1 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -161,13 +161,14 @@ static int mark_swapfiles(sector_t start) | |||
161 | { | 161 | { |
162 | int error; | 162 | int error; |
163 | 163 | ||
164 | bio_read_page(0, &swsusp_header, NULL); | 164 | bio_read_page(swsusp_resume_block, &swsusp_header, NULL); |
165 | if (!memcmp("SWAP-SPACE",swsusp_header.sig, 10) || | 165 | if (!memcmp("SWAP-SPACE",swsusp_header.sig, 10) || |
166 | !memcmp("SWAPSPACE2",swsusp_header.sig, 10)) { | 166 | !memcmp("SWAPSPACE2",swsusp_header.sig, 10)) { |
167 | memcpy(swsusp_header.orig_sig,swsusp_header.sig, 10); | 167 | memcpy(swsusp_header.orig_sig,swsusp_header.sig, 10); |
168 | memcpy(swsusp_header.sig,SWSUSP_SIG, 10); | 168 | memcpy(swsusp_header.sig,SWSUSP_SIG, 10); |
169 | swsusp_header.image = start; | 169 | swsusp_header.image = start; |
170 | error = bio_write_page(0, &swsusp_header, NULL); | 170 | error = bio_write_page(swsusp_resume_block, |
171 | &swsusp_header, NULL); | ||
171 | } else { | 172 | } else { |
172 | printk(KERN_ERR "swsusp: Swap header not found!\n"); | 173 | printk(KERN_ERR "swsusp: Swap header not found!\n"); |
173 | error = -ENODEV; | 174 | error = -ENODEV; |
@@ -184,7 +185,7 @@ static int swsusp_swap_check(void) /* This is called before saving image */ | |||
184 | { | 185 | { |
185 | int res; | 186 | int res; |
186 | 187 | ||
187 | res = swap_type_of(swsusp_resume_device, 0); | 188 | res = swap_type_of(swsusp_resume_device, swsusp_resume_block); |
188 | if (res < 0) | 189 | if (res < 0) |
189 | return res; | 190 | return res; |
190 | 191 | ||
@@ -610,12 +611,16 @@ int swsusp_check(void) | |||
610 | if (!IS_ERR(resume_bdev)) { | 611 | if (!IS_ERR(resume_bdev)) { |
611 | set_blocksize(resume_bdev, PAGE_SIZE); | 612 | set_blocksize(resume_bdev, PAGE_SIZE); |
612 | memset(&swsusp_header, 0, sizeof(swsusp_header)); | 613 | memset(&swsusp_header, 0, sizeof(swsusp_header)); |
613 | if ((error = bio_read_page(0, &swsusp_header, NULL))) | 614 | error = bio_read_page(swsusp_resume_block, |
615 | &swsusp_header, NULL); | ||
616 | if (error) | ||
614 | return error; | 617 | return error; |
618 | |||
615 | if (!memcmp(SWSUSP_SIG, swsusp_header.sig, 10)) { | 619 | if (!memcmp(SWSUSP_SIG, swsusp_header.sig, 10)) { |
616 | memcpy(swsusp_header.sig, swsusp_header.orig_sig, 10); | 620 | memcpy(swsusp_header.sig, swsusp_header.orig_sig, 10); |
617 | /* Reset swap signature now */ | 621 | /* Reset swap signature now */ |
618 | error = bio_write_page(0, &swsusp_header, NULL); | 622 | error = bio_write_page(swsusp_resume_block, |
623 | &swsusp_header, NULL); | ||
619 | } else { | 624 | } else { |
620 | return -EINVAL; | 625 | return -EINVAL; |
621 | } | 626 | } |