[PATCH v3 1/3]: mtdoops: Keep track of clean/dirty mtdoops pages in an array

Artem Bityutskiy Artem.Bityutskiy at nokia.com
Sun Oct 11 06:29:48 EDT 2009


On Thu, 2009-10-08 at 17:26 +0200, Simon Kagstrom wrote:
> This patch makes mtdoops keep track of clean/dirty pages in an array
> instead of scanning the flash after a write. The advantage with this
> approach is that it avoids calling mtd->read on a panic, which is not
> possible for all mtd drivers.
> 
> Signed-off-by: Simon Kagstrom <simon.kagstrom at netinsight.net>
> ---
>  drivers/mtd/mtdoops.c |   48 +++++++++++++++++++++++++++++-------------------
>  1 files changed, 29 insertions(+), 19 deletions(-)

> diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
> index ac67833..435961e 100644
> --- a/drivers/mtd/mtdoops.c
> +++ b/drivers/mtd/mtdoops.c
> @@ -44,6 +44,7 @@ static struct mtdoops_context {
>  	int oops_pages;
>  	int nextpage;
>  	int nextcount;
> +	u8 *oops_page_dirty;
>  	char *name;

So basically, you want to keep a per-page array which contains free/used
mtd oops page status. I find the term "dirty" a bit confusing. Could we
please instead use "used" or "free" or something like that?

Also, is it possible to make it 1 bit per oops page, not 1 byte? Just
less wasteful.

> @@ -428,6 +435,7 @@ static int __init mtdoops_console_init(void)
>  		printk(KERN_ERR "Failed to allocate mtdoops buffer workspace\n");
>  		return -ENOMEM;
>  	}
> +	cxt->oops_page_dirty = NULL;

Minor nitpick: this initialization is unnecessary.

[snip]

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list