mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 20:04:57 +01:00
libzfs: do not iterate snapshots for a mountpoint changelist
The mountpoint property does not apply to snapshots, so change_one() drops every snapshot it is given. Iterating over them while gathering a mountpoint changelist therefore costs a full stats ioctl per snapshot and never contributes an entry, which makes "zfs set mountpoint", "zfs inherit mountpoint" and "zfs set volsize" scale with the number of snapshots for no reason. Iterate filesystems only. This also covers canmount, volsize and zoned, since those are handled through the mountpoint changelist. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ameer Hamza <[email protected]> Closes #19137
This commit is contained in:
1 parent
695b02eda4
commit
a83d968356
1 file changed
+7
-13
@@ -589,14 +589,13 @@ change_one(zfs_handle_t *zhp, void *data)
|
||||
cn = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The mountpoint property does not apply to snapshots, so
|
||||
* there is no need to iterate over them here.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
ret = zfs_iter_filesystems_v2(zhp, 0, change_one,
|
||||
data);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -755,12 +754,7 @@ 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) {
|
||||
} else if (zfs_iter_filesystems_v2(zhp, 0, change_one, clp) != 0) {
|
||||
changelist_free(clp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user