# ZFS apply patch 8 MB record size rebuild kernel



## Zippo Windproof (Dec 5, 2014)

Hello, I am new to FreeBSD.

How could I apply this (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=178388) patch to FreeBSD 10.1-RELEASE? I've downloaded all sources to /usr/src but was unable to run `patch -p0 < file.diff` successfully. So I tried to patch ZFS manually, then `make buildworld; make buildkernel; make installkernel; reboot` but after that I was still limited only to 128 KB record size.

I would be thankful for every suggestion or tip, how to patch the system, or how to rebuild the kernel with fixed ZFS.

Thanks.


----------



## Terry_Kennedy (Dec 6, 2014)

Zippo Windproof said:


> I would be thankful for every suggestion or tip, how to patch the system, or how to rebuild the kernel with fixed ZFS.


First, make sure you're actually running your newly-built kernel. Do a `uname -a` and make sure it shows your username as the builder and the correct (recent) date. For example:


```
[0:3] www2:~> uname -a
FreeBSD www2.example.com 8.4-STABLE FreeBSD 8.4-STABLE #0 r275438M: Wed Dec 3 00:42:13 EST 2014 terry@www2.example.com:/usr/obj/usr/src/sys/R300 amd64
```
If you aren't running the kernel you built, then there's something wrong with your build process. If you are running the kernel you built, please post an example showing how you checked that the record size is still limited to 128 KB.


----------



## Zippo Windproof (Dec 6, 2014)

```
FreeBSD freebsd 10.1-STABLE FreeBSD 10.1-STABLE #2: Fri Dec  5 11:13:41 CET 2014     root@freebsd:/usr/obj/usr/src/sys/GENERIC  amd64
```


```
root@freebsd:~ # zpool list
NAME   SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
tank  9.94G   126K  9.94G     0%  1.00x  ONLINE  -
```

`zfs set recordsize=8M tank`

```
cannot set property for 'tank': 'recordsize' must be power of 2 from 512 to 128k
```


----------



## Terry_Kennedy (Dec 7, 2014)

Zippo Windproof said:


> ```
> FreeBSD freebsd 10.1-STABLE FreeBSD 10.1-STABLE #2: Fri Dec  5 11:13:41 CET 2014     root@freebsd:/usr/obj/usr/src/sys/GENERIC  amd64
> ```
> 
> ...


Well, that's a userland utility. I don't see where you did a `make installworld` to update it.

The other explanation is that your patch didn't apply correctly / completely, but I bet if you check the date on /sbin/zfs, you'll see it wasn't updated.


----------



## Zippo Windproof (Dec 7, 2014)

`make installworld` was what I was looking for 

However the .diff patch does not work anymore. The code seems to be different and newer on FreeBSD 10.X. The patch was originally made for 9.1-STABLE. Some lines of code not mentioned in the .diff should also be patched, just rewrite SPA_MAXBLOCKSIZE to SPA_BIGBLOCKSIZE.

I would suggest to apply the patch ZFS 8M recordsize+sparse file performance in the master FreeBSD branch and just to add warnings what can cause >128K recordsize and to let everyone choose. Patching by hand is boring. The same problem was with ZoL. OI has 1MB recordsize in the default, if I'm not mistaken.

What about AIO support on FreeBSD's ZFS? In ZoL project it should come this year in 0.6.4.


----------



## Terry_Kennedy (Dec 8, 2014)

Zippo Windproof said:


> `make installworld` was what I was looking for
> 
> However the .diff patch does not work anymore.
> 
> I would suggest to apply the patch ZFS 8M recordsize+sparse file performance in the master FreeBSD branch and just to add warnings what can cause >128K recordsize and to let everyone choose. Patching by hand is boring. The same problem was with ZoL. OI has 1MB recordsize in the default, if I'm not mistaken.



The discussion in the bug report you mentioned in your original post ended with "Seems interesting but it's really something that needs to be reviewed and submitted upstream (illumos)." So that would probably be the way to go, or to respond to the bug report (and include yourself on the CC list) and see if things have changed in the year and a half it has been idle. Perhaps the original bug submitter has kept their patch updated for newer FreeBSD versions?



> What about AIO support on FreeBSD's ZFS? In ZoL project it should come this year in 0.6.4.


I'm not quite sure what you're referencing here. Do you mean aio(4), or asynchronous I/O in general? A lot of that is already in the FreeBSD ZFS implementation.


----------



## Zippo Windproof (Dec 8, 2014)

Yes I meant Asynchronous I/O, but in the ZFS not in kernel itself. For example I am using nginx and with AIO enabled it does not work on ZFS if it doesn't have AIO support. So I am curious if ZFS on FreeBSD has AIO support or how to recompile with AIO support. I did not come from Solaris/OS/OI so I am not sure how ZFS handles AIO there, maybe without a problem. ZoL has an implementation of it https://github.com/zfsonlinux/zfs/commit/cd3939c5f06945a3883a362379d0c12e57f31a4d?diff=unified Reading it, it looks like Opensolaris has fine ZFS AIO implementation, so here on FreeBSD it should also work fine.
Will try to play with it in free time, thanks for your tips


----------



## Terry_Kennedy (Dec 8, 2014)

Zippo Windproof said:


> Yes I meant Asynchronous I/O, but in the ZFS not in kernel itself.


In FreeBSD, ZFS _is_ the kernel (at least when the module is loaded). I'm guessing it works because I use an application where AIO is mandatory (AlphaVM Pro) and it works when the VMS filesystem container is on a ZFS volume.

The best place to get a definitive answer would probably be the freebsd-fs@ mailing list, since that's where a lot of the ZFS gurus hang out.


----------



## Zippo Windproof (Dec 8, 2014)

It works like a charm. Tested with nginx and accessed files on ZFS while aio on; and sendfile off; (on gives better results serving large static files, but under Linux it does not work with sendfile off; due to lack AIO on ZFS).

Thanks, looks like ZFS is well maintained, also nginx is well kept and patched. Being happy with first steps under FreeBSD


----------

