[clug] Flash memory: Load-levelling question.

Daniel Pittman daniel at rimspace.net
Fri Mar 27 00:31:53 GMT 2009


steve jenkin <sjenkin at canb.auug.org.au> writes:

> With flash (NAND) memory, especially CF, 'load levelling' is
> critically important in creating a 'useful life'.

Yes.  Keep in mind, though, that anything consumer grade you are likely
to use does this in the "hardware" rather than needing OS support.

This is especially true of anything that runs a FAT filesystem by
default, which covers anything you *might* plug into, oh, pretty much
any CE device on earth.

> But doesn't it make the assumption that the whole of the array is
> being written? Nothing I've read details the algorithms used, so I'm
> guessing how it works.

No.

> When you've got FAT16 being used in a camera (write-upload-wipe), it's
> pretty obvious load-levelling will be a perfect solution because there
> is almost no static data 'blocking' writes to cells.

I am guessing you don't know an awful lot about FAT here, but let me
assure you this is the absolute opposite of the truth.

FAT has an awful lot of metadata stored at *fixed* locations on the
disk, so every create, delete or format requires a write to those same
locations.

Furthermore, the CF device has no idea if a block that you wrote last
week is in use or not[1], so reformatting has no relationship to wear
levelling.

> But for an embedded device where:
>  - most of the system image is static
>  - the image mostly fills the CF
>
> Won't simple load-levelling be of little benefit in this case?

Your hypothetical load levelling would be, but the real stuff doesn't
work that way in general.  Especially crappy implementations have
happened, but given the way CE equipment works they don't last long on
the market. :)

> Imagine you've got a 64Mb CF with 63Mb of static image.
> Simplistically, all the writes will be confined to 1Mb of free memory.
> i.e. just 1-in-64 blocks will be candidates for load-levelling writes.
>
> Why would unaltered cells/blocks be written when they don't have to
> be??

Because it improve wear levelling by spreading the load around rather
than restricting it to a subset of blocks.  If you do it right, which
most of the common vendors do manage.

> If someone can point me at a definitive answer, I'd be most
> appreciative :-)

Sadly, these algorithms are trade secrets, so while you can get general
answers by googling up the whitepapers that flash folks publish, details
are practically impossible to come by and we mostly rely on the word
from people who have signed the NDAs. :?

Regards,
        Daniel

Footnotes: 
[1]  A standard for communicating this information to the device is
     currently working through the technical committies responsible for
     industry standards, so you *might* see it starting to be widely
     supported in a few years time.



More information about the linux mailing list