diff options
| author | Bojan Smojver <bojan@rexursive.com> | 2010-09-09 17:06:23 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-10-16 19:57:42 -0400 |
| commit | f996fc9671d088bd5f52a70f18c64bfe3d0e418f (patch) | |
| tree | 3d88b5adfa21fc71cbabb9a891d37b0c1ce1c692 /kernel/power/hibernate.c | |
| parent | 05aa55dddb9ee4045c320661068bea78dad6a6e5 (diff) | |
PM / Hibernate: Compress hibernation image with LZO
Compress hibernation image with LZO in order to save on I/O and
therefore time to hibernate/thaw.
[rjw: Added hibernate=nocompress command line option instead of just
nocompress which would be confusing, fixed a couple of compiler
warnings, fixed kerneldoc comments, minor cleanups.]
Signed-off-by: Bojan Smojver <bojan@rexursive.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'kernel/power/hibernate.c')
| -rw-r--r-- | kernel/power/hibernate.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 8dc31e02ae12..6c9c9dc48c75 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include "power.h" | 29 | #include "power.h" |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | static int nocompress = 0; | ||
| 32 | static int noresume = 0; | 33 | static int noresume = 0; |
| 33 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; | 34 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; |
| 34 | dev_t swsusp_resume_device; | 35 | dev_t swsusp_resume_device; |
| @@ -638,6 +639,8 @@ int hibernate(void) | |||
| 638 | 639 | ||
| 639 | if (hibernation_mode == HIBERNATION_PLATFORM) | 640 | if (hibernation_mode == HIBERNATION_PLATFORM) |
| 640 | flags |= SF_PLATFORM_MODE; | 641 | flags |= SF_PLATFORM_MODE; |
| 642 | if (nocompress) | ||
| 643 | flags |= SF_NOCOMPRESS_MODE; | ||
| 641 | pr_debug("PM: writing image.\n"); | 644 | pr_debug("PM: writing image.\n"); |
| 642 | error = swsusp_write(flags); | 645 | error = swsusp_write(flags); |
| 643 | swsusp_free(); | 646 | swsusp_free(); |
| @@ -1004,6 +1007,15 @@ static int __init resume_offset_setup(char *str) | |||
| 1004 | return 1; | 1007 | return 1; |
| 1005 | } | 1008 | } |
| 1006 | 1009 | ||
| 1010 | static int __init hibernate_setup(char *str) | ||
| 1011 | { | ||
| 1012 | if (!strncmp(str, "noresume", 8)) | ||
| 1013 | noresume = 1; | ||
| 1014 | else if (!strncmp(str, "nocompress", 10)) | ||
| 1015 | nocompress = 1; | ||
| 1016 | return 1; | ||
| 1017 | } | ||
| 1018 | |||
| 1007 | static int __init noresume_setup(char *str) | 1019 | static int __init noresume_setup(char *str) |
| 1008 | { | 1020 | { |
| 1009 | noresume = 1; | 1021 | noresume = 1; |
| @@ -1013,3 +1025,4 @@ static int __init noresume_setup(char *str) | |||
| 1013 | __setup("noresume", noresume_setup); | 1025 | __setup("noresume", noresume_setup); |
| 1014 | __setup("resume_offset=", resume_offset_setup); | 1026 | __setup("resume_offset=", resume_offset_setup); |
| 1015 | __setup("resume=", resume_setup); | 1027 | __setup("resume=", resume_setup); |
| 1028 | __setup("hibernate=", hibernate_setup); | ||
