aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2012-12-05 21:19:51 -0800
committerArve Hjønnevåg <arve@android.com>2013-04-29 14:52:28 -0700
commit9cfe54fdde629e73deef198c165b14a75df0be47 (patch)
tree939e314045bca41a8bb23b39c1fa4d6b9716db11
parent29b1620b5b94ea6ab5590c404b795fad49bbe87d (diff)
downloadvexpress-lsk-9cfe54fdde629e73deef198c165b14a75df0be47.tar.gz
pstore/ram: Restore ecc information block
This was lost when proc/last_kmsg moved to pstore/console-ramoops. Signed-off-by: Arve Hjønnevåg <arve@android.com>
-rw-r--r--fs/pstore/ram.c9
-rw-r--r--fs/pstore/ram_core.c3
2 files changed, 10 insertions, 2 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 753a8d3891f..621d20ce64d 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -136,6 +136,7 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
char **buf, struct pstore_info *psi)
{
ssize_t size;
+ ssize_t ecc_notice_size;
struct ramoops_context *cxt = psi->data;
struct persistent_ram_zone *prz;
@@ -156,12 +157,16 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
time->tv_nsec = 0;
size = persistent_ram_old_size(prz);
- *buf = kmalloc(size, GFP_KERNEL);
+
+ /* ECC correction notice */
+ ecc_notice_size = persistent_ram_ecc_string(prz, NULL, 0);
+ *buf = kmalloc(size + ecc_notice_size + 1, GFP_KERNEL);
if (*buf == NULL)
return -ENOMEM;
memcpy(*buf, persistent_ram_old(prz), size);
+ persistent_ram_ecc_string(prz, *buf + size, ecc_notice_size + 1);
- return size;
+ return size + ecc_notice_size;
}
static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index c6f641c1017..59337326e28 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -235,6 +235,9 @@ ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
{
ssize_t ret;
+ if (!prz->ecc_info.ecc_size)
+ return 0;
+
if (prz->corrected_bytes || prz->bad_blocks)
ret = snprintf(str, len, ""
"\n%d Corrected bytes, %d unrecoverable blocks\n",