diff options
author | Arve Hjønnevåg <arve@android.com> | 2012-03-20 19:01:31 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-04 00:49:28 -0400 |
commit | 422ca8608c49d1e9bfed1c58a1ca448a8a38c0ad (patch) | |
tree | 5170cd8c86c720a8ab0932def99f61eec2488bbe /fs/pstore | |
parent | c53026722b5e5aaaf434565ddbe4d918c7d2a80d (diff) |
pstore/ram: Include ecc_size when calculating ecc_block
Wastes less memory and allows using more memory for ecc than data.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[jstultz: Tweaked commit subject]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r-- | fs/pstore/ram_core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 0306303be372..e5afa222c213 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c | |||
@@ -187,7 +187,8 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, | |||
187 | prz->ecc_block_size = 128; | 187 | prz->ecc_block_size = 128; |
188 | prz->ecc_size = ecc_size; | 188 | prz->ecc_size = ecc_size; |
189 | 189 | ||
190 | ecc_blocks = DIV_ROUND_UP(prz->buffer_size, prz->ecc_block_size); | 190 | ecc_blocks = DIV_ROUND_UP(prz->buffer_size - prz->ecc_size, |
191 | prz->ecc_block_size + prz->ecc_size); | ||
191 | ecc_total = (ecc_blocks + 1) * prz->ecc_size; | 192 | ecc_total = (ecc_blocks + 1) * prz->ecc_size; |
192 | if (ecc_total >= prz->buffer_size) { | 193 | if (ecc_total >= prz->buffer_size) { |
193 | pr_err("%s: invalid ecc_size %u (total %zu, buffer size %zu)\n", | 194 | pr_err("%s: invalid ecc_size %u (total %zu, buffer size %zu)\n", |