Speed up 'zfs list -t snapshot -o name -s name'
authorPawel Jakub Dawidek <pawel@dawidek.net>
Tue, 29 May 2012 17:50:50 +0000 (10:50 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 14 Jun 2012 16:49:04 +0000 (09:49 -0700)
commit0cee24064a79f9c01fc4521543c37acea538405f
treecc7429b7bc14f057aade9bea66a72a39e6a5a23c
parent74497b7ab6af69434453e03c755d3f6e6e655aee
Speed up 'zfs list -t snapshot -o name -s name'

FreeBSD #xxx:  Dramatically optimize listing snapshots when user
requests only snapshot names and wants to sort them by name, ie.
when executes:

  # zfs list -t snapshot -o name -s name

Because only name is needed we don't have to read all snapshot
properties.

Below you can find how long does it take to list 34509 snapshots
from a single disk pool before and after this change with cold and
warm cache:

    before:

        # time zfs list -t snapshot -o name -s name > /dev/null
        cold cache: 525s
        warm cache: 218s

    after:

        # time zfs list -t snapshot -o name -s name > /dev/null
        cold cache: 1.7s
        warm cache: 1.1s

NOTE: This patch only appears in FreeBSD.  If/when Illumos picks up
the change we may want to drop this patch and adopt their version.
However, for now this addresses a real issue.

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #450
cmd/zfs/zfs_iter.c
cmd/zfs/zfs_iter.h
cmd/zfs/zfs_main.c
include/libzfs.h
include/sys/zfs_ioctl.h
lib/libzfs/libzfs_dataset.c
lib/libzfs/libzfs_sendrecv.c
module/zfs/zfs_ioctl.c