[PATCH] mtdtest: Check bbt at index of (eb + 1) when we access 2 EBs.

Brian Norris computersforpeace at gmail.com
Sat Sep 27 17:40:52 PDT 2014


On Mon, Aug 18, 2014 at 10:27:59AM +0800, Dongsheng Yang wrote:
> When we want to access 2 eraseblocks, we need to make sure the
> two eraseblocks both are not bad.
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
> ---
>  drivers/mtd/tests/stresstest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/tests/stresstest.c b/drivers/mtd/tests/stresstest.c
> index c9d42cc..076d409 100644
> --- a/drivers/mtd/tests/stresstest.c
> +++ b/drivers/mtd/tests/stresstest.c
> @@ -60,7 +60,7 @@ again:
>  	eb = prandom_u32();
>  	/* Read or write up 2 eraseblocks at a time - hence 'ebcnt - 1' */
>  	eb %= (ebcnt - 1);
> -	if (bbt[eb])
> +	if (bbt[eb] || bbt[eb + 1])

Was this change actually needed? Did you see some kind of test failure
without it?

>From what I can see, stresstest.c already handles the second block just
fine; it skips the block with code like this:

static int do_read(void)
{
...
        if (bbt[eb + 1]) {
                if (offs >= mtd->erasesize)
                        offs -= mtd->erasesize;
                if (offs + len > mtd->erasesize)
                        len = mtd->erasesize - offs;
        }
...
}

and similar in do_write().

Plus, your patch actually skips *any* block where the subsequent block
is bad. That is not ideal, as it skews the randomness.

So unless I'm missing something, I will not take this patch.

>  		goto again;
>  	return eb;
>  }

Regards,
Brian



More information about the linux-mtd mailing list