[PATCH] kernel/power/swap.c: print the speed of compressed image instead of uncompressed one

From: Barry Song
Date: Mon Jan 27 2014 - 01:00:55 EST


From: Barry Song <Baohua.Song@xxxxxxx>

For users of hibernation, people care more about the size of the compressed
image than uncompressed one. as embedded guys will try to improve the speed
of SD, NAND and do the best to shrink memory to make the image as less as
possible.
so printing the speed of compressed image is more important and making more
senses here.

Signed-off-by: Barry Song <Baohua.Song@xxxxxxx>
Signed-off-by: Bin Shi <Bin.Shi@xxxxxxx>
---
kernel/power/swap.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 7c33ed2..bcb5c51 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -587,6 +587,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
unsigned char *page = NULL;
struct cmp_data *data = NULL;
struct crc_data *crc = NULL;
+ unsigned int nr_cmp_written = 0;

/*
* We'll limit the number of threads for compression to limit memory
@@ -747,6 +748,8 @@ static int save_image_lzo(struct swap_map_handle *handle,
off += PAGE_SIZE) {
memcpy(page, data[thr].cmp + off, PAGE_SIZE);

+ nr_cmp_written++;
+
ret = swap_write_page(handle, page, &bio);
if (ret)
goto out_finish;
@@ -764,7 +767,11 @@ out_finish:
ret = err2;
if (!ret)
printk(KERN_INFO "PM: Image saving done.\n");
- swsusp_show_speed(&start, &stop, nr_to_write, "Wrote");
+
+ printk(KERN_INFO "PM: Saved %lu Kbytes (uncompressed Image)\n",
+ nr_to_write * (PAGE_SIZE / 1024));
+ swsusp_show_speed(&start, &stop, nr_cmp_written, "Wrote compressed");
+
out_clean:
if (crc) {
if (crc->thr)
--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/