[PATCH v7 3/5]: mtdoops: Make page (record) size configurable

Artem Bityutskiy dedekind1 at gmail.com
Fri Oct 23 00:13:49 EDT 2009


On Thu, 2009-10-15 at 09:47 +0200, Simon Kagstrom wrote:
> The main justification for this is to allow catching long messages
> during a panic, where the top part might otherwise be lost since moving
> to the next block can require a flash erase.
> 
> Signed-off-by: Simon Kagstrom <simon.kagstrom at netinsight.net>
> Reviewed-by: Anders Grafstrom <anders.grafstrom at netinsight.net>

What will happen if I have a partition with 8192-bytes records, and then
attach it to mtdoops with default 4096 ?

>  	cxt->mtd = mtd;
>  	if (mtd->size > INT_MAX)
> -		cxt->oops_pages = INT_MAX / OOPS_PAGE_SIZE;
> +		cxt->oops_pages = INT_MAX / record_size;
>  	else
> -		cxt->oops_pages = (int)mtd->size / OOPS_PAGE_SIZE;
> +		cxt->oops_pages = (int)mtd->size / record_size;

BTW, this INT_MAX and the (int) cast also suggests we need to limit the
maximum partition size and add a check for this.

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




More information about the linux-mtd mailing list