aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorAnton Vorontsov <anton.vorontsov@linaro.org>2012-05-26 09:07:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-13 19:52:40 -0400
commitfce397930475f7efc712a1345dc0dad269a10544 (patch)
tree6e997211442c8c5ba3a34bb1fdc06bc06ba095f5 /fs/pstore
parent25b63da64708212985c06c7f8b089d356efdd9cf (diff)
pstore/ram_core: Factor persistent_ram_zap() out of post_init()
A handy function that we will use outside of ram_core soon. But so far just factor it out and start using it in post_init(). Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/ram_core.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index f6650d12c0c1..c5fbdbbf81ac 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -320,6 +320,13 @@ void persistent_ram_free_old(struct persistent_ram_zone *prz)
320 prz->old_log_size = 0; 320 prz->old_log_size = 0;
321} 321}
322 322
323void persistent_ram_zap(struct persistent_ram_zone *prz)
324{
325 atomic_set(&prz->buffer->start, 0);
326 atomic_set(&prz->buffer->size, 0);
327 persistent_ram_update_header_ecc(prz);
328}
329
323static void *persistent_ram_vmap(phys_addr_t start, size_t size) 330static void *persistent_ram_vmap(phys_addr_t start, size_t size)
324{ 331{
325 struct page **pages; 332 struct page **pages;
@@ -414,8 +421,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool
414 } 421 }
415 422
416 prz->buffer->sig = PERSISTENT_RAM_SIG; 423 prz->buffer->sig = PERSISTENT_RAM_SIG;
417 atomic_set(&prz->buffer->start, 0); 424 persistent_ram_zap(prz);
418 atomic_set(&prz->buffer->size, 0);
419 425
420 return 0; 426 return 0;
421} 427}
@@ -450,7 +456,6 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
450 goto err; 456 goto err;
451 457
452 persistent_ram_post_init(prz, ecc); 458 persistent_ram_post_init(prz, ecc);
453 persistent_ram_update_header_ecc(prz);
454 459
455 return prz; 460 return prz;
456err: 461err: