simplefs - a ridiculosly simple file system from the scratch
sankar.curiosity at gmail.com
Mon Aug 5 14:57:52 EDT 2013
For learning purposes, I thought I would implement a filesystem from
the scratch. It has reached a state where I can do a 1.0 release.
The sources are at: https://github.com/psankar/simplefs
The layout is simple. The first (zeroth) block is the superblock and
contains information like fs magic, number of inodes, freeblock map
etc. The next block is the inode store. Creation of files and
directories is supported. Nested directories are supported. A file can
grow up to one block only. The data blocks for a directory contain the
filename and inode number of its children. For files, it will
obviously contain the actual data of the file. There are three
rudimentary locks to make sure the accesses are thread safe.
The 1.0 version is filled with a lot of TODOs and memory leaks. Also
while implementing this, I realized that it is a bad idea to maintain
the superblock and the freeblock store together in a block. So I am
planning to change the on-disk layout in the next version.
Apart from moving the super block to minimize locks, I am planning to
implement support for extents in the next version, and journalling in
the next-to-next version. The next version will take some time to
come, though. But if someone wants to try filesystems from the
scratch, I thought it may be useful if I share the link now itself.
Also, I take this moment to thank the kernelnewbies list, especially
the regular people like Mulyadi Santosa, Valdis Kletnieks, Rajat
Sharma, Greg Freemyer etc. Also I would like to thank Neha Naik,
Manish Katiyar who helped me with some queries during this particular
implementation. I saw that Manish Katiyar has also done a similar
from-the-scratch implementation and it motivated me to pursue further.
Any feedback on the code is welcome. Although, I want to inform that I
plan to change the locking until after I decide on a good on-disk
layout for the next version, which will by-design minimize the locking
needs, by splitting out freestore from superblock, keep track of
children inode in a better way etc. Also I have been resisting the
urge to look at ext or any other filesystem's design so as to not skew
my thoughts and go with a fresh state of mind and get my own design :)
More information about the Kernelnewbies