On the smaller side, Ext4 at just 21,515 lines, and on the larger side, Btrfs at 55,758 lines.
It almost makes me think that writing a new file system in Rust, might actually be a tractable project.
On the smaller side, Ext4 at just 21,515 lines, and on the larger side, Btrfs at 55,758 lines.
It almost makes me think that writing a new file system in Rust, might actually be a tractable project.
Obviously ext2 is a very outdated filesystem by today's standards, but considering ext3 and ext4 are essentially just some extensions slapped onto ext2, I still didn't expect it.
Another thing I found really impressive was just how resilient e2fsck is. During early development of my ext2 code I frequently mangled the file system in a myriad of weird ways, but no matter how much I broke things, e2fsck was almost always able to restore the file system into a reasonable state.
(For the curious, there is some excellent documentation on the ext2 file system at https://www.nongnu.org/ext2-doc/ext2.html that I mostly used for my implementation of it. Sadly no such thing seems to really exist for ext3/ext4).
When people tried to do a full-featured filesystem, with a remarkable exception (ZFS) it's either a disappointing unfinished mess (btrfs) or a promising, but a long-term project taking years (bcachefs).
Making a filesystem with strong support of important features is an extremely demanding project.
Lines of code isn't the only important metric. A project with a smaller number of LoC can take a long time to fully test and debug and validate.
45KLOC of C code already sounds really scary to me, although yeah, journaling is really nice to have.
About the only class of scenarios to use BTRFS instead of ZFS is if you want the features, do not need RAID5/6, require support by Linux distributor/kernel developers or for some other (hard to think of) reason you can't use ZFS.
I do use BTRFS on a single disk where I don't touch it with cli tools, and there it's fine.
https://arstechnica.com/gadgets/2021/09/examining-btrfs-linu...
What's harder is making them as robust as they need to be for practical daily use. Doing that is a matter of comprehensive testing, though. With filesystems, the hard part is QA, not implementation.