On Mon, Mar 10, 2008 at 05:09:38PM +0000, Jim Jackson wrote:
> No it involves double writes. And the thinking behind the suggestion is
> flawed. Flash disks do not work like Hard disks. Block numbers in flash
> defives are virual and are mapped where necessary to real flash blocks by a
> block translation table that helps with the wearlevelling. Because of this
> wear levelling the all-zero block that is subsequently rewritten, will be
> written to a brand new block in the most recently erased superblock of the
> flash chip, and the block translation table updated to record where this
> block
> is. So the inital zero write was a waste of time - and you flash wears out
> quicker.
Good point - I'd forgotten block translation at the flash level. But I'd
still recommend pre-creating the files as its avoidings runtime changes
to the ext2/ext3 filesystem metadata. Definitely avoid directory writes.
An SDcard should cope with terabytes of writes without wearing out so
this shouldn't be an issue.
It might be worth checking than the Java application is buffering its
writes (you could do this by viewing its system calls with strace)
Personally I'd be looking to another storage media like a USB key
if there was a choice.
Andrew
|