Shel,

Re-reading my posts in this thread, I realize they are somewhat  
misleading and also just plain wrong in at least one statement.  I  
hope to be more accurate and clear in this post, at least as much as  
my understanding of the systems involved may allow.

FAT 12/16/32 file systems were originally designed for magnetic  
disks.  As such, the control structures, which are the boot record,  
the File Allocation Table (there's actually two) and the root  
directory are always written in that order, and in the same physical  
place on the first sectors of a volume.  In FAT32, the root directory  
is actually treated like any ordinary data structure, but even then  
it typically follows the FATs.  The data area fills the rest of the  
volume.

In a flash device, repeated writing to a particular address increases  
the risk that that area will fail.  However, in flash, the media can  
only be in the state of erased or non-erased.  Only erased blocks can  
have data bits written to them; you can't actually twiddle individual  
bits or bytes.  So when a change is requested for commitment to an  
existing cluster at the File System level, the Flash Translation  
Layer (which is below the FS) actually looks for a free (erased)  
block and writes the data there, which is then marked as dirty/ 
allocated (unless that block fails, which then gets marked as bad/ 
unusable and it seeks another free block).  The old block is marked  
as deleted.  The FTL virtually maps memory addresses to what the FS  
expects, preserving the illusion to the FS that data has been  
modified when actually it has been written to a new location.  Blocks  
are organized into erase units, which are erased (written to all  
zeroes or ones depending on the device) as a group when needed, which  
happens when the card eventually runs out of free blocks.  In some  
cases, the lowest virtual address are actually created and modified  
in system memory on card insertion due to the frequency of changes  
made by FAT.

In summary, every time any "change" is made to data stored in flash  
media, it is actually written as new data to a new location on the  
device.  Obviously, this includes control structures.

As I understand it, more advanced wear-leveling systems in things  
such as ATA flash drives as well as wear-level aware file systems  
track the usage patterns of addresses at the media level to maximize  
the potential lifespan of the media.  This is beyond the scope of  
cameras and thumb drives.

Michael

On Dec 4, 2006, at 11:29 AM, Shel Belinkoff wrote:

> You lost me on that one.  Care to explain?
>
> Shel
>
>
>
>> [Original Message]
>> From: Godfrey DiGiorgi
>
>> they also reposition the directory
>> tables as time goes on if the
>> media is used a lot, again to preserve
>> and extend the media's lifespan.
>
>
>
> -- 
> PDML Pentax-Discuss Mail List
> [email protected]
> http://pdml.net/mailman/listinfo/pdml_pdml.net


-- 
PDML Pentax-Discuss Mail List
[email protected]
http://pdml.net/mailman/listinfo/pdml_pdml.net

Reply via email to