root@localhost:~ # uname -a FreeBSD localhost.localdomain 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64 root@localhost:~ # zpool create test da1 && zpool get autotrim test && zpool destroy test && zpool create -o autotrim=on test da1 && zpool get autotrim test NAME PROPERTY VALUE SOURCE test autotrim off default NAME PROPERTY VALUE SOURCE test autotrim on default On the 2nd run, when autotrim enabled, property should be listed al "local" instead of default.
Note that default value is "on", so the pool created without passing autotrim option should report "on default", and the pool created with autotrim=off should report "off local" (same for values set after creation).
(In reply to Yuri Pankov from comment #1) >> Note that default value is "on" Interesting, zpoolprops(7) in releng/13.2 says the opposite: > $ man zpoolprops | col -bx | grep -A6 autotrim > autotrim=on|off > When set to on space which has been recently freed, and is no > longer allocated by the pool, will be periodically trimmed. This > allows block device vdevs which support BLKDISCARD, such as SSDs, > or file vdevs on which the underlying file system supports hole- > punching, to reclaim unused blocks. The default value for this > property is off.
(In reply to Anton Saietskii from comment #2) Yes, it is a bug in documentation. Please see the following commit: https://github.com/openzfs/zfs/commit/5e7eaf8fbda348db9878ce013ecb4ab5e9b5cf5a
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=d2a45e9e817ad68f3e163d13404744b8ea9c675b commit d2a45e9e817ad68f3e163d13404744b8ea9c675b Author: Yuri Pankov <yuripv@FreeBSD.org> AuthorDate: 2023-06-29 18:22:50 +0000 Commit: Yuri Pankov <yuripv@FreeBSD.org> CommitDate: 2023-06-29 20:14:18 +0000 openzfs: use IN_BASE instead of IN_FREEBSD_BASE in spa.h Consistently use IN_BASE to allow libzfs to get the same default autotrim value as kernel does. Note that this does not change the default value itself, rather fixing the source of value and the value itself in e.g. zpool get output if it was not set explicitly. (And as a reminder, default value of autotrim on FreeBSD is 'on', despite what zpoolprops(7) says currently.) PR: 264234 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D40075 sys/contrib/openzfs/include/sys/spa.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
(In reply to commit-hook from comment #4) Few questions here: 1. Is there a plan for MFC? (I would like to see MFS as well, but understand that change may be not important enough.) 2. Should the patch apply to releng/13.2 right away? Perhaps I'll decide to fix this issue immediately. 3. Is there a plan to fix zpoolprops(7)?
(In reply to Anton Saietskii from comment #5) Sorry, I had to revert the change for the moment, as I clearly didn't think it through (got confused by defines naming).
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=b36f469a15ecf508a2fdc2b58a76f0f2b4a0b88d commit b36f469a15ecf508a2fdc2b58a76f0f2b4a0b88d Author: Yuri Pankov <yuripv@FreeBSD.org> AuthorDate: 2023-07-17 09:12:53 +0000 Commit: Yuri Pankov <yuripv@FreeBSD.org> CommitDate: 2023-07-18 09:20:11 +0000 zfs: set autotrim default to 'off' As it turns out having autotrim default to 'on' on FreeBSD never really worked due to mess with defines where userland and kernel module were getting different default values (userland was defaulting to 'off', module was thinking it's 'on'). PR: 264234 Reviewed by: mav (zfs) Differential Revision: https://reviews.freebsd.org/D41056 sys/conf/kern.pre.mk | 3 +-- sys/contrib/openzfs/include/sys/spa.h | 6 ------ sys/contrib/openzfs/module/zcommon/zpool_prop.c | 2 +- sys/modules/zfs/Makefile | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-)
Just a note here: autotrim was really defaulting to 'off' (due to confusion with defines) despite the attempt to keep it as 'on' when switching to openzfs, so man page is correct (even if by coincidence).
On main: # zpool create test md0 && zpool get autotrim test && zpool destroy test && zpool create -o autotrim=on test md0 && zpool get autotrim test NAME PROPERTY VALUE SOURCE test autotrim off default NAME PROPERTY VALUE SOURCE test autotrim on local Is there anything left to do?
(In reply to Mark Johnston from comment #9) MFC maybe?