[PATCH 2/2] dosfs: Lazy update of FAT32 FS info sector

Chris Johns chrisj at rtems.org
Thu Nov 8 23:27:57 UTC 2012


Claus, Ric wrote:
> On Nov 8, 2012, at 1:11 PM, Sebastian Huber wrote:
>
>> On 08/11/12 19:34, Claus, Ric wrote:
>>> Unlike as for Linux and Windows, there is no shutdown procedure for RTEMS.
>> What about unmount()?
> Who calls unmount()?

If you have removable media such as a USB stick or a Compact Flash card 
you need to call it before the device is removed. There are RTEMS system 
that do this. Other systems mount then unmount the file system rather 
than leave it mounted.

>>> Consequently, the unmount is in most cases never called.  Given that, what is the effect of this patch on FAT formatted persistent storage devices that have been modified during a boot cycle?

In relation to the boot cycle question I am sorry but I do not 
understand it. Do you mean something in a boot monitor updates the disk 
or is something in RTEMS's boot cycle updating the disk ?

The relation to this patch the fatgen103 document I have handy on page 
23 states for FSI_Free_Count:

   "Contains the last known free cluster count on the volume. If
    the value is 0xFFFFFFFF, then the free count is unknown and
    must be computed. Any other value can be used, but is not
    necessarily correct. It should be range checked at least to
    make sure it is <= volume cluster count."

This means we set the value to 0xFFFFFFFF which is what the patch does 
(well cleans up) and we set to the last known count when we unmount if 
unmount is called. If it is not called the value is 0xFFFFFFFF, and if 
unmount is called it is set. If the disk is mounted again and the file 
system updated and unmount is not called the "but is not necessarily 
correct." part comes into play. Therefore as Sebastian states it is a hint.

The usefulness of this value is questionable because it only provides 
the last count of free clusters. The cluster table itself is the only 
true record of the state and should be read and these value calculated 
when mounting. The next FS info value in the table is FSI_Nxt_Free. The 
cluster table can have holes therefore you need to search the table for 
those holes. FAT-FS performance drops off when it becomes full because 
of this and why compaction was widely adopted.

I have not reread the whole document so I do not know if other areas of 
the spec relate or effect the quoted section.

Chris



More information about the devel mailing list