Re: FAT32 statfs(2) inode usage

From: Ben Woods <woodsb02_at_freebsd.org>
Date: Tue, 07 Mar 2023 10:20:43 UTC
On Tue, 7 Mar 2023, at 6:11 PM, Stefan Esser wrote:
>
> I could implement a counter that provides a useful value for f_ffree by
> counting all file and directory creations and removals from the root
> directory of a FAT12/FAT16 file system.

If I’m right, the file system could easily be mounted outside of FreeBSD on another machine that doesn’t maintain the counter. For example, a USB stick shared between machines. Trying to infer state from past events is always hard. Instead, how hard would it be to have the kernel count the current number of root directory entries at the time the statfs request is issued (live)?

>
> If you are interested in testing / review of the proposed change, I'll
> try to provide it ...
>
> Regards, STefan

I’m absolutely happy to provide code review and testing to support this change - but can only offer within my capabilities. I am a ports committer (not src), with novice c skills and almost zero kernel experience.

Regards,
Ben

-- 
From: Ben Woods
woodsb02@freebsd.org