Monday, July 20, 2009

FAT32

FAT32 is a terrible filesystem. Fat16 and 12 are ok because the FAT is small enough to fit in memory (max 128K) so that it can be fast. FAT32 FAT can be up to 256 MB in size, and cannot be fit in memory. Since FAT32 does not feature a free cluster bitmap, finding free clusters on a moderately-filled FS can be a big pain. My FAT32 driver attempts to optimize this by creating a compressed free-cluster bitmap in memory and fills it lazily as FAT sectors are read for general use. This means that the longer one uses a FAT32 volume, the faster file creation and writes get. This is a strict improvement over most other FAT32 drivers, which start slow ad remain slow.

7 comments:

selmo said...

why not another FS?

Dmitry Grinberg said...

because SD cards use FAT and I thus need to support it, since it makes no sense to make everyone use another FS

Erb said...

In addition to just keeping the free cluster cache in memory, why not save it on disk in a special file, as a sort of optional FAT32 extension? That way, if someone inserts a DGOS-prepped SD card, you can take advantage of earlier information. If the extension is not there, just proceed to re-collect the information.

Dmitry Grinberg said...

I considered this, like the $MFT on NTFS, BUT this would (1) use space on card, and (2) would need to be rebuild after card is used by any other device, making it mostly pointless.

Gorod said...

Speaking of NTFS, are you considering supporting it?

I read it's a fairly good FS, but I don't know if it is a) too much work and b) not sufficiently relevant for mobile devices.

Dmitry Grinberg said...

a and b are both true

but you can make a DGOS kernel plugin for it if you want :-)

It's not hard. AS a FS all it has to do to become useable is to make a call to vfsFsRegister(). After that all you have to do is write the FS :)

Coffee-Turtle said...

you said the magic word, Dmitry: FASTER! One drawback with the current LD is that it over time it seems to go slower. Even though I can simulate some of the "features" of an iPhone, it takes forever to switch between apps and even load some apps into memory. Sure a soft reset helps, but that takes a bit of time to get the LD rebooted! I look forward to the new speeds built into DGOS! Thanks!