Skip to content

Commit

Permalink
Merge tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Linus Torvalds committed Sep 18, 2013
2 parents f42bcf1 + 802e4c6 commit 9baa505
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions fs/pstore/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
{
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),
Expand Down Expand Up @@ -295,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);
}
Expand Down

0 comments on commit 9baa505

Please sign in to comment.