On Fri, 24 Feb 2006, Thomas Thanner wrote:

> > Very strange.  I have no idea why "dd" should work and "cp" should fail, 
> > except that "dd" bypasses the filesystem code.  Anyway, it's good that you 
> > figured out a way to work around the problem.
> > 
> > Have you checked the partition table on the card and run "fsck" to check 
> > the filesystem?
> > 
> > Alan Stern
> > 
> > 
> 
> We tested both, formatting CF-card before copy or just removing existing 
> files 
> and copy then. We have tested CF-card with partitioning and without, too. 
> Always the same result.

Weird.

> To do a little more investigations I wrote a little utility in C that does 
> nothing else but open a file for read and another for write with regular 
> open(). Then it copies fixed size chunks from the input file to the output 
> file using standard read() and write() operations. For chunk sizes smaller 
> than or equal to 4096 everything works just fine, like "dd". But we do not 
> bypass filesystem this way, I guess.

No.

> At the moment I still favour the hypothesis that linux tries to write too 
> fast 
> to the CF card. The problem always starts when the CF card has to "slow down" 
> USB transfers because it has to write to its FLASH memory physically. I guess 
> handshake is implemented bad on the interface chips of many card readers.
> 
> As soon as we slow down copy process, either by adding lots of debugging 
> messages to /var/log/messages or by forcing copy process to use only small 
> chunks of memory at a time, we have no problems any more.

That is certainly possible.  It doesn't explain why "dd" should work 
better than "cp", though.  Unless perhaps you used a small buffer size 
with "dd"; then the constant user <-> kernel transitions would slow things 
down.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to