Linux - NewbieThis forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi,
* I am implementing mass storage device on a test board.
* It contains NAND flash.
* Using corresponding "udc driver" and "g_file_storage" I could make my test board enumerate as mass storage device on my Linux machine.
* my 16 MB pen drive (test board) is now ready for read/write.
But there are some Bad Blocks on the NAND.Hence copy is not complete.
Although on Linux machine there is no error message.
Now , what is there in a normal pen drive which manages the Bad Block or what am I missing so that such Bad Blocks are managed.
Please guide.
Here is the error I get on my test board :
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5664
Buffer I/O error on device mtdblock2, logical block 708
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5672
Buffer I/O error on device mtdblock2, logical block 709
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5680
Buffer I/O error on device mtdblock2, logical block 710
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5688
Buffer I/O error on device mtdblock2, logical block 711
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5696
Buffer I/O error on device mtdblock2, logical block 712
lost page write due to I/O error on mtdblock2
mtdblock: erase of region [0x2c0000, 0x4000] on "Bon 2" failed
end_request: I/O error, dev mtdblock2, sector 5704
10860,1
In mass-market USB storage devices there is a controller that abstracts out of the memory structure. It tries to distribute writes and work aroud bad blocks. Under some workloads it spoils things, though.
Many filesystems are capable to get a list of bad blocks during formatting and just not use them.
Also there are special filesystems that are designed for raw access to flash memory. They make better use of it than USB pen drive controllers..
From your description I cannot fully understand what goes on where. You have your test board with an embedded Linux installation on it as a USB "client" device and a Linux computer as a host? Do you check for device errors in the driver on the test board? Do you return any errors to host?
It sounds like the embedded kernel is missing a module it needs to manage bad blocks, or the embedded controller is bad. And I second the opinion that using a usb flash drive controller on a small system is kludgy.
In mass-market USB storage devices there is a controller that abstracts out of the memory structure. It tries to distribute writes and work aroud bad blocks. Under some workloads it spoils things, though.
Many filesystems are capable to get a list of bad blocks during formatting and just not use them.
Also there are special filesystems that are designed for raw access to flash memory. They make better use of it than USB pen drive controllers..
From your description I cannot fully understand what goes on where. You have your test board with an embedded Linux installation on it as a USB "client" device and a Linux computer as a host? Do you check for device errors in the driver on the test board? Do you return any errors to host?
Thanks ,
I my case there will not be any Filesystem coming into picture.
In that case , does it mean that I will have to write some code which will
take care of bad block. As my processor builtin "device controller" does not do it.For eg.
If PC (host) wants to write packets A,B,C to sector num 1 , 2, 3
Normally "device controller driver" and "g_file_storage" will write one to one i.e A on 1 , B on 2 , C on 3.
Now if sector 2 is bad: THen by some means this will happen
A on 1 , B on 3 (as 2 is bad), C on 4.
So there must be some map as to when ever Host wants to read "B" , it should be read from sector "3" and not "2".
Is there any code which does all this maping thing.
Niraj
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.