HomeFreeBSD

zfs list: Allow more fields in ZFS_ITER_SIMPLE mode

Description

zfs list: Allow more fields in ZFS_ITER_SIMPLE mode

If the fields to be listed and sorted by are constrained to those
populated by dsl_dataset_fast_stat(), then zfs list is much faster,
as it does not need to open each objset and reads its properties.

A previous optimization by Pawel Dawidek
(0cee24064a79f9c01fc4521543c37acea538405f) took advantage
of this to make listing snapshot names sorted only by name much faster.

However, it was limited to -o name -s name, this work extends this
optimization to work with:

  • name
  • guid
  • createtxg
  • numclones
  • inconsistent
  • redacted
  • origin

and could be further extended to any other properties supported by
dsl_dataset_fast_stat() or similar, that do not require extra locking
or reading from disk.

This was committed before (9a9e2e343dfa2af28bf7910de77ae73aa006de62),
but was reverted due to a regression when used with an older kernel.

If the kernel does not populate zc->zc_objset_stats, we now fallback
to getting the properties via the slower interface, to avoid problems
with newer userland and older kernels.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Closes #14110

Details

Provenance
allanjudeAuthored on Dec 14 2022, 1:27 AM
GitHub <noreply@github.com>Committed on Dec 14 2022, 1:27 AM
Parents
rG70ac2654f579: Change ZEVENT_POOL_GUID to ZEVENT_POOL to display pool names
Branches
Unknown
Tags
Unknown