aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArve Hjønnevåg2012-12-05 23:19:51 -0600
committerArve Hjønnevåg2013-02-22 17:27:49 -0600
commit9e9f90c125b71a2c3e118c05e58b0cb3bbd53d16 (patch)
treedba90a0c4b07664b02901ca650229a282171e107
parent7962c39720a11707471a3c5731c225a7d261226f (diff)
downloadkernel-common-9e9f90c125b71a2c3e118c05e58b0cb3bbd53d16.tar.gz
kernel-common-9e9f90c125b71a2c3e118c05e58b0cb3bbd53d16.tar.xz
kernel-common-9e9f90c125b71a2c3e118c05e58b0cb3bbd53d16.zip
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 2f254903a21..25f251b2c31 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,
136 char **buf, struct pstore_info *psi) 136 char **buf, struct pstore_info *psi)
137{ 137{
138 ssize_t size; 138 ssize_t size;
139 ssize_t ecc_notice_size;
139 struct ramoops_context *cxt = psi->data; 140 struct ramoops_context *cxt = psi->data;
140 struct persistent_ram_zone *prz; 141 struct persistent_ram_zone *prz;
141 142
@@ -156,12 +157,16 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
156 time->tv_nsec = 0; 157 time->tv_nsec = 0;
157 158
158 size = persistent_ram_old_size(prz); 159 size = persistent_ram_old_size(prz);
159 *buf = kmalloc(size, GFP_KERNEL); 160
161 /* ECC correction notice */
162 ecc_notice_size = persistent_ram_ecc_string(prz, NULL, 0);
163 *buf = kmalloc(size + ecc_notice_size + 1, GFP_KERNEL);
160 if (*buf == NULL) 164 if (*buf == NULL)
161 return -ENOMEM; 165 return -ENOMEM;
162 memcpy(*buf, persistent_ram_old(prz), size); 166 memcpy(*buf, persistent_ram_old(prz), size);
167 persistent_ram_ecc_string(prz, *buf + size, ecc_notice_size + 1);
163 168
164 return size; 169 return size + ecc_notice_size;
165} 170}
166 171
167static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) 172static 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,
235{ 235{
236 ssize_t ret; 236 ssize_t ret;
237 237
238 if (!prz->ecc_info.ecc_size)
239 return 0;
240
238 if (prz->corrected_bytes || prz->bad_blocks) 241 if (prz->corrected_bytes || prz->bad_blocks)
239 ret = snprintf(str, len, "" 242 ret = snprintf(str, len, ""
240 "\n%d Corrected bytes, %d unrecoverable blocks\n", 243 "\n%d Corrected bytes, %d unrecoverable blocks\n",