Hi Tom, Rugxulo et al,

To comment on the underlying performance bottleneck:

For FAT32 drives, the FAT itself is huge. Which means it takes
time to process it, for example to find out how many clusters
are free. It actually comes with a filesystem info sector with
places where you can store that count, so you do not have to
browse the whole FAT each time you want to know. You can also
keep the value in RAM, of course.

The problem is that if you do not trust the FSinfo data, you
have to read the whole FAT (either during boot or) when the
first app calls the API which tells how much free space you
currently have on some FAT drive.

This will take a long time, and in particular if you do not
have a large enough cache loaded at that moment, it will not
even have the side-effect of caching the FAT for whatever you
want to do with the FAT later, for example growing a file etc.

Given how unpleasant all of this is for performance, you might
understand why Win9x keeps a copy of the whole FAT in RAM :-p

Which in turn made Win9x unable to work with FAT32 drives if
they have too many clusters in relation to RAM size, I think.

Either way, you cannot have 8086 compatibility, FAT32 drives
and good performance at the same time. Just pick your pain ;-)

As said, if you can delay the big counting of free clusters
until you have loaded a cache, preferably one with read-ahead
to compensate for DOS only looking at one FAT sector at a time,
then you can reduce the pain. IF you have 386+ and much RAM.

Doesn't FAT32 already keep the amount of free space stored somewhere?

No, And for a good reason.
DOS crashes regularily, with no opportunity to write back
this number to the disk before shutting down.

That is why Windows keeps a flag on whether you have properly
closed (unmounted) a drive. If you have, it can still trust
the FSinfo data to some degree. DOS could do something similar.

If I remember correctly (from dosfsck) the flag is stored in
the 0th entry of one of the FAT copies, or the FSinfo sector?

No slow calculation at bootup needed.

This is not at bootup, but at the first time
"free disk space" is requested.

Which is typically when you first use DIR after boot, I guess.

Regards, Eric




_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to