[U-Boot] [PATCH] mtd: nand: fix the written length when nand_write_skip_bad failed

Scott Wood scottwood at freescale.com
Mon Mar 11 17:43:21 CET 2013


On 03/09/2013 07:06:54 PM, htbegin wrote:
> Hi, Scott
> 
> On Fri, Mar 8, 2013 at 6:27 AM, Scott Wood <scottwood at freescale.com>  
> wrote:
> 
> >> >> I just use "*length -= left_to_write - written_size" to tell  
> the upper
> >> >> level that what
> >> >> had been actually happened. For the current block,  
> "written_size" has
> >> >> been written to the NAND Flash yet, so left_to_write should be
> >> >> subtracted by "written_size".
> >> >
> >> >
> >> > But left_to_write isn't decreased until after this error return,  
> so
> >> > that's
> >> > already the case.  Subtracting written_size from left_to_write  
> has the
> >> > effect of increasing length by written_size, so the return value  
> will
> >> > now
> >> > look like the error page has been written.
> >> >
> >> > -Scott
> >> No, the returned value doesn't include the length of the error  
> page.
> >> In no-WITH_YAFFS_OOB case,  when nand_write failed,
> >> truncated_write_size has been
> >> updated by nand_write to the length which has been successfully
> >> written , so it's OK to subtract written_size from left_to_write.
> >
> >
> > OK, but that doesn't explain why the change is needed.  You said  
> you wanted
> > to find the block with the error.  We only write one block at a  
> time in the
> > loop.  Why do you need the specific page within the block that  
> failed?
> >
> > -Scott
> 
> Yes, you are right it's OK to ignore the written length of the
> write-failed block, but as I said before I just wanted to tell the
> upper level what had been actually written. So if you insist the
> subtraction of written_len is unnecessary, it's alright with me.

Thanks.  I do insist -- it adds complexity.

-Scott


More information about the U-Boot mailing list