Page 1 of 1

File Systems

Posted: Sun Aug 22, 2004 11:09 am
by XStream
Hey,

What are you implementing as your native file system? Are you considering designing your own?

How do various file systems track free space? The reason I ask this is because I am considering creating my own simple file system. I have looked at the docs for various file systems but don't really understand them. I know, I shouldn't be creating one if I can't understand existing ones but I want to experiment and learn a bit along the way. ;)

Cheers.

Re:File Systems

Posted: Sun Aug 22, 2004 1:26 pm
by jinksys
If you are implementing your own, take a look at this book: (free pdf)

http://www.nobius.org/~dbg/practical-fi ... design.pdf

Re:File Systems

Posted: Sun Aug 22, 2004 9:11 pm
by XStream
Thanks for that jinksys, that is a really helpful book. :)

Cheers.

Re:File Systems

Posted: Sun Aug 22, 2004 10:35 pm
by crc
What are you implementing as your native file system? Are you considering designing your own?
I've chosen to implement my own. There are two approaches I'm looking into. The first is basically is a simple, linear allocation of 1k blocks. A file takes a minimum of 1k, and the maximum size will likely be a couple of megabytes.

The size allocations are predetermined. There are X number of 1k blocks, Y number of 2k blocks and so on. These are stored in a table taking a form like:

Code: Select all

; Header for 1k table
size dd 1024
entries dd 10

; Block 1
in_use dd ? ; 0 = no, 1 = yes
name_length dd ?
name rb 32

; Block 2
in_use dd ? ; 0 = no, 1 = yes
name_length dd ?
name rb 32

...
When a file is saved, the system finds the smallest availible block that will hold it. This is set to 'used', the name (max 32 bytes at the moment) is stored, and the length of the name is set. If the file grows or shrinks, the old location info is cleared and a new block is selected.

The second approach I'm exploring is a static array of fixed-size blocks. This would waste more space than the first option, but would be easier to implement and persistance would fit over it more easily. Likely both will eventually come into being and the users could choose which form to use...

Of course these are both rough approximations of what I want; I'm gradually refining them as time allows :-)