forked from opnsense/src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
7955 libshare needs to initialize only those datasets being modified by the consumer illumos/illumos-gate@8a981c3 illumos/illumos-gate@8a981c3 https://www.illumos.org/issues/7955 Libshare currently initializes all available filesystems when doing any libshare operation. This requires iterating through all the filesystem multiple times, which is a huge performance problem for sharing and unsharing operations. Reviewed by: Steve Gonczi <[email protected]> Reviewed by: Sebastien Roy <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Pavel Zakharov <[email protected]> Reviewed by: Yuri Pankov <[email protected]> Approved by: Gordon Ross <[email protected]> Author: Daniel Hoffman <[email protected]> For FreeBSD this is practically a NOP, just a diff reduction.
- Loading branch information
Showing
5 changed files
with
103 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
* Portions Copyright 2007 Ramprakash Jelari | ||
* Copyright (c) 2011 Pawel Jakub Dawidek <[email protected]>. | ||
* All rights reserved. | ||
* Copyright (c) 2014, 2015 by Delphix. All rights reserved. | ||
* Copyright (c) 2014, 2016 by Delphix. All rights reserved. | ||
* Copyright 2016 Igor Kozhukhov <[email protected]> | ||
*/ | ||
|
||
|
@@ -166,6 +166,11 @@ changelist_postfix(prop_changelist_t *clp) | |
char shareopts[ZFS_MAXPROPLEN]; | ||
int errors = 0; | ||
libzfs_handle_t *hdl; | ||
#ifdef illumos | ||
size_t num_datasets = 0, i; | ||
zfs_handle_t **zhandle_arr; | ||
sa_init_selective_arg_t sharearg; | ||
#endif | ||
|
||
/* | ||
* If we're changing the mountpoint, attempt to destroy the underlying | ||
|
@@ -192,8 +197,33 @@ changelist_postfix(prop_changelist_t *clp) | |
hdl = cn->cn_handle->zfs_hdl; | ||
assert(hdl != NULL); | ||
zfs_uninit_libshare(hdl); | ||
} | ||
|
||
#ifdef illumos | ||
/* | ||
* For efficiencies sake, we initialize libshare for only a few | ||
* shares (the ones affected here). Future initializations in | ||
* this process should just use the cached initialization. | ||
*/ | ||
for (cn = uu_list_last(clp->cl_list); cn != NULL; | ||
cn = uu_list_prev(clp->cl_list, cn)) { | ||
num_datasets++; | ||
} | ||
|
||
zhandle_arr = zfs_alloc(hdl, | ||
num_datasets * sizeof (zfs_handle_t *)); | ||
for (i = 0, cn = uu_list_last(clp->cl_list); cn != NULL; | ||
cn = uu_list_prev(clp->cl_list, cn)) { | ||
zhandle_arr[i++] = cn->cn_handle; | ||
zfs_refresh_properties(cn->cn_handle); | ||
} | ||
assert(i == num_datasets); | ||
sharearg.zhandle_arr = zhandle_arr; | ||
sharearg.zhandle_len = num_datasets; | ||
errors = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE, | ||
&sharearg); | ||
free(zhandle_arr); | ||
#endif | ||
} | ||
/* | ||
* We walk the datasets in reverse, because we want to mount any parent | ||
* datasets before mounting the children. We walk all datasets even if | ||
|
@@ -218,7 +248,9 @@ changelist_postfix(prop_changelist_t *clp) | |
continue; | ||
cn->cn_needpost = B_FALSE; | ||
|
||
#ifndef illumos | ||
zfs_refresh_properties(cn->cn_handle); | ||
#endif | ||
|
||
if (ZFS_IS_VOLUME(cn->cn_handle)) | ||
continue; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters