aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore/platform.c
diff options
context:
space:
mode:
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>2013-09-11 13:57:41 -0400
committerTony Luck <tony.luck@intel.com>2013-09-16 12:28:28 -0400
commit7de8fe2fa8f94985a83120f04d41a93425ea66ba (patch)
tree30fb66a6e04b3dcba8fe6d21be01b3cf5e9e203f /fs/pstore/platform.c
parente831cbfc1ad843b5542cc45f777e1a00b73c0685 (diff)
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 <seiji.aguchi@hds.com> Tested-by: Seiji Aguchi <seiji.aguchi@hds.com> Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'fs/pstore/platform.c')
-rw-r--r--fs/pstore/platform.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 4ffb7ab5e397..57b4219398cd 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -195,8 +195,29 @@ error:
195static void allocate_buf_for_compression(void) 195static void allocate_buf_for_compression(void)
196{ 196{
197 size_t size; 197 size_t size;
198 size_t cmpr;
199
200 switch (psinfo->bufsize) {
201 /* buffer range for efivars */
202 case 1000 ... 2000:
203 cmpr = 56;
204 break;
205 case 2001 ... 3000:
206 cmpr = 54;
207 break;
208 case 3001 ... 3999:
209 cmpr = 52;
210 break;
211 /* buffer range for nvram, erst */
212 case 4000 ... 10000:
213 cmpr = 45;
214 break;
215 default:
216 cmpr = 60;
217 break;
218 }
198 219
199 big_oops_buf_sz = (psinfo->bufsize * 100) / 45; 220 big_oops_buf_sz = (psinfo->bufsize * 100) / cmpr;
200 big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); 221 big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
201 if (big_oops_buf) { 222 if (big_oops_buf) {
202 size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL), 223 size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL),