diff options
Diffstat (limited to 'kernel/power/swsusp.c')
| -rw-r--r-- | kernel/power/swsusp.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 55a18d26abed..2d9d08f72f76 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
| @@ -70,12 +70,12 @@ | |||
| 70 | #include "power.h" | 70 | #include "power.h" |
| 71 | 71 | ||
| 72 | /* | 72 | /* |
| 73 | * Preferred image size in MB (tunable via /sys/power/image_size). | 73 | * Preferred image size in bytes (tunable via /sys/power/image_size). |
| 74 | * When it is set to N, swsusp will do its best to ensure the image | 74 | * When it is set to N, swsusp will do its best to ensure the image |
| 75 | * size will not exceed N MB, but if that is impossible, it will | 75 | * size will not exceed N bytes, but if that is impossible, it will |
| 76 | * try to create the smallest image possible. | 76 | * try to create the smallest image possible. |
| 77 | */ | 77 | */ |
| 78 | unsigned int image_size = 500; | 78 | unsigned long image_size = 500 * 1024 * 1024; |
| 79 | 79 | ||
| 80 | #ifdef CONFIG_HIGHMEM | 80 | #ifdef CONFIG_HIGHMEM |
| 81 | unsigned int count_highmem_pages(void); | 81 | unsigned int count_highmem_pages(void); |
| @@ -153,13 +153,11 @@ static int swsusp_swap_check(void) /* This is called before saving image */ | |||
| 153 | { | 153 | { |
| 154 | int i; | 154 | int i; |
| 155 | 155 | ||
| 156 | if (!swsusp_resume_device) | ||
| 157 | return -ENODEV; | ||
| 158 | spin_lock(&swap_lock); | 156 | spin_lock(&swap_lock); |
| 159 | for (i = 0; i < MAX_SWAPFILES; i++) { | 157 | for (i = 0; i < MAX_SWAPFILES; i++) { |
| 160 | if (!(swap_info[i].flags & SWP_WRITEOK)) | 158 | if (!(swap_info[i].flags & SWP_WRITEOK)) |
| 161 | continue; | 159 | continue; |
| 162 | if (is_resume_device(swap_info + i)) { | 160 | if (!swsusp_resume_device || is_resume_device(swap_info + i)) { |
| 163 | spin_unlock(&swap_lock); | 161 | spin_unlock(&swap_lock); |
| 164 | root_swap = i; | 162 | root_swap = i; |
| 165 | return 0; | 163 | return 0; |
| @@ -590,7 +588,7 @@ int swsusp_shrink_memory(void) | |||
| 590 | if (!tmp) | 588 | if (!tmp) |
| 591 | return -ENOMEM; | 589 | return -ENOMEM; |
| 592 | pages += tmp; | 590 | pages += tmp; |
| 593 | } else if (size > (image_size * 1024 * 1024) / PAGE_SIZE) { | 591 | } else if (size > image_size / PAGE_SIZE) { |
| 594 | tmp = shrink_all_memory(SHRINK_BITE); | 592 | tmp = shrink_all_memory(SHRINK_BITE); |
| 595 | pages += tmp; | 593 | pages += tmp; |
| 596 | } | 594 | } |
| @@ -743,7 +741,6 @@ static int submit(int rw, pgoff_t page_off, void *page) | |||
| 743 | if (!bio) | 741 | if (!bio) |
| 744 | return -ENOMEM; | 742 | return -ENOMEM; |
| 745 | bio->bi_sector = page_off * (PAGE_SIZE >> 9); | 743 | bio->bi_sector = page_off * (PAGE_SIZE >> 9); |
| 746 | bio_get(bio); | ||
| 747 | bio->bi_bdev = resume_bdev; | 744 | bio->bi_bdev = resume_bdev; |
| 748 | bio->bi_end_io = end_io; | 745 | bio->bi_end_io = end_io; |
| 749 | 746 | ||
| @@ -753,14 +750,13 @@ static int submit(int rw, pgoff_t page_off, void *page) | |||
| 753 | goto Done; | 750 | goto Done; |
| 754 | } | 751 | } |
| 755 | 752 | ||
| 756 | if (rw == WRITE) | ||
| 757 | bio_set_pages_dirty(bio); | ||
| 758 | 753 | ||
| 759 | atomic_set(&io_done, 1); | 754 | atomic_set(&io_done, 1); |
| 760 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); | 755 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); |
| 761 | while (atomic_read(&io_done)) | 756 | while (atomic_read(&io_done)) |
| 762 | yield(); | 757 | yield(); |
| 763 | 758 | if (rw == READ) | |
| 759 | bio_set_pages_dirty(bio); | ||
| 764 | Done: | 760 | Done: |
| 765 | bio_put(bio); | 761 | bio_put(bio); |
| 766 | return error; | 762 | return error; |
