|
|
Porting ZFS to other platformsSeveral people have asked about porting ZFS to other platforms, as well as volunteering to port the code themselves. This page exsists to assist folks with the porting process, as well as provide a common page for people to share their experiences and gotchas they find. If you are porting ZFS to another platform and would like to add to this page, please email one of the community leaders, who can make you a leader so that you may edit this content. Active PortsFUSERicardo Correia is porting ZFS to FUSE as a userland filesystem. You can find the project page at: http://www.wizy.org/wiki/ZFSonFUSE As well as Ricardo's blog at: http://zfs-on-fuse.blogspot.com/ FreeBSDPawel Jakub Dawidek has ported ZFS to FreeBSD. You can find the FreeBSD repository at: http://perforce.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/user/pjd/zfs NetBSDOliver Gould is porting ZFS to NetBSD. More info at: http://netbsd-soc.sourceforge.net/ Mac OS XDon Brady and Noel Dellofano have ported ZFS to OS X at Apple. More information including source code and binaries for download can be found at: gcc InformationThe ZFS source code, as with all of ON, is built with gcc as part of the 'shadow compilation' designed to detect gcc-specific warnings. However, we do use a slightly modified set of warnings to get the clean build we have today. You can see some of the details in the compiler wrapper we use in ON. In particular, we use the following warning flags:
As well as the Suggested phasesWhile there are several ways to approach a ZFS port, here is a suggested set of milestones. This uses terms from the source tour, so you should be familiar with the layout of the ZFS source code an rough layering before reading further. libzpool and ztestlibzpool is a userland port of the SPA (Storage Pool Allocator) and DMU (Data Management Unit), and includes a large percentage of the relevant source code. It is designed to allow for userland testing with ztest, as well as debugging via zdb. It has the convenient attribute that the kernel-specific code has already been factored out as zfs_context.h, and should be relatively simple to port. You can find the Solaris port of these interfaces (those that can't be accomplished with a #define) at usr/src/lib/libzpool/common. If you can successfully run ztest in a loop for a day with no problems, you've probably ported 80% of the kernel code (though the most difficult 20% still remains). This will also involve porting zdb, which is used as part of ztest. zpool(1M) and zfs(1M)The next step is to get the userland management tools, [zfs(1M)]( http://cvs.opensolaris.org/source/xref/on/usr/src/cmd/zfs/) and zpool(1M), working and creating datasets. This doesn't involve actually mounting the filesystems (which would require the ZPL), but does establish the userland -> kernel interfaces and verifies that the DSL is working properly. For the kernel side, you will need to create zvolA simple in-kernel consumer to get working is the zvol (ZFS volume) interface. This will require some OS-specific device knowledge, but the DMU interface is very simple. See zvol.c. ZFS filesystemsThe final hurdle is the most difficult, as it will have to be largely written from scratch using OS-specific VFS interfaces. The current ZPL code can serve as a guideline for ideas about how to approach an implementation, but it is extremely Solaris-specific. Some ideas (extended attributes, NFSv4/NT ACLs) may not translate at all to some operating systems. |