mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
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
This commit is contained in:
committed by
Brian Behlendorf
parent
74497b7ab6
commit
0cee24064a
@@ -21,6 +21,7 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Portions Copyright 2011 Martin Matuska
|
||||
* Portions Copyright 2012 Pawel Jakub Dawidek <pawel@dawidek.net>
|
||||
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
@@ -1973,7 +1974,7 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc)
|
||||
int error;
|
||||
|
||||
top:
|
||||
if (zc->zc_cookie == 0)
|
||||
if (zc->zc_cookie == 0 && !zc->zc_simple)
|
||||
(void) dmu_objset_find(zc->zc_name, dmu_objset_prefetch,
|
||||
NULL, DS_FIND_SNAPSHOTS);
|
||||
|
||||
@@ -1995,7 +1996,7 @@ top:
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user