svn commit: r302643 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zfs vendor/illumos/dist/lib/libzfs/common
Andriy Gapon
avg at FreeBSD.org
Tue Jul 12 11:21:42 UTC 2016
Author: avg
Date: Tue Jul 12 11:21:41 2016
New Revision: 302643
URL: https://svnweb.freebsd.org/changeset/base/302643
Log:
6902 speed up listing of snapshots if requesting name only and sorting by name
illumos/illumos-gate at 0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d
https://github.com/illumos/illumos-gate/commit/0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d
https://www.illumos.org/issues/6902
pjd has authored and commited a patch in Jan 21, 2012 that substanially speeds
up zfs snapshot listing if requesting only the name property and sorting by
name.
In this special case, the snapshot properties do not need to be loaded. This
code has been adopted by zfsonlinux on May 29, 2012.
Commit message from pjd:
Dramatically optimize listing snapshots when user requests only
snapshot
names and wants to sort them by name, ie. when executes:
1. 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:
1. time zfs list -t snapshot -o name -s name > /dev/null
cold cache: 525s
warm cache: 218s
after:
1. time zfs list -t snapshot -o name -s name > /dev/null
cold cache: 1.7s
warm cache: 1.1s
References:
http://svnweb.freebsd.org/base?view=revision&revision=230438
https://github.com/freebsd/freebsd/commit/8e3e9863
https://github.com/zfsonlinux/zfs/commit/0cee2406
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Pawel Dawidek <pjd at freebsd.org>
Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Approved by: Garrett D'Amore <garrett at damore.org>
Author: Martin Matuska <martin at matuska.org>
Modified:
vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h
vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
Changes in other areas also in this revision:
Modified:
vendor/illumos/dist/cmd/zfs/zfs_iter.c
vendor/illumos/dist/cmd/zfs/zfs_iter.h
vendor/illumos/dist/cmd/zfs/zfs_main.c
vendor/illumos/dist/lib/libzfs/common/libzfs.h
vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h
vendor/illumos/dist/lib/libzfs/common/libzfs_iter.c
vendor/illumos/dist/lib/libzfs/common/libzfs_sendrecv.c
Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Jul 12 11:20:00 2016 (r302642)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zfs_ioctl.h Tue Jul 12 11:21:41 2016 (r302643)
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
* Copyright 2016 RackTop Systems.
* Copyright (c) 2014 Integros [integros.com]
@@ -370,6 +371,7 @@ typedef struct zfs_cmd {
uint32_t zc_flags;
uint64_t zc_action_handle;
int zc_cleanup_fd;
+ uint8_t zc_simple;
boolean_t zc_resumable;
uint64_t zc_sendobj;
uint64_t zc_fromobj;
Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Tue Jul 12 11:20:00 2016 (r302642)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Tue Jul 12 11:21:41 2016 (r302643)
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
* Portions Copyright 2011 Martin Matuska
* Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
@@ -2268,6 +2269,7 @@ top:
* zc_name name of filesystem
* zc_cookie zap cursor
* zc_nvlist_dst_size size of buffer for property nvlist
+ * zc_simple when set, only name is requested
*
* outputs:
* zc_name name of next snapshot
@@ -2300,7 +2302,7 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc
zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, &zc->zc_cookie,
NULL);
- if (error == 0) {
+ if (error == 0 && !zc->zc_simple) {
dsl_dataset_t *ds;
dsl_pool_t *dp = os->os_dsl_dataset->ds_dir->dd_pool;
More information about the svn-src-vendor
mailing list