On 2/10/02 at 8:40 AM Robert Newson wrote: >>> Instead, the writes are 'staggered' - a sector that is overwritten is >>> actually declared empty and another is written instead, than that one >>> is 'soft-remapped' to be at the same space as it's previous 'version'.
> Stupid question: how is the "soft-remapping" stored? > I only ask as it seems obvious that this has to be constantly re-written > each time a sector's physical location changes - or am I thinking too much > in terms of disk allocation maps Not a stupid question at all, in fact that's the whole technology of making Flash chips into CF cards. The chips are not random write. Bits get written from 1 to 0, but you can only erase (return to 1) a whole 'sector', which is usually 64k. Because of this, logical sectors (512bytes) actually use more than that size on the chip - just like on hard drives, there are extra bits for error detection and correction, but in addition, there are link list structures for logical sector remapping. These are usually encoded so that changes are always written only by resetting bits. This way when the chip sector is erased (reset to 1s), the links are also erased and reset with it, avoiding unnecessary erasing. However, since the CF has no way of knowing what will get erased when, especially when it becomes nearly full, there is usually also a mechanism for relocating whole chip sectors (using the same principle). The CF is in 'trouble' when it is almost completely full and less than one whole chip sector needs to be erased. This is where spare sectors come in - and yes, it does copy the sectors that need to be 'saved' into the spare sector, erases the original sector, and then that one becomes spare - and it also rotates spares so that one single sector never gets used as a spare all the time. As others suggested, yes, the data structures most probably get copied into local RAM for easyer look-up, at power-up, but now we are getting into the area of guesswork, one would have to look up a flash controller chip data to see how it's done, and even then it would not be conclusive as many CF card (or other flash based media) manufacturers use proprietary chips. Another 'guesswork' option is so called 'Flash RAM'. There are two chip makers that produce a static RAM which has a flash 'shadow'. This gets written simultaneously, all bits at the same time, into the RAM on power up, and written back into the Flash from the RAM on power down. The only requirement is that there is a power supply capable of pesisting a few ms after power down, very easily done. The down side is that these have a small (but sufficient for this application) capacity, and are not cheap. In today's ever diminishing price market, I doubt these would be very popular, it's much more likely that a clever managing algorithm would be. Nasta
