diff mbox

[03/16] pstore/ram_core: Do not reset restored zone's position and size

Message ID 1337696279-8994-3-git-send-email-anton.vorontsov@linaro.org
State Superseded
Headers show

Commit Message

Anton Vorontsov May 22, 2012, 2:17 p.m. UTC
Otherwise, the files will survive just one reboot, and on a subsequent
boot they will disappear.

Also, as noticed by Colin Cross, this also causes an interesting behavior
change in the console logging. Before this change, the console log would
show only the messages from the last reboot.  After this change, the
console log will have logs from multiple boots appended to each other.

Now to get the only most recent messages we can do:

	tac ramoops-console | sed '/^Linux version.*(.*@.*)/ q' | tac

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
---
 fs/pstore/ram_core.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Colin Cross May 22, 2012, 6:06 p.m. UTC | #1
On Tue, May 22, 2012 at 7:17 AM, Anton Vorontsov
<anton.vorontsov@linaro.org> wrote:
> Otherwise, the files will survive just one reboot, and on a subsequent
> boot they will disappear.
>
> Also, as noticed by Colin Cross, this also causes an interesting behavior
> change in the console logging. Before this change, the console log would
> show only the messages from the last reboot.  After this change, the
> console log will have logs from multiple boots appended to each other.
>
> Now to get the only most recent messages we can do:
>
>        tac ramoops-console | sed '/^Linux version.*(.*@.*)/ q' | tac

Lots of problems with this.
"Linux version ..." is not the first line in the console log on my
devices, there are messages before it that shouldn't be dropped by
automated logs collectors using this regexp.
There is a timestamp before "Linux version", so the regexp never matches.
There is often no newline at the end of the old log, so if "Linux
version" was the first line in the log, it would still not get
matched.

Relying on the first line in the log to not change seems likely to
cause problems for scripts in the future.  Why not separate them where
the code knows for sure that the old log is ending and the new log is
starting?

> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
> ---
>  fs/pstore/ram_core.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
> index 235513c..f6650d1 100644
> --- a/fs/pstore/ram_core.c
> +++ b/fs/pstore/ram_core.c
> @@ -406,6 +406,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool
>                                " size %zu, start %zu\n",
>                               buffer_size(prz), buffer_start(prz));
>                        persistent_ram_save_old(prz);
> +                       return 0;
>                }
>        } else {
>                pr_info("persistent_ram: no valid data in buffer"
> --
> 1.7.9.2
>
diff mbox

Patch

diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 235513c..f6650d1 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -406,6 +406,7 @@  static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool
 				" size %zu, start %zu\n",
 			       buffer_size(prz), buffer_start(prz));
 			persistent_ram_save_old(prz);
+			return 0;
 		}
 	} else {
 		pr_info("persistent_ram: no valid data in buffer"