Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 018bf898 authored by Patrick Daly's avatar Patrick Daly
Browse files

PM / hibernate: Add CONFIG_HIBERNATION_IMAGE_REUSE



By default this hibernation image is erased after either a successful or
unsuccessful hibernation restore sequeunce. Since filesystem contents on
disk are not part of the hibernation image, failure to create a new
hibernation image every boot can lead to filesystem corruption.

Conversely, if the usecase can guarantee that the filesystem is not ever
modified, the same hibernation image can be reused. This prevents
creating additional hibernation images unncesarily.

For more details, refer to the description of CONFIG_HIBERNATION for
booting without resuming.

Change-Id: I4a8d5aba170bbf00f837804c2df26d8d8d682af2
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent f5c48058
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -77,6 +77,23 @@ config HIBERNATION

	  For more information take a look at <file:Documentation/power/swsusp.txt>.

config HIBERNATION_IMAGE_REUSE
	bool "Reuse hibernation image"
	depends on HIBERNATION
	---help---
	  By default this hibernation image is erased after either a
	  successful or unsuccessful hibernation restore sequeunce. Since
	  filesystem contents on disk are not part of the hibernation
	  image, failure to create a new hibernation image every boot can
	  lead to filesystem corruption.

	  Conversely, if the usecase can guarantee that the filesystem is
	  not ever modified, the same hibernation image can be reused. This
	  prevents creating additional hibernation images unncesarily.

	  For more details, refer to the description of CONFIG_HIBERNATION
	  for booting without resuming.

config ARCH_SAVE_PAGE_KEYS
	bool

+2 −0
Original line number Diff line number Diff line
@@ -1542,10 +1542,12 @@ int swsusp_check(void)

		if (!memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) {
			memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
#ifndef CONFIG_HIBERNATION_IMAGE_REUSE
			/* Reset swap signature now */
			error = hib_submit_io(REQ_OP_WRITE, WRITE_SYNC,
						swsusp_resume_block,
						swsusp_header, NULL);
#endif
		} else {
			error = -EINVAL;
		}