I found the following post
http://christopher-technicalmusings.blogspot.se/2011/06/speeding-up-freebsds-nfs-on-zfs-for-esx.html
Is it possible to apply this patch to FreeNAS ?
http://christopher-technicalmusings.blogspot.se/2011/06/speeding-up-freebsds-nfs-on-zfs-for-esx.html
I feel the results speak for themselves, but in case they don't - We're looking at an increase in IOPS, MB/per sec, and a decerease in the time to access the information when we use the modified NFS server code. For this particular test, we're looking at nearly a doubleing in performance. Other tests are close to a 10% increase in speed, but that's still a wanted increase.
These test results will be apperant if you're using the old NFS server (v2 and v3 only) or the new NFS server (v2-3-4) that is now the default in FreeBSD 9 as of a month ago.
I've used this hack for over 6 months now on my SANs without any issue or corruption, on both 8.1 and various 9-Current builds, so I believe it's fairly safe to use.
I'm too lazy to make a proper patch, but manually editing the source is very easy:
- The file is /usr/src/sys/fs/nfsserver/nfs_nfsdport.c
- Go to line 704, you'll see code like this;
(Edit: Now line 727 in FreeBSD-9.0-RC3)
if (stable == NFSWRITE_UNSTABLE)
ioflags = IO_NODELOCKED;
else
ioflags = (IO_SYNC IO_NODELOCKED);
uiop->uio_resid = retlen;
uiop->uio_rw = UIO_WRITE;
- Change the code to look like this below. We're commenting out the logic that decides to allow this to be an IO_SYNC write.
// if (stable == NFSWRITE_UNSTABLE)
ioflags = IO_NODELOCKED;
// else
// ioflags = (IO_SYNC | IO_NODELOCKED);
uiop->uio_resid = retlen;
uiop->uio_rw = UIO_WRITE;
- Recompile your kernel, install it, and reboot - You're now free from NFS O_SYNC's under ESX.
If you are running the older NFS server (which is the default for 8.2 or older), the file to modify is /usr/src/sys/nfsserver/nfs_serv.c - Go to line 1162 and comment out these lines as shown in this example:
// if (stable == NFSV3WRITE_UNSTABLE)
ioflags = IO_NODELOCKED;
// else if (stable == NFSV3WRITE_DATASYNC)
// ioflags = (IO_SYNC IO_NODELOCKED);
// else
// ioflags = (IO_METASYNC | IO_SYNC | IO_NODELOCKED);
Is it possible to apply this patch to FreeNAS ?