insane-adding-machines / frosted

Frosted: Free POSIX OS for tiny embedded devices
GNU General Public License v2.0
215 stars 39 forks source link

Find a way to reduce # of fnodes when mounting filesystems #74

Open danielinux opened 8 years ago

danielinux commented 8 years ago

When a filesystem is mounted, frosted scans the whol content and creates fnodes accordingly.

Perhaps the fnodes should only be allocated during lookup (fno_search), or when opendir/readdir is called, in order to decrease the number of active fnodes, and the memory required.

acardace commented 6 years ago

@danielinux @brabo what do you think? the problem here is obvious... any feedback on how to get around this? what does readdir_r() call behind the curtain?

danielinux commented 6 years ago

https://github.com/insane-adding-machines/frosted/blob/master/kernel/vfs.c#L641

brabo commented 6 years ago

and opendir does call fno_search, so before readdir the loading has happened unless I am missing something.

acardace commented 6 years ago

opendir() just does fno_search on the directory file, it doesn't look for the files inside the directory, that's why it doesn't work just like this.

brabo commented 6 years ago

if lookup is called with a directory it would populate that on FS level. i am not sure i see any problem. the thing i wonder is though, if opendir is called on say '/mnt/sub1/sub2/sub3/sub4', what exactly do we want/need to cache from lookup? that whole tree and their contents?