Commit 9baa5059 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux

Pull pstore/compression fixes from Tony Luck:
 "Three pstore fixes related to compression:
   1) Better adjustment of size of compression buffer (was too big for
      EFIVARS backend resulting in compression failure
   2) Use zlib_inflateInit2 instead of zlib_inflateInit
   3) Don't print messages about compression failure.  They will waste
      space that may better be used to log console output leading to the
      crash"

* tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux:
  pstore: Remove the messages related to compression failure
  pstore: Use zlib_inflateInit2 instead of zlib_inflateInit
  pstore: Adjust buffer size for compression for smaller registered buffers
parents f42bcf1a 802e4c6f
...@@ -168,7 +168,7 @@ static int pstore_decompress(void *in, void *out, size_t inlen, size_t outlen) ...@@ -168,7 +168,7 @@ static int pstore_decompress(void *in, void *out, size_t inlen, size_t outlen)
int err, ret; int err, ret;
ret = -EIO; ret = -EIO;
err = zlib_inflateInit(&stream); err = zlib_inflateInit2(&stream, WINDOW_BITS);
if (err != Z_OK) if (err != Z_OK)
goto error; goto error;
...@@ -195,8 +195,29 @@ static int pstore_decompress(void *in, void *out, size_t inlen, size_t outlen) ...@@ -195,8 +195,29 @@ static int pstore_decompress(void *in, void *out, size_t inlen, size_t outlen)
static void allocate_buf_for_compression(void) static void allocate_buf_for_compression(void)
{ {
size_t size; size_t size;
size_t cmpr;
big_oops_buf_sz = (psinfo->bufsize * 100) / 45; 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) / cmpr;
big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
if (big_oops_buf) { if (big_oops_buf) {
size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL), size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL),
...@@ -295,10 +316,6 @@ static void pstore_dump(struct kmsg_dumper *dumper, ...@@ -295,10 +316,6 @@ static void pstore_dump(struct kmsg_dumper *dumper,
compressed = true; compressed = true;
total_len = zipped_len; total_len = zipped_len;
} else { } 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; compressed = false;
total_len = copy_kmsg_to_buffer(hsize, len); total_len = copy_kmsg_to_buffer(hsize, len);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment