[PATCH V4] mtd: gpmi: fix the bitflips for erased page

Brian Norris computersforpeace at gmail.com
Mon Mar 17 12:20:00 EDT 2014


On Thu, Mar 13, 2014 at 03:12:59PM +0800, Huang Shijie wrote:
> On Wed, Mar 12, 2014 at 10:41:18PM -0700, Brian Norris wrote:
> > On Wed, Mar 12, 2014 at 03:26:57PM +0800, Huang Shijie wrote:
> > > On Fri, Mar 07, 2014 at 07:32:38PM -0800, Brian Norris wrote:
> > > > > 
> > > > > This patch does a check for the uncorrectable failure in the following steps:
> > > > > 
> > > > >    [0] set the threshold.
> > > > >        The threshold is set based on the truth:
> > > > >          "A single 0 bit will lead to gf_len(13 or 14) bits 0 after the BCH
> > > > >           do the ECC."
> > > > > 
> > > > >        For the sake of safe, we will set the threshold with half the gf_len, and
> > > > >        do not make it bigger the ECC strength.
> > > > 
> > > > This threshold looks wrong here.
> > > 
> > > I shrink the threshold on purpose. The ECC strength can be 40 some times.
> > 
> > I see. I suppose the threshold could be smaller, but I definitely
> > believe it should be correlated with the ECC strength, not just capped
> > at 6 or 7.
> 
> could you suggest a better threshold? I am not confident to use the
> ECC strength. 

I am fairly convinced it should be correlated with the ECC strength, but
I'm flexible on the specifics. Maybe:

	max(ecc_strength / 2, 1)

?

> > > > > +
> > > > > +	/* Count the bitflips for the no ECC buffer */
> > > > > +	for (i = 0; i < mtd->writesize / 8; i++) {
> > 
> > I believe I misread this loop the first time; you're not actually
> > checking the entire page.
> > 
> > Why divide by 8?
> I use the hweight64 here.

I see. I was right the first time...

> > > > > +		flip_bits_noecc += hweight64(~buf[i]);
> > > > > +		if (flip_bits_noecc > threshold)
> > > > > +			return false;
> > > > > +	}

Brian



More information about the linux-mtd mailing list