diff options
author | pjd <pjd@FreeBSD.org> | 2012-01-21 21:12:53 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2012-01-21 21:12:53 +0000 |
commit | 8e3e986346a1f6262fbbfa8b01def0b147b5084b (patch) | |
tree | 841c512688ceb07838f82957e5d5844134e5f572 /cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c | |
parent | 5ee1538f37aa8b2c679b8752982620362e459ab0 (diff) | |
download | FreeBSD-src-8e3e986346a1f6262fbbfa8b01def0b147b5084b.zip FreeBSD-src-8e3e986346a1f6262fbbfa8b01def0b147b5084b.tar.gz |
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
MFC after: 1 week
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c index b0f034b..1a305fd 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>. + * All rights reserved. */ #include <assert.h> @@ -717,7 +719,7 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) sd->parent_fromsnap_guid = 0; VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); - (void) zfs_iter_snapshots(zhp, send_iterate_snap, sd); + (void) zfs_iter_snapshots(zhp, B_FALSE, send_iterate_snap, sd); VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); nvlist_free(sd->parent_snaps); |