summaryrefslogtreecommitdiff
path: root/usr/src/cmd/zoneadm
diff options
context:
space:
mode:
authorMartin Matuska <martin@matuska.org>2016-05-15 06:39:49 -0700
committerMatthew Ahrens <mahrens@delphix.com>2016-05-15 07:00:09 -0700
commit0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d (patch)
tree38c13db017210bb1e64ef92c940d62440ba905fd /usr/src/cmd/zoneadm
parentc971037baa5d64dfecf6d87ed602fc3116ebec41 (diff)
downloadillumos-joyent-0d8fa8f8eba3ea46bc79d73445009505d1dd5d7d.tar.gz
6902 speed up listing of snapshots if requesting name only and sorting by name
Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Pawel Dawidek <pjd@freebsd.org> Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/cmd/zoneadm')
-rw-r--r--usr/src/cmd/zoneadm/zfs.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/usr/src/cmd/zoneadm/zfs.c b/usr/src/cmd/zoneadm/zfs.c
index a279cd6823..2041d0f4b5 100644
--- a/usr/src/cmd/zoneadm/zfs.c
+++ b/usr/src/cmd/zoneadm/zfs.c
@@ -23,6 +23,7 @@
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2016 Martin Matuska. All rights reserved.
*/
/*
@@ -247,7 +248,7 @@ get_snap_max(zfs_handle_t *zhp, void *data)
cbp->max = num;
}
- res = zfs_iter_snapshots(zhp, get_snap_max, data);
+ res = zfs_iter_snapshots(zhp, B_FALSE, get_snap_max, data);
zfs_close(zhp);
return (res);
}
@@ -276,7 +277,7 @@ take_snapshot(zfs_handle_t *zhp, char *snapshot_name, int snap_size,
cb.len = strlen(template);
cb.max = 0;
- if (zfs_iter_snapshots(zhp, get_snap_max, &cb) != 0)
+ if (zfs_iter_snapshots(zhp, B_FALSE, get_snap_max, &cb) != 0)
return (Z_ERR);
cb.max++;
@@ -736,7 +737,7 @@ promote_clone(zfs_handle_t *src_zhp, zfs_handle_t *cln_zhp)
sd.len = strlen(template);
sd.max = 0;
- if (zfs_iter_snapshots(cln_zhp, get_snap_max, &sd) != 0)
+ if (zfs_iter_snapshots(cln_zhp, B_FALSE, get_snap_max, &sd) != 0)
return (Z_ERR);
/*
@@ -749,7 +750,7 @@ promote_clone(zfs_handle_t *src_zhp, zfs_handle_t *cln_zhp)
sd.len = strlen(template);
sd.num = 0;
- if (zfs_iter_snapshots(src_zhp, get_snap_max, &sd) != 0)
+ if (zfs_iter_snapshots(src_zhp, B_FALSE, get_snap_max, &sd) != 0)
return (Z_ERR);
/*
@@ -758,7 +759,7 @@ promote_clone(zfs_handle_t *src_zhp, zfs_handle_t *cln_zhp)
*/
sd.max++;
sd.cntr = 0;
- if (zfs_iter_snapshots(src_zhp, rename_snap, &sd) != 0)
+ if (zfs_iter_snapshots(src_zhp, B_FALSE, rename_snap, &sd) != 0)
return (Z_ERR);
/* close and reopen the clone dataset to get the latest info */
@@ -790,7 +791,7 @@ promote_all_clones(zfs_handle_t *zhp)
cd.origin_creation = 0;
cd.snapshot = NULL;
- if (zfs_iter_snapshots(zhp, find_clone, &cd) != 0) {
+ if (zfs_iter_snapshots(zhp, B_FALSE, find_clone, &cd) != 0) {
zfs_close(zhp);
return (Z_ERR);
}
@@ -1041,7 +1042,7 @@ destroy_zfs(char *zonepath)
return (Z_ERR);
/* Now cleanup any snapshots remaining. */
- if (zfs_iter_snapshots(zhp, rm_snap, NULL) != 0) {
+ if (zfs_iter_snapshots(zhp, B_FALSE, rm_snap, NULL) != 0) {
zfs_close(zhp);
return (Z_ERR);
}