[PATCH 0/2] Support skipping bad blocks when seeking to start address

Mike Crowe mac at mcrowe.com
Wed Jan 11 08:22:35 PST 2017


On Monday 09 January 2017 at 14:51:35 +0000, Mike Crowe wrote:
> However, I can't say I understand how the main loop in nandwrite.c can work
> if blockalign > 1. It contains the following lines of code:
> 
> |  ebsize_aligned = mtd.eb_size * blockalign;
> |  ...
> |  ret = mtd_is_bad(&mtd, fd, offs / ebsize_aligned);

I believe that the above line should read:

 ret = mtd_is_bad(&mtd, fd, offs / mtd.eb_size);

so that...

> |  ...		   
> |  offs +=  ebsize_aligned / blockalign;
> 
> The implementation of mtd_is_bad in libmtd.c contains:
> 
> |  seek = (loff_t)eb * mtd->eb_size;

...the above line works correctly.

This seems to have been introduced back in 2010 in
15d811481cf1cf61ae23fabbd1e191ebdbcf3881 when a direct ioctl call was
replaced by the call to mtd_is_bad.

But, if it really has been broken since then, I think it's worth
questioning how many people can actually be using the blockalign feature.

Thanks.

Mike.




More information about the linux-mtd mailing list