Xv6 is usually a good source to learn about OS primitives:
https://pdos.csail.mit.edu/6.828/2016/xv6.html
I have not looked at the filesystem implementation, but since it is designed as a teaching OS, my guess is that it should be a good entry point.