ZFS Port: Three-Quarter Term Report

Blog post by generalmaximus on Sat, 2011-08-06 04:46

Briefly, my goals for the three quarter term were: port libzfs, port the commandline tools zfs and zpool, and write a kernel module to communicate with userland tools via ioctl() calls on a /dev/zfs. Another goal was to make sure our port of ZFS passes all tests in ztest.

With the exception of a few missing routines, libzfs builds fine on Haiku. So does zpool. zfs requires some love, but nothing major remains to be done. In fact, with the exception of a few routines that I need to implement in libsolcompat (our Solaris compatibility library), the port builds almost perfectly on Haiku. But getting it to build is only half the battle ;)

The issue that's holding me back at the moment is that our port fails ztest, and the multithreaded nature of ZFS makes bugs extremely hard to track down and fix. For example, about a week ago ztest would fail when trying to write to disk. That turned out to be a fairly trivial issue -- wrong flags passed to an open() call because my definition of a constant was wrong -- but took me four days to track down. Now I'm facing an issue where all the threads in ztest deadlock after while and the program sits there forever, doing nothing. Since the ZFS code spawns so many threads, it's very hard to figure out where the problem originates.

I wanted to get ztest under control this week, but I failed. Now I've been studying how Solaris expects threads and synchronization primitives to behave from the excellent Solaris Internals book. I will hopefully be able to fix ztest before the next week ends and wrap up the missing routines in libsolcompat. If we pass ztest, it means the code we ported works perfectly.

My goal for the final stretch of the GSoC was to implement the ZFS POSIX Layer. That would allow us to actually perform read/write operations on ZFS partitions. Sadly, I might not have time to do this before the coding period ends, but I'll give it my best shot.

I hope to get back here with good news soon.