Lines Matching +full:max +full:- +full:counts

9  * or https://opensource.org/licenses/CDDL-1.0.
68 * ------------------------------
72 * use-case is with a delegated dataset where the administrator wants to ensure
76 * The filesystem and snapshot counts are stored as extensible properties. This
80 * will validate and update the counts.
83 * the counts are updated when a limit is first set on an uninitialized
86 * filesystem count of 0 and a snapshot count of 0. Non-existent filesystem and
87 * snapshot count properties on a node indicate uninitialized counts on that
89 * at the filesystem with the new limit and descends into all sub-filesystems
94 * limit value won't require a re-traversal since the counts are already valid.
95 * When recursively fixing the counts, if a node with a limit is encountered
96 * during the descent, the counts are known to be valid and there is no need to
97 * descend into that filesystem's children. The counts on filesystems above the
99 * eventually set on one of those filesystems. The counts are always recursively
110 * snapshot is destroyed, the counts are recursively adjusted all the way up
112 * in the tree will first validate, then update the counts on each branch up to
113 * the common ancestor. A receive will also validate the counts and then update
119 * denial-of-service in which a lower level delegated dataset could max out its
124 * snapshot should be aware of this side-effect and behave accordingly.
130 * dsl_dir_activate_fs_ss_limit() and the counts are adjusted, if necessary, by
146 dsl_pool_t *dp __maybe_unused = dd->dd_pool; in dsl_dir_evict_async()
148 dd->dd_dbuf = NULL; in dsl_dir_evict_async()
151 ASSERT(!txg_list_member(&dp->dp_dirty_dirs, dd, t)); in dsl_dir_evict_async()
152 ASSERT(dd->dd_tempreserved[t] == 0); in dsl_dir_evict_async()
153 ASSERT(dd->dd_space_towrite[t] == 0); in dsl_dir_evict_async()
156 if (dd->dd_parent) in dsl_dir_evict_async()
157 dsl_dir_async_rele(dd->dd_parent, dd); in dsl_dir_evict_async()
159 spa_async_close(dd->dd_pool->dp_spa, dd); in dsl_dir_evict_async()
161 if (dsl_deadlist_is_open(&dd->dd_livelist)) in dsl_dir_evict_async()
165 cv_destroy(&dd->dd_activity_cv); in dsl_dir_evict_async()
166 mutex_destroy(&dd->dd_activity_lock); in dsl_dir_evict_async()
167 mutex_destroy(&dd->dd_lock); in dsl_dir_evict_async()
182 err = dmu_bonus_hold(dp->dp_meta_objset, ddobj, tag, &dbuf); in dsl_dir_hold_obj()
195 dd->dd_object = ddobj; in dsl_dir_hold_obj()
196 dd->dd_dbuf = dbuf; in dsl_dir_hold_obj()
197 dd->dd_pool = dp; in dsl_dir_hold_obj()
199 mutex_init(&dd->dd_lock, NULL, MUTEX_DEFAULT, NULL); in dsl_dir_hold_obj()
200 mutex_init(&dd->dd_activity_lock, NULL, MUTEX_DEFAULT, NULL); in dsl_dir_hold_obj()
201 cv_init(&dd->dd_activity_cv, NULL, CV_DEFAULT, NULL); in dsl_dir_hold_obj()
205 err = zap_lookup(dp->dp_meta_objset, in dsl_dir_hold_obj()
207 sizeof (uint64_t), 1, &dd->dd_crypto_obj); in dsl_dir_hold_obj()
209 /* check for on-disk format errata */ in dsl_dir_hold_obj()
212 dp->dp_spa->spa_errata = in dsl_dir_hold_obj()
220 if (dsl_dir_phys(dd)->dd_parent_obj) { in dsl_dir_hold_obj()
222 dsl_dir_phys(dd)->dd_parent_obj, NULL, dd, in dsl_dir_hold_obj()
223 &dd->dd_parent); in dsl_dir_hold_obj()
230 err = zap_lookup(dp->dp_meta_objset, in dsl_dir_hold_obj()
231 dsl_dir_phys(dd->dd_parent)-> in dsl_dir_hold_obj()
236 (void) strlcpy(dd->dd_myname, tail, in dsl_dir_hold_obj()
237 sizeof (dd->dd_myname)); in dsl_dir_hold_obj()
239 err = zap_value_search(dp->dp_meta_objset, in dsl_dir_hold_obj()
240 dsl_dir_phys(dd->dd_parent)-> in dsl_dir_hold_obj()
242 ddobj, 0, dd->dd_myname, in dsl_dir_hold_obj()
243 sizeof (dd->dd_myname)); in dsl_dir_hold_obj()
248 (void) strlcpy(dd->dd_myname, spa_name(dp->dp_spa), in dsl_dir_hold_obj()
249 sizeof (dd->dd_myname)); in dsl_dir_hold_obj()
261 err = dmu_bonus_hold(dp->dp_meta_objset, in dsl_dir_hold_obj()
262 dsl_dir_phys(dd)->dd_origin_obj, FTAG, in dsl_dir_hold_obj()
266 origin_phys = origin_bonus->db_data; in dsl_dir_hold_obj()
267 dd->dd_origin_txg = in dsl_dir_hold_obj()
268 origin_phys->ds_creation_txg; in dsl_dir_hold_obj()
272 err = zap_lookup(dp->dp_meta_objset, in dsl_dir_hold_obj()
273 dd->dd_object, DD_FIELD_LIVELIST, in dsl_dir_hold_obj()
284 (void) zap_lookup(dp->dp_meta_objset, ddobj, in dsl_dir_hold_obj()
289 dd->dd_snap_cmtime = t; in dsl_dir_hold_obj()
292 dmu_buf_init_user(&dd->dd_dbu, NULL, dsl_dir_evict_async, in dsl_dir_hold_obj()
293 &dd->dd_dbuf); in dsl_dir_hold_obj()
294 winner = dmu_buf_set_user_ie(dbuf, &dd->dd_dbu); in dsl_dir_hold_obj()
296 if (dd->dd_parent) in dsl_dir_hold_obj()
297 dsl_dir_rele(dd->dd_parent, dd); in dsl_dir_hold_obj()
298 if (dsl_deadlist_is_open(&dd->dd_livelist)) in dsl_dir_hold_obj()
301 cv_destroy(&dd->dd_activity_cv); in dsl_dir_hold_obj()
302 mutex_destroy(&dd->dd_activity_lock); in dsl_dir_hold_obj()
303 mutex_destroy(&dd->dd_lock); in dsl_dir_hold_obj()
307 spa_open_ref(dp->dp_spa, dd); in dsl_dir_hold_obj()
312 * The dsl_dir_t has both open-to-close and instantiate-to-evict in dsl_dir_hold_obj()
313 * holds on the spa. We need the open-to-close holds because in dsl_dir_hold_obj()
317 * the instantiate-to-evict hold because the dsl_dir_t has a in dsl_dir_hold_obj()
320 spa_open_ref(dp->dp_spa, tag); in dsl_dir_hold_obj()
321 ASSERT3P(dd->dd_pool, ==, dp); in dsl_dir_hold_obj()
322 ASSERT3U(dd->dd_object, ==, ddobj); in dsl_dir_hold_obj()
323 ASSERT3P(dd->dd_dbuf, ==, dbuf); in dsl_dir_hold_obj()
328 if (dd->dd_parent) in dsl_dir_hold_obj()
329 dsl_dir_rele(dd->dd_parent, dd); in dsl_dir_hold_obj()
330 if (dsl_deadlist_is_open(&dd->dd_livelist)) in dsl_dir_hold_obj()
333 cv_destroy(&dd->dd_activity_cv); in dsl_dir_hold_obj()
334 mutex_destroy(&dd->dd_activity_lock); in dsl_dir_hold_obj()
335 mutex_destroy(&dd->dd_lock); in dsl_dir_hold_obj()
345 spa_close(dd->dd_pool->dp_spa, tag); in dsl_dir_rele()
346 dmu_buf_rele(dd->dd_dbuf, tag); in dsl_dir_rele()
360 spa_async_close(dd->dd_pool->dp_spa, tag); in dsl_dir_async_rele()
361 dmu_buf_rele(dd->dd_dbuf, tag); in dsl_dir_async_rele()
368 if (dd->dd_parent) { in dsl_dir_name()
369 dsl_dir_name(dd->dd_parent, buf); in dsl_dir_name()
375 if (!MUTEX_HELD(&dd->dd_lock)) { in dsl_dir_name()
380 mutex_enter(&dd->dd_lock); in dsl_dir_name()
381 VERIFY3U(strlcat(buf, dd->dd_myname, ZFS_MAX_DATASET_NAME_LEN), in dsl_dir_name()
383 mutex_exit(&dd->dd_lock); in dsl_dir_name()
385 VERIFY3U(strlcat(buf, dd->dd_myname, ZFS_MAX_DATASET_NAME_LEN), in dsl_dir_name()
396 if (dd->dd_parent) { in dsl_dir_namelen()
398 result = dsl_dir_namelen(dd->dd_parent) + 1; in dsl_dir_namelen()
401 if (!MUTEX_HELD(&dd->dd_lock)) { in dsl_dir_namelen()
403 mutex_enter(&dd->dd_lock); in dsl_dir_namelen()
404 result += strlen(dd->dd_myname); in dsl_dir_namelen()
405 mutex_exit(&dd->dd_lock); in dsl_dir_namelen()
407 result += strlen(dd->dd_myname); in dsl_dir_namelen()
440 if (p - path >= ZFS_MAX_DATASET_NAME_LEN) in getcomponent()
442 (void) strlcpy(component, path, p - path + 1); in getcomponent()
451 if (p - path >= ZFS_MAX_DATASET_NAME_LEN) in getcomponent()
453 (void) strlcpy(component, path, p - path + 1); in getcomponent()
484 spaname = spa_name(dp->dp_spa); in dsl_dir_hold()
492 err = dsl_dir_hold_obj(dp, dp->dp_root_dir_obj, NULL, tag, &dd); in dsl_dir_hold()
506 buf, (longlong_t)dsl_dir_phys(dd)->dd_child_dir_zapobj); in dsl_dir_hold()
508 err = zap_lookup(dp->dp_meta_objset, in dsl_dir_hold()
509 dsl_dir_phys(dd)->dd_child_dir_zapobj, in dsl_dir_hold()
551 * If the counts are already initialized for this filesystem and its
552 * descendants then do nothing, otherwise initialize the counts.
554 * The counts on this filesystem, and those below, may be uninitialized due to
555 * either the use of a pre-existing pool which did not support the
560 * counts on each filesystem below, then update the cumulative count on the
562 * then we know that its counts, and the counts on the filesystems below it,
570 dsl_pool_t *dp = dd->dd_pool; in dsl_dir_init_fs_ss_count()
571 objset_t *os = dp->dp_meta_objset; in dsl_dir_init_fs_ss_count()
576 ASSERT(spa_feature_is_active(dp->dp_spa, SPA_FEATURE_FS_SS_LIMIT)); in dsl_dir_init_fs_ss_count()
586 if (zap_contains(os, dd->dd_object, DD_FIELD_FILESYSTEM_COUNT) == 0) in dsl_dir_init_fs_ss_count()
593 for (zap_cursor_init(zc, os, dsl_dir_phys(dd)->dd_child_dir_zapobj); in dsl_dir_init_fs_ss_count()
598 VERIFY0(dsl_dir_hold_obj(dp, za->za_first_integer, NULL, FTAG, in dsl_dir_init_fs_ss_count()
604 if (chld_dd->dd_myname[0] == '$') { in dsl_dir_init_fs_ss_count()
613 VERIFY0(zap_lookup(os, chld_dd->dd_object, in dsl_dir_init_fs_ss_count()
616 VERIFY0(zap_lookup(os, chld_dd->dd_object, in dsl_dir_init_fs_ss_count()
624 VERIFY0(dsl_dataset_hold_obj(dd->dd_pool, in dsl_dir_init_fs_ss_count()
625 dsl_dir_phys(dd)->dd_head_dataset_obj, FTAG, &ds)); in dsl_dir_init_fs_ss_count()
627 for (zap_cursor_init(zc, os, dsl_dataset_phys(ds)->ds_snapnames_zapobj); in dsl_dir_init_fs_ss_count()
631 if (za->za_name[0] != '%') in dsl_dir_init_fs_ss_count()
641 /* we're in a sync task, update counts */ in dsl_dir_init_fs_ss_count()
642 dmu_buf_will_dirty(dd->dd_dbuf, tx); in dsl_dir_init_fs_ss_count()
643 VERIFY0(zap_add(os, dd->dd_object, DD_FIELD_FILESYSTEM_COUNT, in dsl_dir_init_fs_ss_count()
645 VERIFY0(zap_add(os, dd->dd_object, DD_FIELD_SNAPSHOT_COUNT, in dsl_dir_init_fs_ss_count()
662 if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_FS_SS_LIMIT)) { in dsl_dir_actv_fs_ss_limit_check()
667 dd = ds->ds_dir; in dsl_dir_actv_fs_ss_limit_check()
668 if (spa_feature_is_active(dp->dp_spa, SPA_FEATURE_FS_SS_LIMIT) && in dsl_dir_actv_fs_ss_limit_check()
670 zap_contains(dp->dp_meta_objset, dd->dd_object, in dsl_dir_actv_fs_ss_limit_check()
695 * limit, increment the feature-active counter so that the in dsl_dir_actv_fs_ss_limit_sync()
704 * Since we are now setting a non-UINT64_MAX limit on the filesystem, in dsl_dir_actv_fs_ss_limit_sync()
705 * we need to ensure the counts are correct. Descend down the tree from in dsl_dir_actv_fs_ss_limit_sync()
706 * this point and update all of the counts to be accurate. in dsl_dir_actv_fs_ss_limit_sync()
708 dsl_dir_init_fs_ss_count(ds->ds_dir, tx); in dsl_dir_actv_fs_ss_limit_sync()
715 * Since we're setting a limit, ensure the on-disk counts are valid.
744 * We can never modify these two properties within a non-global zone. In
786 if ((obj = dsl_dir_phys(dd)->dd_head_dataset_obj) == 0) in dsl_enforce_ds_ss_limits()
789 ASSERT(dsl_pool_config_held(dd->dd_pool)); in dsl_enforce_ds_ss_limits()
791 if (dsl_dataset_hold_obj(dd->dd_pool, obj, FTAG, &ds) != 0) in dsl_enforce_ds_ss_limits()
819 objset_t *os = dd->dd_pool->dp_meta_objset; in dsl_fs_ss_limit_check()
825 ASSERT(dsl_pool_config_held(dd->dd_pool)); in dsl_fs_ss_limit_check()
870 * stop since we know there is no limit here (or above). The counts are in dsl_fs_ss_limit_check()
871 * not valid on this node and we know we won't touch this node's counts. in dsl_fs_ss_limit_check()
875 err = zap_lookup(os, dd->dd_object, in dsl_fs_ss_limit_check()
891 if (dd->dd_parent != NULL) in dsl_fs_ss_limit_check()
892 err = dsl_fs_ss_limit_check(dd->dd_parent, delta, prop, in dsl_fs_ss_limit_check()
909 objset_t *os = dd->dd_pool->dp_meta_objset; in dsl_fs_ss_count_adjust()
912 ASSERT(dsl_pool_config_held(dd->dd_pool)); in dsl_fs_ss_count_adjust()
920 if (dd->dd_myname[0] == '$' && strcmp(prop, in dsl_fs_ss_count_adjust()
933 * stop since we know the counts are not valid on this node and we in dsl_fs_ss_count_adjust()
934 * know we shouldn't touch this node's counts. An uninitialized count in dsl_fs_ss_count_adjust()
938 if (!dsl_dir_is_zapified(dd) || (err = zap_lookup(os, dd->dd_object, in dsl_fs_ss_count_adjust()
947 VERIFY0(zap_update(os, dd->dd_object, prop, sizeof (count), 1, &count, in dsl_fs_ss_count_adjust()
951 if (dd->dd_parent != NULL) in dsl_fs_ss_count_adjust()
952 dsl_fs_ss_count_adjust(dd->dd_parent, delta, prop, tx); in dsl_fs_ss_count_adjust()
959 objset_t *mos = dp->dp_meta_objset; in dsl_dir_create_sync()
967 VERIFY0(zap_add(mos, dsl_dir_phys(pds)->dd_child_dir_zapobj, in dsl_dir_create_sync()
976 ddphys = dbuf->db_data; in dsl_dir_create_sync()
978 ddphys->dd_creation_time = gethrestime_sec(); in dsl_dir_create_sync()
980 ddphys->dd_parent_obj = pds->dd_object; in dsl_dir_create_sync()
982 /* update the filesystem counts */ in dsl_dir_create_sync()
985 ddphys->dd_props_zapobj = zap_create(mos, in dsl_dir_create_sync()
987 ddphys->dd_child_dir_zapobj = zap_create(mos, in dsl_dir_create_sync()
989 if (spa_version(dp->dp_spa) >= SPA_VERSION_USED_BREAKDOWN) in dsl_dir_create_sync()
990 ddphys->dd_flags |= DD_FLAG_USED_BREAKDOWN; in dsl_dir_create_sync()
1000 return (dsl_dir_phys(dd)->dd_origin_obj && in dsl_dir_is_clone()
1001 (dd->dd_pool->dp_origin_snap == NULL || in dsl_dir_is_clone()
1002 dsl_dir_phys(dd)->dd_origin_obj != in dsl_dir_is_clone()
1003 dd->dd_pool->dp_origin_snap->ds_object)); in dsl_dir_is_clone()
1009 return (dsl_dir_phys(dd)->dd_used_bytes); in dsl_dir_get_used()
1015 return (dsl_dir_phys(dd)->dd_compressed_bytes); in dsl_dir_get_compressed()
1021 return (dsl_dir_phys(dd)->dd_quota); in dsl_dir_get_quota()
1027 return (dsl_dir_phys(dd)->dd_reserved); in dsl_dir_get_reservation()
1034 return (dsl_dir_phys(dd)->dd_compressed_bytes == 0 ? 100 : in dsl_dir_get_compressratio()
1035 (dsl_dir_phys(dd)->dd_uncompressed_bytes * 100 / in dsl_dir_get_compressratio()
1036 dsl_dir_phys(dd)->dd_compressed_bytes)); in dsl_dir_get_compressratio()
1042 return (dsl_dir_phys(dd)->dd_uncompressed_bytes); in dsl_dir_get_logicalused()
1048 return (dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_SNAP]); in dsl_dir_get_usedsnap()
1054 return (dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_HEAD]); in dsl_dir_get_usedds()
1060 return (dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_REFRSRV]); in dsl_dir_get_usedrefreserv()
1066 return (dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_CHILD] + in dsl_dir_get_usedchild()
1067 dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_CHILD_RSRV]); in dsl_dir_get_usedchild()
1074 VERIFY0(dsl_dataset_hold_obj(dd->dd_pool, in dsl_dir_get_origin()
1075 dsl_dir_phys(dd)->dd_origin_obj, FTAG, &ds)); in dsl_dir_get_origin()
1086 objset_t *os = dd->dd_pool->dp_meta_objset; in dsl_dir_get_filesystem_count()
1087 return (zap_lookup(os, dd->dd_object, DD_FIELD_FILESYSTEM_COUNT, in dsl_dir_get_filesystem_count()
1098 objset_t *os = dd->dd_pool->dp_meta_objset; in dsl_dir_get_snapshot_count()
1099 return (zap_lookup(os, dd->dd_object, DD_FIELD_SNAPSHOT_COUNT, in dsl_dir_get_snapshot_count()
1109 mutex_enter(&dd->dd_lock); in dsl_dir_stats()
1116 if (dsl_dir_phys(dd)->dd_flags & DD_FLAG_USED_BREAKDOWN) { in dsl_dir_stats()
1126 mutex_exit(&dd->dd_lock); in dsl_dir_stats()
1149 dsl_pool_t *dp = dd->dd_pool; in dsl_dir_dirty()
1153 if (txg_list_add(&dp->dp_dirty_dirs, dd, tx->tx_txg)) { in dsl_dir_dirty()
1155 dmu_buf_add_ref(dd->dd_dbuf, dd); in dsl_dir_dirty()
1162 uint64_t old_accounted = MAX(used, dsl_dir_phys(dd)->dd_reserved); in parent_delta()
1164 MAX(used + delta, dsl_dir_phys(dd)->dd_reserved); in parent_delta()
1165 return (new_accounted - old_accounted); in parent_delta()
1173 mutex_enter(&dd->dd_lock); in dsl_dir_sync()
1174 ASSERT0(dd->dd_tempreserved[tx->tx_txg & TXG_MASK]); in dsl_dir_sync()
1175 dprintf_dd(dd, "txg=%llu towrite=%lluK\n", (u_longlong_t)tx->tx_txg, in dsl_dir_sync()
1176 (u_longlong_t)dd->dd_space_towrite[tx->tx_txg & TXG_MASK] / 1024); in dsl_dir_sync()
1177 dd->dd_space_towrite[tx->tx_txg & TXG_MASK] = 0; in dsl_dir_sync()
1178 mutex_exit(&dd->dd_lock); in dsl_dir_sync()
1181 dmu_buf_rele(dd->dd_dbuf, dd); in dsl_dir_sync()
1189 ASSERT(MUTEX_HELD(&dd->dd_lock)); in dsl_dir_space_towrite()
1192 space += dd->dd_space_towrite[i & TXG_MASK]; in dsl_dir_space_towrite()
1200 * on-disk, not estimated pending changes.
1215 if (dd->dd_parent != NULL) { in dsl_dir_space_available()
1216 parentspace = dsl_dir_space_available(dd->dd_parent, in dsl_dir_space_available()
1220 mutex_enter(&dd->dd_lock); in dsl_dir_space_available()
1221 if (dsl_dir_phys(dd)->dd_quota != 0) in dsl_dir_space_available()
1222 quota = dsl_dir_phys(dd)->dd_quota; in dsl_dir_space_available()
1223 used = dsl_dir_phys(dd)->dd_used_bytes; in dsl_dir_space_available()
1227 if (dd->dd_parent == NULL) { in dsl_dir_space_available()
1228 uint64_t poolsize = dsl_pool_adjustedsize(dd->dd_pool, in dsl_dir_space_available()
1233 if (dsl_dir_phys(dd)->dd_reserved > used && parentspace != UINT64_MAX) { in dsl_dir_space_available()
1238 parentspace += dsl_dir_phys(dd)->dd_reserved - used; in dsl_dir_space_available()
1243 ASSERT(used >= -delta); in dsl_dir_space_available()
1246 parentspace -= delta; in dsl_dir_space_available()
1257 myspace = MIN(parentspace, quota - used); in dsl_dir_space_available()
1260 mutex_exit(&dd->dd_lock); in dsl_dir_space_available()
1284 txg = tx->tx_txg; in dsl_dir_tempreserve_impl()
1291 mutex_enter(&dd->dd_lock); in dsl_dir_tempreserve_impl()
1295 * when checking for over-quota because they get one free hit. in dsl_dir_tempreserve_impl()
1299 est_inflight += dd->dd_tempreserved[i]; in dsl_dir_tempreserve_impl()
1300 uint64_t used_on_disk = dsl_dir_phys(dd)->dd_used_bytes; in dsl_dir_tempreserve_impl()
1303 * On the first iteration, fetch the dataset's used-on-disk and in dsl_dir_tempreserve_impl()
1307 if (first && tx->tx_objset) { in dsl_dir_tempreserve_impl()
1309 dsl_dataset_t *ds = tx->tx_objset->os_dsl_dataset; in dsl_dir_tempreserve_impl()
1314 mutex_exit(&dd->dd_lock); in dsl_dir_tempreserve_impl()
1324 if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0 || in dsl_dir_tempreserve_impl()
1325 (tx->tx_objset && dmu_objset_type(tx->tx_objset) == DMU_OST_ZVOL && in dsl_dir_tempreserve_impl()
1329 quota = dsl_dir_phys(dd)->dd_quota; in dsl_dir_tempreserve_impl()
1341 if (dd->dd_parent == NULL) { in dsl_dir_tempreserve_impl()
1342 uint64_t avail = dsl_pool_unreserved_space(dd->dd_pool, in dsl_dir_tempreserve_impl()
1355 * on-disk is over quota and there are no pending changes in dsl_dir_tempreserve_impl()
1363 if (retval == ENOSPC && (used_on_disk - quota) < in dsl_dir_tempreserve_impl()
1364 dsl_pool_deferred_space(dd->dd_pool)) { in dsl_dir_tempreserve_impl()
1368 mutex_exit(&dd->dd_lock); in dsl_dir_tempreserve_impl()
1377 mutex_exit(&dd->dd_lock); in dsl_dir_tempreserve_impl()
1383 dd->dd_tempreserved[txg & TXG_MASK] += asize; in dsl_dir_tempreserve_impl()
1386 asize - ref_rsrv); in dsl_dir_tempreserve_impl()
1387 mutex_exit(&dd->dd_lock); in dsl_dir_tempreserve_impl()
1390 tr->tr_ds = dd; in dsl_dir_tempreserve_impl()
1391 tr->tr_size = asize; in dsl_dir_tempreserve_impl()
1395 if (dd->dd_parent != NULL && parent_rsrv != 0) { in dsl_dir_tempreserve_impl()
1402 dd = dd->dd_parent; in dsl_dir_tempreserve_impl()
1404 ignorequota = (dsl_dir_phys(dd)->dd_head_dataset_obj == 0); in dsl_dir_tempreserve_impl()
1435 err = arc_tempreserve_space(dd->dd_pool->dp_spa, lsize, tx->tx_txg); in dsl_dir_tempreserve_space()
1440 tr->tr_size = lsize; in dsl_dir_tempreserve_space()
1447 * non-pageout transactions to give pageout an in dsl_dir_tempreserve_space()
1453 txg_delay(dd->dd_pool, tx->tx_txg, in dsl_dir_tempreserve_space()
1479 int txgidx = tx->tx_txg & TXG_MASK; in dsl_dir_tempreserve_clear()
1483 ASSERT3U(tx->tx_txg, !=, 0); in dsl_dir_tempreserve_clear()
1489 if (tr->tr_ds) { in dsl_dir_tempreserve_clear()
1490 mutex_enter(&tr->tr_ds->dd_lock); in dsl_dir_tempreserve_clear()
1491 ASSERT3U(tr->tr_ds->dd_tempreserved[txgidx], >=, in dsl_dir_tempreserve_clear()
1492 tr->tr_size); in dsl_dir_tempreserve_clear()
1493 tr->tr_ds->dd_tempreserved[txgidx] -= tr->tr_size; in dsl_dir_tempreserve_clear()
1494 mutex_exit(&tr->tr_ds->dd_lock); in dsl_dir_tempreserve_clear()
1496 arc_tempreserve_clear(tr->tr_size); in dsl_dir_tempreserve_clear()
1521 mutex_enter(&dd->dd_lock); in dsl_dir_willuse_space()
1523 dd->dd_space_towrite[tx->tx_txg & TXG_MASK] += space; in dsl_dir_willuse_space()
1526 dsl_dir_phys(dd)->dd_used_bytes; in dsl_dir_willuse_space()
1528 mutex_exit(&dd->dd_lock); in dsl_dir_willuse_space()
1533 dd = dd->dd_parent; in dsl_dir_willuse_space()
1548 dmu_buf_will_dirty(dd->dd_dbuf, tx); in dsl_dir_diduse_space()
1553 * ds->ds_reserved and the dsl_dir accounting, so that in dsl_dir_diduse_space()
1557 boolean_t needlock = !MUTEX_HELD(&dd->dd_lock); in dsl_dir_diduse_space()
1559 mutex_enter(&dd->dd_lock); in dsl_dir_diduse_space()
1561 accounted_delta = parent_delta(dd, ddp->dd_used_bytes, used); in dsl_dir_diduse_space()
1562 ASSERT(used >= 0 || ddp->dd_used_bytes >= -used); in dsl_dir_diduse_space()
1563 ASSERT(compressed >= 0 || ddp->dd_compressed_bytes >= -compressed); in dsl_dir_diduse_space()
1565 ddp->dd_uncompressed_bytes >= -uncompressed); in dsl_dir_diduse_space()
1566 ddp->dd_used_bytes += used; in dsl_dir_diduse_space()
1567 ddp->dd_uncompressed_bytes += uncompressed; in dsl_dir_diduse_space()
1568 ddp->dd_compressed_bytes += compressed; in dsl_dir_diduse_space()
1570 if (ddp->dd_flags & DD_FLAG_USED_BREAKDOWN) { in dsl_dir_diduse_space()
1571 ASSERT(used >= 0 || ddp->dd_used_breakdown[type] >= -used); in dsl_dir_diduse_space()
1572 ddp->dd_used_breakdown[type] += used; in dsl_dir_diduse_space()
1578 u += ddp->dd_used_breakdown[t]; in dsl_dir_diduse_space()
1579 ASSERT3U(u, ==, ddp->dd_used_bytes); in dsl_dir_diduse_space()
1584 mutex_exit(&dd->dd_lock); in dsl_dir_diduse_space()
1586 if (dd->dd_parent != NULL) { in dsl_dir_diduse_space()
1587 dsl_dir_diduse_transfer_space(dd->dd_parent, in dsl_dir_diduse_space()
1603 !(ddp->dd_flags & DD_FLAG_USED_BREAKDOWN)) in dsl_dir_transfer_space()
1606 dmu_buf_will_dirty(dd->dd_dbuf, tx); in dsl_dir_transfer_space()
1607 mutex_enter(&dd->dd_lock); in dsl_dir_transfer_space()
1609 ddp->dd_used_breakdown[oldtype] >= delta : in dsl_dir_transfer_space()
1610 ddp->dd_used_breakdown[newtype] >= -delta); in dsl_dir_transfer_space()
1611 ASSERT(ddp->dd_used_bytes >= ABS(delta)); in dsl_dir_transfer_space()
1612 ddp->dd_used_breakdown[oldtype] -= delta; in dsl_dir_transfer_space()
1613 ddp->dd_used_breakdown[newtype] += delta; in dsl_dir_transfer_space()
1614 mutex_exit(&dd->dd_lock); in dsl_dir_transfer_space()
1628 dmu_buf_will_dirty(dd->dd_dbuf, tx); in dsl_dir_diduse_transfer_space()
1630 mutex_enter(&dd->dd_lock); in dsl_dir_diduse_transfer_space()
1632 accounted_delta = parent_delta(dd, ddp->dd_used_bytes, used); in dsl_dir_diduse_transfer_space()
1633 ASSERT(used >= 0 || ddp->dd_used_bytes >= -used); in dsl_dir_diduse_transfer_space()
1634 ASSERT(compressed >= 0 || ddp->dd_compressed_bytes >= -compressed); in dsl_dir_diduse_transfer_space()
1636 ddp->dd_uncompressed_bytes >= -uncompressed); in dsl_dir_diduse_transfer_space()
1637 ddp->dd_used_bytes += used; in dsl_dir_diduse_transfer_space()
1638 ddp->dd_uncompressed_bytes += uncompressed; in dsl_dir_diduse_transfer_space()
1639 ddp->dd_compressed_bytes += compressed; in dsl_dir_diduse_transfer_space()
1641 if (ddp->dd_flags & DD_FLAG_USED_BREAKDOWN) { in dsl_dir_diduse_transfer_space()
1642 ASSERT(tonew - used <= 0 || in dsl_dir_diduse_transfer_space()
1643 ddp->dd_used_breakdown[oldtype] >= tonew - used); in dsl_dir_diduse_transfer_space()
1645 ddp->dd_used_breakdown[newtype] >= -tonew); in dsl_dir_diduse_transfer_space()
1646 ddp->dd_used_breakdown[oldtype] -= tonew - used; in dsl_dir_diduse_transfer_space()
1647 ddp->dd_used_breakdown[newtype] += tonew; in dsl_dir_diduse_transfer_space()
1653 u += ddp->dd_used_breakdown[t]; in dsl_dir_diduse_transfer_space()
1654 ASSERT3U(u, ==, ddp->dd_used_bytes); in dsl_dir_diduse_transfer_space()
1658 mutex_exit(&dd->dd_lock); in dsl_dir_diduse_transfer_space()
1660 if (dd->dd_parent != NULL) { in dsl_dir_diduse_transfer_space()
1661 dsl_dir_diduse_transfer_space(dd->dd_parent, in dsl_dir_diduse_transfer_space()
1682 error = dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds); in dsl_dir_set_quota_check()
1686 error = dsl_prop_predict(ds->ds_dir, "quota", in dsl_dir_set_quota_check()
1687 ddsqra->ddsqra_source, ddsqra->ddsqra_value, &newval); in dsl_dir_set_quota_check()
1698 mutex_enter(&ds->ds_dir->dd_lock); in dsl_dir_set_quota_check()
1702 * pending changes could under-estimate the amount of space to be in dsl_dir_set_quota_check()
1705 towrite = dsl_dir_space_towrite(ds->ds_dir); in dsl_dir_set_quota_check()
1707 (newval < dsl_dir_phys(ds->ds_dir)->dd_reserved || in dsl_dir_set_quota_check()
1708 newval < dsl_dir_phys(ds->ds_dir)->dd_used_bytes + towrite)) { in dsl_dir_set_quota_check()
1711 mutex_exit(&ds->ds_dir->dd_lock); in dsl_dir_set_quota_check()
1724 VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds)); in dsl_dir_set_quota_sync()
1726 if (spa_version(dp->dp_spa) >= SPA_VERSION_RECVD_PROPS) { in dsl_dir_set_quota_sync()
1728 ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1, in dsl_dir_set_quota_sync()
1729 &ddsqra->ddsqra_value, tx); in dsl_dir_set_quota_sync()
1734 newval = ddsqra->ddsqra_value; in dsl_dir_set_quota_sync()
1739 dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx); in dsl_dir_set_quota_sync()
1740 mutex_enter(&ds->ds_dir->dd_lock); in dsl_dir_set_quota_sync()
1741 dsl_dir_phys(ds->ds_dir)->dd_quota = newval; in dsl_dir_set_quota_sync()
1742 mutex_exit(&ds->ds_dir->dd_lock); in dsl_dir_set_quota_sync()
1770 error = dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds); in dsl_dir_set_reservation_check()
1773 dd = ds->ds_dir; in dsl_dir_set_reservation_check()
1784 error = dsl_prop_predict(ds->ds_dir, in dsl_dir_set_reservation_check()
1786 ddsqra->ddsqra_source, ddsqra->ddsqra_value, &newval); in dsl_dir_set_reservation_check()
1792 mutex_enter(&dd->dd_lock); in dsl_dir_set_reservation_check()
1793 used = dsl_dir_phys(dd)->dd_used_bytes; in dsl_dir_set_reservation_check()
1794 mutex_exit(&dd->dd_lock); in dsl_dir_set_reservation_check()
1796 if (dd->dd_parent) { in dsl_dir_set_reservation_check()
1797 avail = dsl_dir_space_available(dd->dd_parent, in dsl_dir_set_reservation_check()
1800 avail = dsl_pool_adjustedsize(dd->dd_pool, in dsl_dir_set_reservation_check()
1801 ZFS_SPACE_CHECK_NORMAL) - used; in dsl_dir_set_reservation_check()
1804 if (MAX(used, newval) > MAX(used, dsl_dir_phys(dd)->dd_reserved)) { in dsl_dir_set_reservation_check()
1805 uint64_t delta = MAX(used, newval) - in dsl_dir_set_reservation_check()
1806 MAX(used, dsl_dir_phys(dd)->dd_reserved); in dsl_dir_set_reservation_check()
1809 (dsl_dir_phys(dd)->dd_quota > 0 && in dsl_dir_set_reservation_check()
1810 newval > dsl_dir_phys(dd)->dd_quota)) in dsl_dir_set_reservation_check()
1824 dmu_buf_will_dirty(dd->dd_dbuf, tx); in dsl_dir_set_reservation_sync_impl()
1826 mutex_enter(&dd->dd_lock); in dsl_dir_set_reservation_sync_impl()
1827 used = dsl_dir_phys(dd)->dd_used_bytes; in dsl_dir_set_reservation_sync_impl()
1828 delta = MAX(used, value) - MAX(used, dsl_dir_phys(dd)->dd_reserved); in dsl_dir_set_reservation_sync_impl()
1829 dsl_dir_phys(dd)->dd_reserved = value; in dsl_dir_set_reservation_sync_impl()
1831 if (dd->dd_parent != NULL) { in dsl_dir_set_reservation_sync_impl()
1833 dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD_RSRV, in dsl_dir_set_reservation_sync_impl()
1836 mutex_exit(&dd->dd_lock); in dsl_dir_set_reservation_sync_impl()
1847 VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds)); in dsl_dir_set_reservation_sync()
1849 if (spa_version(dp->dp_spa) >= SPA_VERSION_RECVD_PROPS) { in dsl_dir_set_reservation_sync()
1852 ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1, in dsl_dir_set_reservation_sync()
1853 &ddsqra->ddsqra_value, tx); in dsl_dir_set_reservation_sync()
1858 newval = ddsqra->ddsqra_value; in dsl_dir_set_reservation_sync()
1864 dsl_dir_set_reservation_sync_impl(ds->ds_dir, newval, tx); in dsl_dir_set_reservation_sync()
1886 for (; ds1; ds1 = ds1->dd_parent) { in closest_common_ancestor()
1888 for (dd = ds2; dd; dd = dd->dd_parent) { in closest_common_ancestor()
1906 mutex_enter(&dd->dd_lock); in would_change()
1907 delta = parent_delta(dd, dsl_dir_phys(dd)->dd_used_bytes, delta); in would_change()
1908 mutex_exit(&dd->dd_lock); in would_change()
1909 return (would_change(dd->dd_parent, delta, ancestor)); in would_change()
1935 int namelen = strlen(namebuf) + dvra->char_delta; in dsl_valid_rename()
1936 int depth = get_dataset_depth(namebuf) + dvra->nest_delta; in dsl_valid_rename()
1940 if (dvra->nest_delta > 0 && depth >= zfs_max_dataset_nesting) in dsl_valid_rename()
1958 error = dsl_dir_hold(dp, ddra->ddra_oldname, FTAG, &dd, NULL); in dsl_dir_rename_check()
1963 error = dsl_dir_hold(dp, ddra->ddra_newname, FTAG, in dsl_dir_rename_check()
1971 if (dd->dd_pool != newparent->dd_pool) { in dsl_dir_rename_check()
1985 error = dsl_dataset_hold_obj(newparent->dd_pool, in dsl_dir_rename_check()
1986 dsl_dir_phys(newparent)->dd_head_dataset_obj, FTAG, &parentds); in dsl_dir_rename_check()
2007 ASSERT3U(strnlen(ddra->ddra_newname, ZFS_MAX_DATASET_NAME_LEN), in dsl_dir_rename_check()
2009 ASSERT3U(strnlen(ddra->ddra_oldname, ZFS_MAX_DATASET_NAME_LEN), in dsl_dir_rename_check()
2011 dvra.char_delta = strlen(ddra->ddra_newname) in dsl_dir_rename_check()
2012 - strlen(ddra->ddra_oldname); in dsl_dir_rename_check()
2013 dvra.nest_delta = get_dataset_depth(ddra->ddra_newname) in dsl_dir_rename_check()
2014 - get_dataset_depth(ddra->ddra_oldname); in dsl_dir_rename_check()
2018 error = dmu_objset_find_dp(dp, dd->dd_object, dsl_valid_rename, in dsl_dir_rename_check()
2028 if (spa_feature_is_active(dp->dp_spa, in dsl_dir_rename_check()
2032 * normally make on-disk changes in check functions, in dsl_dir_rename_check()
2035 * Ensure this portion of the tree's counts have been in dsl_dir_rename_check()
2042 if (newparent != dd->dd_parent) { in dsl_dir_rename_check()
2045 MAX(dsl_dir_phys(dd)->dd_used_bytes, in dsl_dir_rename_check()
2046 dsl_dir_phys(dd)->dd_reserved); in dsl_dir_rename_check()
2047 objset_t *os = dd->dd_pool->dp_meta_objset; in dsl_dir_rename_check()
2054 err = zap_lookup(os, dd->dd_object, in dsl_dir_rename_check()
2069 err = zap_lookup(os, dd->dd_object, in dsl_dir_rename_check()
2094 error = dsl_dir_transfer_possible(dd->dd_parent, in dsl_dir_rename_check()
2096 ddra->ddra_cred, ddra->ddra_proc); in dsl_dir_rename_check()
2116 objset_t *mos = dp->dp_meta_objset; in dsl_dir_rename_sync()
2118 VERIFY0(dsl_dir_hold(dp, ddra->ddra_oldname, FTAG, &dd, NULL)); in dsl_dir_rename_sync()
2119 VERIFY0(dsl_dir_hold(dp, ddra->ddra_newname, FTAG, &newparent, in dsl_dir_rename_sync()
2126 "-> %s", ddra->ddra_newname); in dsl_dir_rename_sync()
2128 if (newparent != dd->dd_parent) { in dsl_dir_rename_sync()
2129 objset_t *os = dd->dd_pool->dp_meta_objset; in dsl_dir_rename_sync()
2134 * We already made sure the dd counts were initialized in the in dsl_dir_rename_sync()
2137 if (spa_feature_is_active(dp->dp_spa, in dsl_dir_rename_sync()
2139 VERIFY0(zap_lookup(os, dd->dd_object, in dsl_dir_rename_sync()
2145 VERIFY0(zap_lookup(os, dd->dd_object, in dsl_dir_rename_sync()
2150 dsl_fs_ss_count_adjust(dd->dd_parent, -fs_cnt, in dsl_dir_rename_sync()
2155 dsl_fs_ss_count_adjust(dd->dd_parent, -ss_cnt, in dsl_dir_rename_sync()
2160 dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD, in dsl_dir_rename_sync()
2161 -dsl_dir_phys(dd)->dd_used_bytes, in dsl_dir_rename_sync()
2162 -dsl_dir_phys(dd)->dd_compressed_bytes, in dsl_dir_rename_sync()
2163 -dsl_dir_phys(dd)->dd_uncompressed_bytes, tx); in dsl_dir_rename_sync()
2165 dsl_dir_phys(dd)->dd_used_bytes, in dsl_dir_rename_sync()
2166 dsl_dir_phys(dd)->dd_compressed_bytes, in dsl_dir_rename_sync()
2167 dsl_dir_phys(dd)->dd_uncompressed_bytes, tx); in dsl_dir_rename_sync()
2169 if (dsl_dir_phys(dd)->dd_reserved > in dsl_dir_rename_sync()
2170 dsl_dir_phys(dd)->dd_used_bytes) { in dsl_dir_rename_sync()
2171 uint64_t unused_rsrv = dsl_dir_phys(dd)->dd_reserved - in dsl_dir_rename_sync()
2172 dsl_dir_phys(dd)->dd_used_bytes; in dsl_dir_rename_sync()
2174 dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD_RSRV, in dsl_dir_rename_sync()
2175 -unused_rsrv, 0, 0, tx); in dsl_dir_rename_sync()
2181 dmu_buf_will_dirty(dd->dd_dbuf, tx); in dsl_dir_rename_sync()
2185 dsl_dir_phys(dd->dd_parent)->dd_child_dir_zapobj, in dsl_dir_rename_sync()
2186 dd->dd_myname, tx)); in dsl_dir_rename_sync()
2188 (void) strlcpy(dd->dd_myname, mynewname, in dsl_dir_rename_sync()
2189 sizeof (dd->dd_myname)); in dsl_dir_rename_sync()
2190 dsl_dir_rele(dd->dd_parent, dd); in dsl_dir_rename_sync()
2191 dsl_dir_phys(dd)->dd_parent_obj = newparent->dd_object; in dsl_dir_rename_sync()
2193 newparent->dd_object, NULL, dd, &dd->dd_parent)); in dsl_dir_rename_sync()
2196 VERIFY0(zap_add(mos, dsl_dir_phys(newparent)->dd_child_dir_zapobj, in dsl_dir_rename_sync()
2197 dd->dd_myname, 8, 1, &dd->dd_object, tx)); in dsl_dir_rename_sync()
2200 zfsvfs_update_fromname(ddra->ddra_oldname, ddra->ddra_newname); in dsl_dir_rename_sync()
2201 zvol_rename_minors(dp->dp_spa, ddra->ddra_oldname, in dsl_dir_rename_sync()
2202 ddra->ddra_newname, B_TRUE); in dsl_dir_rename_sync()
2236 adelta = would_change(sdd, -space, ancestor); in dsl_dir_transfer_possible()
2258 mutex_enter(&dd->dd_lock); in dsl_dir_snap_cmtime()
2259 t = dd->dd_snap_cmtime; in dsl_dir_snap_cmtime()
2260 mutex_exit(&dd->dd_lock); in dsl_dir_snap_cmtime()
2272 mutex_enter(&dd->dd_lock); in dsl_dir_snap_cmtime_update()
2273 dd->dd_snap_cmtime = t; in dsl_dir_snap_cmtime_update()
2274 if (spa_feature_is_enabled(dp->dp_spa, in dsl_dir_snap_cmtime_update()
2276 objset_t *mos = dd->dd_pool->dp_meta_objset; in dsl_dir_snap_cmtime_update()
2277 uint64_t ddobj = dd->dd_object; in dsl_dir_snap_cmtime_update()
2285 mutex_exit(&dd->dd_lock); in dsl_dir_snap_cmtime_update()
2291 objset_t *mos = dd->dd_pool->dp_meta_objset; in dsl_dir_zapify()
2292 dmu_object_zapify(mos, dd->dd_object, DMU_OT_DSL_DIR, tx); in dsl_dir_zapify()
2300 dmu_object_info_from_db(dd->dd_dbuf, &doi); in dsl_dir_is_zapified()
2307 objset_t *mos = dd->dd_pool->dp_meta_objset; in dsl_dir_livelist_open()
2308 ASSERT(spa_feature_is_active(dd->dd_pool->dp_spa, in dsl_dir_livelist_open()
2310 dsl_deadlist_open(&dd->dd_livelist, mos, obj); in dsl_dir_livelist_open()
2311 bplist_create(&dd->dd_pending_allocs); in dsl_dir_livelist_open()
2312 bplist_create(&dd->dd_pending_frees); in dsl_dir_livelist_open()
2318 dsl_deadlist_close(&dd->dd_livelist); in dsl_dir_livelist_close()
2319 bplist_destroy(&dd->dd_pending_allocs); in dsl_dir_livelist_close()
2320 bplist_destroy(&dd->dd_pending_frees); in dsl_dir_livelist_close()
2328 spa_t *spa = dp->dp_spa; in dsl_dir_remove_livelist()
2329 livelist_condense_entry_t to_condense = spa->spa_to_condense; in dsl_dir_remove_livelist()
2331 if (!dsl_deadlist_is_open(&dd->dd_livelist)) in dsl_dir_remove_livelist()
2337 * struct in case the condense no-wait synctask has already started in dsl_dir_remove_livelist()
2339 zthr_t *ll_condense_thread = spa->spa_livelist_condense_zthr; in dsl_dir_remove_livelist()
2341 (to_condense.ds != NULL) && (to_condense.ds->ds_dir == dd)) { in dsl_dir_remove_livelist()
2347 spa->spa_to_condense.cancelled = B_TRUE; in dsl_dir_remove_livelist()
2352 * because the no-wait synctask has started (which is in dsl_dir_remove_livelist()
2365 if ((spa->spa_to_condense.ds != NULL) && in dsl_dir_remove_livelist()
2366 !spa->spa_to_condense.syncing) { in dsl_dir_remove_livelist()
2367 dmu_buf_rele(spa->spa_to_condense.ds->ds_dbuf, in dsl_dir_remove_livelist()
2369 spa->spa_to_condense.ds = NULL; in dsl_dir_remove_livelist()
2374 VERIFY0(zap_lookup(dp->dp_meta_objset, dd->dd_object, in dsl_dir_remove_livelist()
2376 VERIFY0(zap_remove(dp->dp_meta_objset, dd->dd_object, in dsl_dir_remove_livelist()
2379 dsl_deadlist_free(dp->dp_meta_objset, obj, tx); in dsl_dir_remove_livelist()
2390 ASSERT(MUTEX_HELD(&dd->dd_activity_lock)); in dsl_dir_activity_in_progress()
2400 mutex_enter(&os->os_user_ptr_lock); in dsl_dir_activity_in_progress()
2402 mutex_exit(&os->os_user_ptr_lock); in dsl_dir_activity_in_progress()
2416 if (readonly || !spa_writeable(dd->dd_pool->dp_spa)) { in dsl_dir_activity_in_progress()
2456 dsl_pool_t *dp = dd->dd_pool; in dsl_dir_wait()
2467 if (cv_wait_sig(&dd->dd_activity_cv, &dd->dd_activity_lock) == in dsl_dir_wait()
2468 0 || dd->dd_activity_cancelled) { in dsl_dir_wait()
2479 mutex_enter(&dd->dd_activity_lock); in dsl_dir_cancel_waiters()
2480 dd->dd_activity_cancelled = B_TRUE; in dsl_dir_cancel_waiters()
2481 cv_broadcast(&dd->dd_activity_cv); in dsl_dir_cancel_waiters()
2482 while (dd->dd_activity_waiters > 0) in dsl_dir_cancel_waiters()
2483 cv_wait(&dd->dd_activity_cv, &dd->dd_activity_lock); in dsl_dir_cancel_waiters()
2484 mutex_exit(&dd->dd_activity_lock); in dsl_dir_cancel_waiters()