Page MenuHomeFreeBSD

makefs/zfs: Allow the autotrim pool property to be set
ClosedPublic

Authored by rcm on Tue, Oct 6, 8:26 PM.
Tags
None
Referenced Files
F175117462: D60420.id188977.diff
Thu, Oct 8, 9:28 AM
F175117211: D60420.id188903.diff
Thu, Oct 8, 9:25 AM
F175117036: D60420.id188958.diff
Thu, Oct 8, 9:23 AM
F175116991: D60420.diff
Thu, Oct 8, 9:23 AM
Unknown Object (File)
Wed, Oct 7, 2:34 PM
Unknown Object (File)
Wed, Oct 7, 2:34 PM
Unknown Object (File)
Wed, Oct 7, 1:35 PM
Unknown Object (File)
Wed, Oct 7, 2:58 AM

Details

Summary

Add an "autotrim" option taking "on" or "off". The value is stored in
the pool properties object alongside "bootfs", so the imported pool
starts trimming freed space automatically without a separate
"zpool set" step. When the option is omitted nothing is written and
the pool keeps the default ("off"), exactly as before.

A string option is used rather than makefs's boolean option type since
the latter ignores its value, which would make "autotrim=off" enable
the feature.

Define the spa_autotrim_t enumeration in the boot zfsimpl.h, copied
from OpenZFS's sys/spa.h, so that makefs can refer to SPA_AUTOTRIM_OFF
and SPA_AUTOTRIM_ON by name. The loader does not use it.

Document the option in makefs(8) and add a regression test.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

Test Plan

Regression test included

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rcm requested review of this revision.Tue, Oct 6, 8:26 PM
rcm retitled this revision from makefs: zfs: Allow the autotrim pool property to be set to makefs/zfs: Allow the autotrim pool property to be set.
rcm edited the summary of this revision. (Show Details)

Looks fine to me aside from a couple of nits. Please go ahead and commit without re-uploading if you want.

sys/cddl/boot/zfs/zfsimpl.h
913

This isn't really the right place to declare what the default is. That's up to the consumer, this header isn't specific to makefs.

usr.sbin/makefs/zfs.c
260

Could you please add an explicit initialization zfs->autotrimval = SPA_AUTOTRIM_OFF for the default case? I know it's redundant, but having it spelled out is a bit nicer for readers.

This revision is now accepted and ready to land.Wed, Oct 7, 2:43 PM