From 7de8fe2fa8f94985a83120f04d41a93425ea66ba Mon Sep 17 00:00:00 2001 From: Aruna Balakrishnaiah Date: Wed, 11 Sep 2013 10:57:41 -0700 Subject: pstore: Adjust buffer size for compression for smaller registered buffers When backends (ex: efivars) have smaller registered buffers, the big_oops_buf is too big for them as number of repeated occurences in the text captured will be less. What happens is that pstore takes too big a bite from the dmesg log and then finds it cannot compress it enough to meet the backend block size. Patch takes care of adjusting the buffer size based on the registered buffer size. cmpr values have been arrived after doing experiments with plain text for buffers of size 1k - 4k (Smaller the buffer size repeated occurence will be less) and with sample crash log for buffers ranging from 4k - 10k. Reported-by: Seiji Aguchi Tested-by: Seiji Aguchi Signed-off-by: Aruna Balakrishnaiah Signed-off-by: Tony Luck --- fs/pstore/platform.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 4ffb7ab5e39..57b4219398c 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -195,8 +195,29 @@ error: static void allocate_buf_for_compression(void) { size_t size; + size_t cmpr; + + switch (psinfo->bufsize) { + /* buffer range for efivars */ + case 1000 ... 2000: + cmpr = 56; + break; + case 2001 ... 3000: + cmpr = 54; + break; + case 3001 ... 3999: + cmpr = 52; + break; + /* buffer range for nvram, erst */ + case 4000 ... 10000: + cmpr = 45; + break; + default: + cmpr = 60; + break; + } - big_oops_buf_sz = (psinfo->bufsize * 100) / 45; + big_oops_buf_sz = (psinfo->bufsize * 100) / cmpr; big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); if (big_oops_buf) { size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL), -- cgit v1.2.3 From b61edf8e7cf9d8d450b65588b2ff40dfb8c2fd9b Mon Sep 17 00:00:00 2001 From: Aruna Balakrishnaiah Date: Wed, 11 Sep 2013 10:58:03 -0700 Subject: pstore: Use zlib_inflateInit2 instead of zlib_inflateInit Since zlib_deflateInit2() is used for specifying window bit during compression, zlib_inflateInit2() is appropriate for decompression. Reported-by: Seiji Aguchi Tested-by: Seiji Aguchi Signed-off-by: Aruna Balakrishnaiah Signed-off-by: Tony Luck --- fs/pstore/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 57b4219398c..c853e05cd7f 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -168,7 +168,7 @@ static int pstore_decompress(void *in, void *out, size_t inlen, size_t outlen) int err, ret; ret = -EIO; - err = zlib_inflateInit(&stream); + err = zlib_inflateInit2(&stream, WINDOW_BITS); if (err != Z_OK) goto error; -- cgit v1.2.3 From 802e4c6f5887205eda110c6bfb90c9bfa93dc8a7 Mon Sep 17 00:00:00 2001 From: Aruna Balakrishnaiah Date: Wed, 11 Sep 2013 10:58:23 -0700 Subject: pstore: Remove the messages related to compression failure Remove the messages indicating compression failure as it will add to the space during panic path. Reported-by: Seiji Aguchi Tested-by: Seiji Aguchi Signed-off-by: Aruna Balakrishnaiah Signed-off-by: Tony Luck --- fs/pstore/platform.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index c853e05cd7f..b8e93a40a5d 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -316,10 +316,6 @@ static void pstore_dump(struct kmsg_dumper *dumper, compressed = true; total_len = zipped_len; } else { - pr_err("pstore: compression failed for Part %d" - " returned %d\n", part, zipped_len); - pr_err("pstore: Capture uncompressed" - " oops/panic report of Part %d\n", part); compressed = false; total_len = copy_kmsg_to_buffer(hsize, len); } -- cgit v1.2.3