Re: Sync option destroys flash!

David Woodhouse
2005-05-16T09:31:42Z

On Sun, 2005-05-15 at 20:23 -0400, Mark Lord wrote:
> All flashcards (other than dumb "smart media" cards) have integrated
> NAND controllers which perform automatic page/block remapping and
> which implement various wear-leveling algorithms. Rewriting "Sector 0"
> 10000 times probably only writes once to the first sector of a 1GB card.
> The other writes are spread around the rest of the card, and remapped
> logically by the integrated controller.

Assuming the firmware of the card is written with a modicum of clue,
this is true. It's not clear how valid that assumption is, in the
general case. There are reports of cards behaving as if they have almost
no wear levelling at all.

> Linux could be more clever about it all, though. Wear-leveling can only
> be done efficiently on "unused" or "rewritten" blocks/pages on the cards,
> and not so well with areas that hold large static data files (from the point
> of view of the flash controller, not the O/S).
>
> If we were really clever about it, then when Linux deletes a file from a
> flashcard device, it would also issue CFA ERASE commands for the newly
> freed sectors. This would let the card's controller know that it can
> remap/reuse that area of the card as it sees fit.

This would be extremely useful, yes. I've said in the past that I want
this for the benefit of the purely software flash translation layers
(FTL, NFTL etc.). I hadn't realised that CF cards expose the same
functionality.

--
dwmw2