diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-06-09 15:01:00 +0000 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2008-06-09 15:01:00 +0000 |
commit | d0f2bb44e11295d21807829cc1bc55d8e40f87a4 (patch) | |
tree | f298ac3008a34c9cc6bcd3eb181689159ad3a871 | |
parent | f971f5be2e4e93bb84af9147f1759f2b9226d6c6 (diff) | |
download | suspend-utils-d0f2bb44e11295d21807829cc1bc55d8e40f87a4.tar.gz |
If compression is used and the image is not compressible, we may need to
save more than the image size of data and that should be taken into account
when computing handle.swap_needed in write_image().
-rw-r--r-- | suspend.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -975,6 +975,11 @@ static int write_image(int snapshot_fd, int resume_fd) real_size = image_size; handle.swap_needed = image_size; + if (do_compress) { + /* This is necessary in case the image is not compressible */ + handle.swap_needed += round_up_page_size( + (handle.swap_needed >> 4) + 67); + } if (!enough_swap(&handle)) { fprintf(stderr, "%s: Not enough free swap\n", my_name); error = -ENOSPC; |