File Systems

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
XStream

File Systems

Post 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.
jinksys

Re:File Systems

Post 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
XStream

Re:File Systems

Post by XStream »

Thanks for that jinksys, that is a really helpful book. :)

Cheers.
crc

Re:File Systems

Post 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 :-)
Post Reply