From: Matthieu CASTET <matthieu.castet@parrot.com>
To: "dedekind1@gmail.com" <dedekind1@gmail.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] mtdoops : don't erase flash at each boot
Date: Tue, 13 Nov 2012 10:56:41 +0100 [thread overview]
Message-ID: <50A21959.5050505@parrot.com> (raw)
In-Reply-To: <1352735412.2262.15.camel@sauron.fi.intel.com>
Artem Bityutskiy a écrit :
> On Fri, 2012-10-19 at 17:29 +0200, Matthieu CASTET wrote:
>> If there is no oops stored (flash is erased), find_next_position will
>> exit with maxcount == 0xffffffff and erase the first page.
>>
>> Only erase it if mark_is_used.
>>
>> Signed-off-by: Matthieu Castet <matthieu.castet@parrot@com>
>
> The code of mtdoops is really hard to read. Could you please provide a
> better commit message with better description about what you do:
>
> 1. what problem you fix exactly, and why is it a problem
> 2. how the code currently works
> 3. how you change it to make the problem go away
>
> Thanks!
>
Is the following changelog ok ?
The current version on mtdoops erase first block of mtdoops partition at each
boot if there is no oops stored in flash. This can wear the flash.
When mtdoops start, find_next_position is called to find the next free entry in
the circular buffer. But if the flash is erased, find_next_position don't find
anything (maxcount == 0xffffffff) and start with the first entry after erasing it.
The scanning that is done in find_next_position already track free/used entries.
So if at the end of the scanning we don't find anything, we can start at the
first entry and erased the entry only if it is marked as used.
Most of this is implemented in mtdoops_inc_counter, so to avoid duplicating
code, if we don't find anything we set position to -1. mtdoops_inc_counter with
increment it, erase the entry if needed and start as before with nextpage = 0
and nextcount = 1).
Also during the scan phase, we use the MTDOOPS_KERNMSG_MAGIC to detect corruped
entries.
next prev parent reply other threads:[~2012-11-13 9:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 15:29 [PATCH] mtdoops : don't erase flash at each boot Matthieu CASTET
2012-11-12 15:50 ` Artem Bityutskiy
2012-11-13 9:56 ` Matthieu CASTET [this message]
2012-11-15 13:03 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50A21959.5050505@parrot.com \
--to=matthieu.castet@parrot.com \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.