mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-28 09:46:17 +00:00
Skip iterating over snapshots for share properties
Setting sharenfs and sharesmb properties on a dataset can become costly if there are large number of snapshots, since setting the share properties iterates over all snapshots present for a dataset. If it is the root dataset for which we are trying to set the share property, snapshots for all child datasets and their children will also be iterated. There is no need to iterate over snapshots for share properties because we do not allow share properties or any other property, to be set on a snapshot itself execpt for user properties. This commit skips iterating over snapshots for share properties, instead iterate over all child dataset and their children for share properties. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Umer Saleem <usaleem@ixsystems.com> Closes #16877
This commit is contained in:
parent
c944c46a98
commit
cb8da70329
@ -563,8 +563,15 @@ change_one(zfs_handle_t *zhp, void *data)
|
||||
cn = NULL;
|
||||
}
|
||||
|
||||
if (!clp->cl_alldependents)
|
||||
ret = zfs_iter_children_v2(zhp, 0, change_one, data);
|
||||
if (!clp->cl_alldependents) {
|
||||
if (clp->cl_prop != ZFS_PROP_MOUNTPOINT) {
|
||||
ret = zfs_iter_filesystems_v2(zhp, 0,
|
||||
change_one, data);
|
||||
} else {
|
||||
ret = zfs_iter_children_v2(zhp, 0, change_one,
|
||||
data);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we added the handle to the changelist, we will re-use it
|
||||
@ -738,6 +745,11 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int gather_flags,
|
||||
changelist_free(clp);
|
||||
return (NULL);
|
||||
}
|
||||
} else if (clp->cl_prop != ZFS_PROP_MOUNTPOINT) {
|
||||
if (zfs_iter_filesystems_v2(zhp, 0, change_one, clp) != 0) {
|
||||
changelist_free(clp);
|
||||
return (NULL);
|
||||
}
|
||||
} else if (zfs_iter_children_v2(zhp, 0, change_one, clp) != 0) {
|
||||
changelist_free(clp);
|
||||
return (NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user