4 ms·
Can anyone explain why a log-structured file system is a good fit for flash? It seems that a lot of the benefits of an LFS are that it reduces disk seeks.
by jackowayed 14y ago
Can anyone explain why a log-structured file system is a good fit for flash? It seems that a lot of the benefits of an LFS are that it reduces disk seeks.
- mvgoogler 14y agoYou want writes to flash to be as sequential as possible. Random writes to flash result in more wear and worse performance due to GC overhead. Log-structured file systems tend to write data sequentially since the writes append to the log (yes - that's a gross over simplification). File systems like ext4 maintain separate data structures for data and metadata and generate more random writes.
- trotsky 14y agoThat article is pretty light on the details, but one thing to note is that most sd card storage is relatively poor at random seeks, having been optimized for media type usage.
- lmm 14y agoThe cost of random seeks is still going to be lower than on hard drives, which is what most current filesystems were optimized for.
- hristov 14y agoIt has to do with the way flash does writes. In flash it actually takes longer to overwrite a bit of data, than to write that bit on a 'blank', or previously initialized cell. Furthermore if you are going to overwrite something in flash it usually behooves you to overwrite an entire block at a time. For these reasons flash systems tend to try to often write changes in a log manner, wait for a lot of changes to pile up and then incorporate those changes back into the original by rewriting entire blocks. The log can be placed in an initialized section of the memory where overwrites are not necessary.
- Tuna-Fish 14y ago> Furthermore if you are going to overwrite something in flash it usually behooves you to overwrite an entire block at a time. Well, all block devices are written a block at a time. The way flash differs is that there are two internal block sizes -- called pages (4-8kB), and eraseblocks (256kB-4MB). There are two states a page can be in: clear, or used. You can write at a page granularity, but only to clear pages. To clear used pages, you need to clear the entire eraseblock at a time. Eraseblock sizes are now limited by fundamental physical limits -- on every NAND node shrink from now, the eraseblocks are going to double in size. And they are already really huge in modern devices.
- zurn 14y agoLFS recudes seeks on writes but requires more seeks on reads. This was bad for general purpouse use so they didn't become popular with rotating media. It's a perfect fit for flash, because there read seeks are (almost) free, and the overwrite-less, sequential writes are a perfect fit. Flash only supports read, erase, and write-on-erased operations, the exact set that LFS uses.