Big win for ZFS on Linux today

published Jul 16, 2008, last modified Jun 26, 2013

ZFS-FUSE can deliver enough performance to be usable on Linux, with a new patch.

ZFS through FUSE is now much faster on Linux thanks to a patch Ricardo Correia developed and I improved, against the latest code in the ZFS-FUSE repository. Further big wins are expected soon.

Heads up: 64 bits are needed for high performance -- I'm still running 32 bits so there's lots of low-hanging fruit to be reaped. Why 64 instead of 32 bits? Integer arithmetic.
atomic_add_64, the function in the ZFS sources that accounts for the most CPU time, is over twenty instructions of 32 bits assembler guarded by mutexes. The same function in 64 bits is one instruction. One.

The updated patch is here:

diff -r 008c531499cd src/zfs-fuse/zfs_operations.c
--- a/src/zfs-fuse/zfs_operations.c     Thu Oct 30 16:45:21 2008 +0100
+++ b/src/zfs-fuse/zfs_operations.c     Sat Dec 06 22:59:49 2008 -0500
@@ -213,15 +213,22 @@

        cred_t cred;
        zfsfuse_getcred(req, &cred);
+       struct fuse_entry_param e = { 0 };

        error = VOP_LOOKUP(dvp, (char *) name, &vp, NULL, 0, NULL, &cred, NULL, NULL, NULL);
        if(error)
+       {
+               if (error == ENOENT) {
+                       /* Cache negative entries */
+                       error = 0;
+                       e.ino = 0;
+                       e.entry_timeout = 3600;
+               }
                goto out;
+       }

-       struct fuse_entry_param e = { 0 };
-
-       e.attr_timeout = 0.0;
-       e.entry_timeout = 0.0;
+       e.attr_timeout = 3600.0;
+       e.entry_timeout = 3600.0;

        if(vp == NULL)
                goto out;

This patch gives an estimated fourfold to eightfold performance improvement in syscalls involving metadata lookups like stat and lstat.