This past week has not been excessively productive because I spent some time dealing with long overdue pkgsrc tasks (mainly updating GNOME to 2.10.2, the latest stable version) and was away from computer more time than usual. Anyway, I have done a bunch of things, although they are not as visible as the work from other weeks (this is, in part, why I felt less productive).

I started by adding support for local sockets, which was easy enough to do but caused panics (specially when switching /tmp to tmpfs and starting an X session).

Then I tried to switch memory pools to use anonymous memory, so that all file meta-data was pageable. I did several clumsy tests and, while it mostly worked, the system crashed after intensive usage of the file-system (such as decompressing pkgsrc over it). I had to give this up because I had some other stuff to do (see below) and this was consuming much time.

The next thing I did was to rework the way pools were handled by making them file-system specific and by implementing a tmpfs-specific extension of them. There are several benefits from this change, but the most important one is that tmpfs is now able to control memory usage in a fine-grained manner.

Later on I added NFS support by defining the VFS operations I was missing. This was harder than I thought, mostly because the lack of documentation, but after some time I got something that basically works. There are still some some serious issues, so I'd not call tmpfs as NFS-ready yet. I'm afraid that these problems are not specific to NFS; i.e., NFS is only exposing some real bugs in the code. We'll see.

Related to the previous, I was disappointed to see that I had to modify mountd's code to be able to export tmpfs file-systems. I have some ideas to improve this, thus making mountd file-system independent, but I'll delay them until SoC's deadline has passed.

Furthermore, I cleaned up some parts of the code: split the different vnode operations vectors into different source files (tmpfs_vnops.c, tmpfs_fifoops.c and tmpfs_specops.c) for better readability and to get shorter files, split the main tmpfs.h file into several headers, cleaned up inclusions and centralized some code.

At last, I wrote the document describing tmpfs internals. This is in the form of a manual page in the 9th section, and can be found in the CVS. If you want to visualize it, you can run the following command: groff -Tascii -mdoc tmpfs.9 | less after fetching the file. It may lack some details, but I feel it is quite complete, though it assumes prior knowledge of how file-systems work within NetBSD.

What I'm going to target this week (after prior agreement with my mentors) is the other so-promised document I've been talking about: a complete document that describes how to write file-systems for NetBSD. I started it yesterday, and it is proving to be very difficult to explain things in a clean and well-structured way (mostly because I want to avoid big code examples without real explanations).

Go to posts index

Comments from the original Blogger-hosted post: