aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/power/swap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 3739ecced085..8742fd013a94 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -773,8 +773,7 @@ static int enough_swap(unsigned int nr_pages, unsigned int flags)
773 773
774 pr_debug("PM: Free swap pages: %u\n", free_swap); 774 pr_debug("PM: Free swap pages: %u\n", free_swap);
775 775
776 required = PAGES_FOR_IO + ((flags & SF_NOCOMPRESS_MODE) ? 776 required = PAGES_FOR_IO + nr_pages;
777 nr_pages : (nr_pages * LZO_CMP_PAGES) / LZO_UNC_PAGES + 1);
778 return free_swap > required; 777 return free_swap > required;
779} 778}
780 779
@@ -802,10 +801,12 @@ int swsusp_write(unsigned int flags)
802 printk(KERN_ERR "PM: Cannot get swap writer\n"); 801 printk(KERN_ERR "PM: Cannot get swap writer\n");
803 return error; 802 return error;
804 } 803 }
805 if (!enough_swap(pages, flags)) { 804 if (flags & SF_NOCOMPRESS_MODE) {
806 printk(KERN_ERR "PM: Not enough free swap\n"); 805 if (!enough_swap(pages, flags)) {
807 error = -ENOSPC; 806 printk(KERN_ERR "PM: Not enough free swap\n");
808 goto out_finish; 807 error = -ENOSPC;
808 goto out_finish;
809 }
809 } 810 }
810 memset(&snapshot, 0, sizeof(struct snapshot_handle)); 811 memset(&snapshot, 0, sizeof(struct snapshot_handle));
811 error = snapshot_read_next(&snapshot); 812 error = snapshot_read_next(&snapshot);