Porting ZFS file system to FreeBSD.

Pawel Jakub Dawidek pjd at FreeBSD.org
Tue Aug 22 10:45:38 UTC 2006


Hi.

I started porting the ZFS file system to the FreeBSD operating system.

There is a lot to do, but I'm making good progress, I think.

I'm doing my work in those directories:

	contrib/opensolaris/ - userland files taken directly from
		OpenSolaris (libzfs, zpool, zfs and others)

	sys/contrib/opensolaris/ - kernel files taken directly from
		OpenSolaris (zfs, taskq, callb and others)

	compat/opensolaris/ - compatibility userland layer, so I can
		reduce diffs against vendor files

	sys/compat/opensolaris/ - compatibility kernel layer, so I can
		reduce diffs against vendor files (kmem based on
		malloc(9) and uma(9), mutexes based on our sx(9) locks,
		condvars based on sx(9) locks and more)

	cddl/ - FreeBSD specific makefiles for userland bits

	sys/modules/zfs/ - FreeBSD specific makefile for the kernel
		module

You can find all those on FreeBSD perforce server:

	http://perforce.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/user/pjd/zfs&HIDEDEL=NO

Ok, so where am I?

I ported the userland bits (libzfs, zfs and zpool). I had ztest and
libzpool compiling and working as well, but I left them behind for now
to focus on kernel bits.

I'm building in all (except 2) files into zfs.ko (kernel module).

I created new VDEV - vdev_geom, which fits to FreeBSD's GEOM
infrastructure, so basically you can use any GEOM provider to build your
ZFS pool. VDEV_GEOM is implemented as consumers-only GEOM class.

I reimplemented ZVOL to also export storage as GEOM provider. This time
it is providers-only GEOM class.

This way one can create for example RAID-Z on top of GELI encrypted
disks or encrypt ZFS volume. The order is free.
Basically you can put UFS on ZFS volumes already and it behaves really
stable even under heavy load.

Currently I'm working on file system bits (ZPL), which is the most hard
part of the entire ZFS port, because it talks to one of the most complex
part of the FreeBSD kernel - VFS.

I can already mount ZFS-created file systems (with 'zfs create'
command), create files/directories, change permissions/owner/etc., list
directories content, and perform few other minor operation.

Some "screenshots":

	lcf:root:~# uname -a
	FreeBSD lcf 7.0-CURRENT FreeBSD 7.0-CURRENT #74: Tue Aug 22 03:04:01 UTC 2006     root at lcf:/usr/obj/zoo/pjd/lcf/sys/LCF  i386

	lcf:root:~# zpool create tank raidz /dev/ad4a /dev/ad6a /dev/ad5a

	lcf:root:~# zpool list
	NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
	tank                   35,8G   11,7M   35,7G     0%  ONLINE     -

	lcf:root:~# zpool status
	  pool: tank
	 state: ONLINE
	 scrub: none requested
	config:

	        NAME        STATE     READ WRITE CKSUM
	        tank        ONLINE       0     0     0
	          raidz1    ONLINE       0     0     0
	            ad4a    ONLINE       0     0     0
	            ad6a    ONLINE       0     0     0
	            ad5a    ONLINE       0     0     0

	errors: No known data errors

	lcf:root:# zfs create -V 10g tank/vol
	lcf:root:# newfs /dev/zvol/tank/vol
	lcf:root:# mount /dev/zvol/tank/vol /mnt/test

	lcf:root:# zfs create tank/fs

	lcf:root:~# mount -t zfs,ufs
	tank on /tank (zfs, local)
	tank/fs on /tank/fs (zfs, local)
	/dev/zvol/tank/vol on /mnt/test (ufs, local)

	lcf:root:~# df -ht zfs,ufs
	Filesystem            Size    Used   Avail Capacity  Mounted on
	tank                   13G     34K     13G     0%    /tank
	tank/fs                13G     33K     13G     0%    /tank/fs
	/dev/zvol/tank/vol    9.7G    4.0K    8.9G     0%    /mnt/test

	lcf:root:~# mkdir /tank/fs/foo
	lcf:root:~# touch /tank/fs/foo/bar
	lcf:root:~# chown root:operator /tank/fs/foo /tank/fs/foo/bar
	lcf:root:~# chmod 500 /tank/fs/foo
	lcf:root:~# ls -ld /tank/fs/foo /tank/fs/foo/bar
	dr-x------  2 root  operator  3 22 sie 05:41 /tank/fs/foo
	-rw-r--r--  1 root  operator  0 22 sie 05:42 /tank/fs/foo/bar

The most important missing pieces:
- Most of the ZPL layer.
- Autoconfiguration. I need implement vdev discovery based on GEOM's taste
  mechanism.
- .zfs/ control directory (entirely commented out for now).
And many more, but hey, this is after 10 days of work.

PS. Please contact me privately if your company would like to donate to the
    ZFS effort. Even without sponsorship the work will be finished, but
    your contributions will allow me to spend more time working on ZFS.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20060822/79939324/attachment.pgp


More information about the freebsd-fs mailing list