[PATCH] mtd: use ecc_strength to determine whether to perform bitflip_threshold test

Brian Norris computersforpeace at gmail.com
Tue May 1 21:33:14 EDT 2012


On Tue, May 1, 2012 at 12:56 PM, Mike Dunn <mikedunn at newsguy.com> wrote:
> This patch replaces bitflip_threshold with ecc_strength as the value used to
> determine whether the device has ecc capability.  I think this is more correct
> because bitflip_threshold can be changed via sysfs.

This isn't the only reason. More simply, there's the reason that
ecc_strength is the natural measure of "do I have ECC", not
bitflip_threshold, even if we can often say that ecc_strength != 0 if
and only if bitflip_threshold != 0.

> Sorry for wanting to make tweaks after reviews and Ivan's testing.  It's
> optional, low risk, and I did test it.  Thanks!

Aside from the review and testing, this kind of "fixup" usually makes
sense to just squash into the original patch ("mtd: driver _read()
returns max_bitflips; mtd_read() returns -EUCLEAN"), right?

> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index b5bb628..5757307 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -815,7 +815,7 @@ int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
>        ret_code = mtd->_read(mtd, from, len, retlen, buf);
>        if (unlikely(ret_code < 0))
>                return ret_code;
> -       if (mtd->bitflip_threshold == 0)
> +       if (mtd->ecc_strength == 0)
>                return 0;       /* device lacks ecc */
>        return ret_code >= mtd->bitflip_threshold ? -EUCLEAN : 0;
>  }

I had meant to suggest this on the original patch but never got around to it.

For this patch (on its own, or in combo with the patch it fixes up):

Reviewed-by: Brian Norris <computersforpeace at gmail.com>



More information about the linux-mtd mailing list