aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 0b311bc18916..1a4f6da58eab 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -32,6 +32,7 @@
32#include <linux/ioport.h> 32#include <linux/ioport.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/compiler.h>
35#include <linux/pstore_ram.h> 36#include <linux/pstore_ram.h>
36 37
37#define RAMOOPS_KERNMSG_HDR "====" 38#define RAMOOPS_KERNMSG_HDR "===="
@@ -181,12 +182,11 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
181 return len; 182 return len;
182} 183}
183 184
184 185static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
185static int ramoops_pstore_write_buf(enum pstore_type_id type, 186 enum kmsg_dump_reason reason,
186 enum kmsg_dump_reason reason, 187 u64 *id, unsigned int part,
187 u64 *id, unsigned int part, 188 const char *buf, size_t size,
188 const char *buf, size_t size, 189 struct pstore_info *psi)
189 struct pstore_info *psi)
190{ 190{
191 struct ramoops_context *cxt = psi->data; 191 struct ramoops_context *cxt = psi->data;
192 struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; 192 struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt];
@@ -406,7 +406,7 @@ static int __devinit ramoops_probe(struct platform_device *pdev)
406 goto fail_init_fprz; 406 goto fail_init_fprz;
407 407
408 if (!cxt->przs && !cxt->cprz && !cxt->fprz) { 408 if (!cxt->przs && !cxt->cprz && !cxt->fprz) {
409 pr_err("memory size too small, minimum is %lu\n", 409 pr_err("memory size too small, minimum is %zu\n",
410 cxt->console_size + cxt->record_size + 410 cxt->console_size + cxt->record_size +
411 cxt->ftrace_size); 411 cxt->ftrace_size);
412 goto fail_cnt; 412 goto fail_cnt;
@@ -414,13 +414,14 @@ static int __devinit ramoops_probe(struct platform_device *pdev)
414 414
415 cxt->pstore.data = cxt; 415 cxt->pstore.data = cxt;
416 /* 416 /*
417 * Console can handle any buffer size, so prefer dumps buffer 417 * Console can handle any buffer size, so prefer LOG_LINE_MAX. If we
418 * size since usually it is smaller. 418 * have to handle dumps, we must have at least record_size buffer. And
419 * for ftrace, bufsize is irrelevant (if bufsize is 0, buf will be
420 * ZERO_SIZE_PTR).
419 */ 421 */
420 if (cxt->przs) 422 if (cxt->console_size)
421 cxt->pstore.bufsize = cxt->przs[0]->buffer_size; 423 cxt->pstore.bufsize = 1024; /* LOG_LINE_MAX */
422 else 424 cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize);
423 cxt->pstore.bufsize = cxt->cprz->buffer_size;
424 cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL); 425 cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL);
425 spin_lock_init(&cxt->pstore.buf_lock); 426 spin_lock_init(&cxt->pstore.buf_lock);
426 if (!cxt->pstore.buf) { 427 if (!cxt->pstore.buf) {
@@ -537,6 +538,7 @@ postcore_initcall(ramoops_init);
537static void __exit ramoops_exit(void) 538static void __exit ramoops_exit(void)
538{ 539{
539 platform_driver_unregister(&ramoops_driver); 540 platform_driver_unregister(&ramoops_driver);
541 platform_device_unregister(dummy);
540 kfree(dummy_data); 542 kfree(dummy_data);
541} 543}
542module_exit(ramoops_exit); 544module_exit(ramoops_exit);