Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2006 12:45:16 +0200
From:      Pawel Jakub Dawidek <>
Subject:   Porting ZFS file system to FreeBSD.
Message-ID:  <>

next in thread | raw e-mail | index | archive | help

Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable


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

You can find all those on FreeBSD perforce server:

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 2=
006     root@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

	        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
- .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                              
FreeBSD committer                         Am I Evil? Yes, I Am!

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.4 (FreeBSD)



Want to link to this message? Use this URL: <>