The msdos file system code in FreeBSD did not count the number of directory slots used/free in the root directory of a FAT12 or FAT16 file system. The number of available DOS-8.3 style directory entries is fetched from the boot block and e.g. displayed by "df -i" as the number of available inodes, but statfs() returns 0 as the number of free entries.
This causes monitoring software to warn about a directory that is 100% full.
This patch set adds free entry accounting to the msdos file system:
- the number of used directory entries is counted when a FAT12 or FAT16 file system is mounted
- the number is adjusted by all operations that affect the count (create, rename, or delete of a file or directory).
The file system code is unchanged except for the initialization and updating of the new msdos mount structure element used to count the number of free directory entries, which can only be queried using statfs().
These patches do not affect FAT32 file systems (which have no limit on the number of files in the root directory and which report 0 for available and free inodes).