Lines Matching full:os
96 static void dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb);
97 static void dmu_objset_upgrade_stop(objset_t *os);
112 dmu_objset_spa(objset_t *os)
114 return (os->os_spa);
118 dmu_objset_zil(objset_t *os)
120 return (os->os_zil);
124 dmu_objset_pool(objset_t *os)
128 if ((ds = os->os_dsl_dataset) != NULL && ds->ds_dir)
131 return (spa_get_dsl(os->os_spa));
135 dmu_objset_ds(objset_t *os)
137 return (os->os_dsl_dataset);
141 dmu_objset_type(objset_t *os)
143 return (os->os_phys->os_type);
147 dmu_objset_name(objset_t *os, char *buf)
149 dsl_dataset_name(os->os_dsl_dataset, buf);
153 dmu_objset_id(objset_t *os)
155 dsl_dataset_t *ds = os->os_dsl_dataset;
161 dmu_objset_dnodesize(objset_t *os)
163 return (os->os_dnodesize);
167 dmu_objset_syncprop(objset_t *os)
169 return (os->os_sync);
173 dmu_objset_logbias(objset_t *os)
175 return (os->os_logbias);
181 objset_t *os = arg;
188 os->os_checksum = zio_checksum_select(newval, ZIO_CHECKSUM_ON_VALUE);
194 objset_t *os = arg;
201 os->os_compress = zio_compress_select(os->os_spa,
203 os->os_complevel = zio_complevel_select(os->os_spa, os->os_compress,
210 objset_t *os = arg;
216 ASSERT(newval <= spa_max_replication(os->os_spa));
218 os->os_copies = newval;
224 objset_t *os = arg;
225 spa_t *spa = os->os_spa;
235 os->os_dedup_checksum = checksum & ZIO_CHECKSUM_MASK;
236 os->os_dedup_verify = !!(checksum & ZIO_CHECKSUM_VERIFY);
242 objset_t *os = arg;
250 os->os_primary_cache = newval;
256 objset_t *os = arg;
264 os->os_secondary_cache = newval;
270 objset_t *os = arg;
277 os->os_prefetch = newval;
283 objset_t *os = arg;
291 os->os_sync = newval;
292 if (os->os_zil)
293 zil_set_sync(os->os_zil, newval);
299 objset_t *os = arg;
309 os->os_redundant_metadata = newval;
315 objset_t *os = arg;
319 os->os_dnodesize = DNODE_MIN_SIZE;
328 os->os_dnodesize = DNODE_MIN_SIZE * 2;
335 os->os_dnodesize = newval;
343 objset_t *os = arg;
351 os->os_zpl_special_smallblock = newval;
357 objset_t *os = arg;
365 os->os_direct = newval;
371 objset_t *os = arg;
375 os->os_logbias = newval;
376 if (os->os_zil)
377 zil_set_logbias(os->os_zil, newval);
383 objset_t *os = arg;
385 os->os_recordsize = newval;
411 dnode_hash(const objset_t *os, uint64_t obj)
413 uintptr_t osv = (uintptr_t)os;
434 dmu_os_is_l2cacheable(objset_t *os)
436 if (os->os_secondary_cache == ZFS_CACHE_ALL ||
437 os->os_secondary_cache == ZFS_CACHE_METADATA) {
441 blkptr_t *bp = os->os_rootbp;
445 vdev_t *rvd = os->os_spa->spa_root_vdev;
469 objset_t *os;
491 os = kmem_zalloc(sizeof (objset_t), KM_SLEEP);
492 os->os_dsl_dataset = ds;
493 os->os_spa = spa;
494 os->os_rootbp = bp;
495 if (!BP_IS_HOLE(os->os_rootbp)) {
503 if (dmu_os_is_l2cacheable(os))
512 dprintf_bp(os->os_rootbp, "reading %s", "");
513 err = arc_read(NULL, spa, os->os_rootbp,
514 arc_getbuf_func, &os->os_phys_buf,
517 kmem_free(os, sizeof (objset_t));
533 if (arc_buf_size(os->os_phys_buf) < size) {
534 arc_buf_t *buf = arc_alloc_buf(spa, &os->os_phys_buf,
537 memcpy(buf->b_data, os->os_phys_buf->b_data,
538 arc_buf_size(os->os_phys_buf));
539 arc_buf_destroy(os->os_phys_buf, &os->os_phys_buf);
540 os->os_phys_buf = buf;
543 os->os_phys = os->os_phys_buf->b_data;
544 os->os_flags = os->os_phys->os_flags;
548 os->os_phys_buf = arc_alloc_buf(spa, &os->os_phys_buf,
550 os->os_phys = os->os_phys_buf->b_data;
551 memset(os->os_phys, 0, size);
557 os->os_version = OBJSET_PROP_UNINITIALIZED;
558 os->os_normalization = OBJSET_PROP_UNINITIALIZED;
559 os->os_utf8only = OBJSET_PROP_UNINITIALIZED;
560 os->os_casesensitivity = OBJSET_PROP_UNINITIALIZED;
569 os->os_encrypted = (ds->ds_dir->dd_crypto_obj != 0);
573 primary_cache_changed_cb, os);
577 secondary_cache_changed_cb, os);
582 prefetch_changed_cb, os);
588 checksum_changed_cb, os);
593 compression_changed_cb, os);
598 copies_changed_cb, os);
603 dedup_changed_cb, os);
608 logbias_changed_cb, os);
613 sync_changed_cb, os);
619 redundant_metadata_changed_cb, os);
624 recordsize_changed_cb, os);
629 dnodesize_changed_cb, os);
635 smallblk_changed_cb, os);
640 direct_changed_cb, os);
644 arc_buf_destroy(os->os_phys_buf, &os->os_phys_buf);
645 kmem_free(os, sizeof (objset_t));
650 os->os_checksum = ZIO_CHECKSUM_FLETCHER_4;
651 os->os_compress = ZIO_COMPRESS_ON;
652 os->os_complevel = ZIO_COMPLEVEL_DEFAULT;
653 os->os_encrypted = B_FALSE;
654 os->os_copies = spa_max_replication(spa);
655 os->os_dedup_checksum = ZIO_CHECKSUM_OFF;
656 os->os_dedup_verify = B_FALSE;
657 os->os_logbias = ZFS_LOGBIAS_LATENCY;
658 os->os_sync = ZFS_SYNC_STANDARD;
659 os->os_primary_cache = ZFS_CACHE_ALL;
660 os->os_secondary_cache = ZFS_CACHE_ALL;
661 os->os_dnodesize = DNODE_MIN_SIZE;
662 os->os_prefetch = ZFS_PREFETCH_ALL;
666 os->os_zil_header = os->os_phys->os_zil_header;
667 os->os_zil = zil_alloc(os, &os->os_zil_header);
670 multilist_create(&os->os_dirty_dnodes[i], sizeof (dnode_t),
674 list_create(&os->os_dnodes, sizeof (dnode_t),
676 list_create(&os->os_downgraded_dbufs, sizeof (dmu_buf_impl_t),
679 list_link_init(&os->os_evicting_node);
681 mutex_init(&os->os_lock, NULL, MUTEX_DEFAULT, NULL);
682 mutex_init(&os->os_userused_lock, NULL, MUTEX_DEFAULT, NULL);
683 mutex_init(&os->os_obj_lock, NULL, MUTEX_DEFAULT, NULL);
684 mutex_init(&os->os_user_ptr_lock, NULL, MUTEX_DEFAULT, NULL);
685 os->os_obj_next_percpu_len = boot_ncpus;
686 os->os_obj_next_percpu = kmem_zalloc(os->os_obj_next_percpu_len *
687 sizeof (os->os_obj_next_percpu[0]), KM_SLEEP);
689 dnode_special_open(os, &os->os_phys->os_meta_dnode,
690 DMU_META_DNODE_OBJECT, &os->os_meta_dnode);
691 if (OBJSET_BUF_HAS_USERUSED(os->os_phys_buf)) {
692 dnode_special_open(os, &os->os_phys->os_userused_dnode,
693 DMU_USERUSED_OBJECT, &os->os_userused_dnode);
694 dnode_special_open(os, &os->os_phys->os_groupused_dnode,
695 DMU_GROUPUSED_OBJECT, &os->os_groupused_dnode);
696 if (OBJSET_BUF_HAS_PROJECTUSED(os->os_phys_buf))
697 dnode_special_open(os,
698 &os->os_phys->os_projectused_dnode,
699 DMU_PROJECTUSED_OBJECT, &os->os_projectused_dnode);
702 mutex_init(&os->os_upgrade_lock, NULL, MUTEX_DEFAULT, NULL);
704 *osp = os;
722 objset_t *os;
725 ds, dsl_dataset_get_blkptr(ds), &os);
731 ds->ds_objset = os;
796 /* if we are decrypting, we can now check MACs in os->os_phys_buf */
886 dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, const void *tag)
889 dsl_pool_t *dp = dmu_objset_pool(os);
892 dsl_dataset_rele_flags(os->os_dsl_dataset, flags, tag);
897 dmu_objset_rele(objset_t *os, const void *tag)
899 dmu_objset_rele_flags(os, B_FALSE, tag);
903 * When we are called, os MUST refer to an objset associated with a dataset
935 dmu_objset_disown(objset_t *os, boolean_t decrypt, const void *tag)
943 dmu_objset_upgrade_stop(os);
944 dsl_dataset_disown(os->os_dsl_dataset, flags, tag);
948 dmu_objset_evict_dbufs(objset_t *os)
955 mutex_enter(&os->os_lock);
956 dn = list_head(&os->os_dnodes);
964 list_insert_after(&os->os_dnodes, dn, dn_marker);
965 mutex_exit(&os->os_lock);
970 mutex_enter(&os->os_lock);
971 dn = list_next(&os->os_dnodes, dn_marker);
972 list_remove(&os->os_dnodes, dn_marker);
974 dn = list_next(&os->os_dnodes, dn);
977 mutex_exit(&os->os_lock);
981 if (DMU_USERUSED_DNODE(os) != NULL) {
982 if (DMU_PROJECTUSED_DNODE(os) != NULL)
983 dnode_evict_dbufs(DMU_PROJECTUSED_DNODE(os));
984 dnode_evict_dbufs(DMU_GROUPUSED_DNODE(os));
985 dnode_evict_dbufs(DMU_USERUSED_DNODE(os));
987 dnode_evict_dbufs(DMU_META_DNODE(os));
994 * second phase of eviction. Once os->os_dnodes has been cleared by
1001 * objset to have no holds even though os->os_dnodes is not empty.
1004 dmu_objset_evict(objset_t *os)
1006 dsl_dataset_t *ds = os->os_dsl_dataset;
1009 ASSERT(!dmu_objset_is_dirty(os, t));
1012 dsl_prop_unregister_all(ds, os);
1014 if (os->os_sa)
1015 sa_tear_down(os);
1017 dmu_objset_evict_dbufs(os);
1019 mutex_enter(&os->os_lock);
1020 spa_evicting_os_register(os->os_spa, os);
1021 if (list_is_empty(&os->os_dnodes)) {
1022 mutex_exit(&os->os_lock);
1023 dmu_objset_evict_done(os);
1025 mutex_exit(&os->os_lock);
1032 dmu_objset_evict_done(objset_t *os)
1034 ASSERT3P(list_head(&os->os_dnodes), ==, NULL);
1036 dnode_special_close(&os->os_meta_dnode);
1037 if (DMU_USERUSED_DNODE(os)) {
1038 if (DMU_PROJECTUSED_DNODE(os))
1039 dnode_special_close(&os->os_projectused_dnode);
1040 dnode_special_close(&os->os_userused_dnode);
1041 dnode_special_close(&os->os_groupused_dnode);
1043 zil_free(os->os_zil);
1045 arc_buf_destroy(os->os_phys_buf, &os->os_phys_buf);
1056 kmem_free(os->os_obj_next_percpu,
1057 os->os_obj_next_percpu_len * sizeof (os->os_obj_next_percpu[0]));
1059 mutex_destroy(&os->os_lock);
1060 mutex_destroy(&os->os_userused_lock);
1061 mutex_destroy(&os->os_obj_lock);
1062 mutex_destroy(&os->os_user_ptr_lock);
1063 mutex_destroy(&os->os_upgrade_lock);
1065 multilist_destroy(&os->os_dirty_dnodes[i]);
1066 spa_evicting_os_deregister(os->os_spa, os);
1067 kmem_free(os, sizeof (objset_t));
1071 dmu_objset_snap_cmtime(objset_t *os)
1073 return (dsl_dir_snap_cmtime(os->os_dsl_dataset->ds_dir));
1080 objset_t *os;
1091 VERIFY0(dmu_objset_from_ds(ds, &os));
1093 VERIFY0(dmu_objset_open_impl(spa, NULL, bp, &os));
1095 mdn = DMU_META_DNODE(os);
1139 os->os_phys->os_type = type;
1145 if (dmu_objset_userused_enabled(os) &&
1146 (!os->os_encrypted || !dmu_objset_is_receiving(os))) {
1147 os->os_phys->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
1148 if (dmu_objset_userobjused_enabled(os)) {
1152 os->os_phys->os_flags |=
1155 if (dmu_objset_projectquota_enabled(os)) {
1159 os->os_phys->os_flags |=
1162 os->os_flags = os->os_phys->os_flags;
1167 return (os);
1182 void (*doca_userfunc)(objset_t *os, void *arg,
1266 objset_t *os;
1278 os = dmu_objset_create_impl(spa, ds, bp, doca->doca_type, tx);
1282 doca->doca_userfunc(os, doca->doca_userarg,
1294 if (os->os_encrypted) {
1311 dmu_objset_sync_done(os, tx);
1499 objset_t *os = data;
1501 mutex_enter(&os->os_upgrade_lock);
1502 os->os_upgrade_status = EINTR;
1503 if (!os->os_upgrade_exit) {
1506 mutex_exit(&os->os_upgrade_lock);
1508 status = os->os_upgrade_cb(os);
1510 mutex_enter(&os->os_upgrade_lock);
1512 os->os_upgrade_status = status;
1514 os->os_upgrade_exit = B_TRUE;
1515 os->os_upgrade_id = 0;
1516 mutex_exit(&os->os_upgrade_lock);
1517 dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
1521 dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb)
1523 if (os->os_upgrade_id != 0)
1526 ASSERT(dsl_pool_config_held(dmu_objset_pool(os)));
1527 dsl_dataset_long_hold(dmu_objset_ds(os), upgrade_tag);
1529 mutex_enter(&os->os_upgrade_lock);
1530 if (os->os_upgrade_id == 0 && os->os_upgrade_status == 0) {
1531 os->os_upgrade_exit = B_FALSE;
1532 os->os_upgrade_cb = cb;
1533 os->os_upgrade_id = taskq_dispatch(
1534 os->os_spa->spa_upgrade_taskq,
1535 dmu_objset_upgrade_task_cb, os, TQ_SLEEP);
1536 if (os->os_upgrade_id == TASKQID_INVALID) {
1537 dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
1538 os->os_upgrade_status = ENOMEM;
1541 dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
1543 mutex_exit(&os->os_upgrade_lock);
1547 dmu_objset_upgrade_stop(objset_t *os)
1549 mutex_enter(&os->os_upgrade_lock);
1550 os->os_upgrade_exit = B_TRUE;
1551 if (os->os_upgrade_id != 0) {
1552 taskqid_t id = os->os_upgrade_id;
1554 os->os_upgrade_id = 0;
1555 mutex_exit(&os->os_upgrade_lock);
1557 if ((taskq_cancel_id(os->os_spa->spa_upgrade_taskq, id)) == 0) {
1558 dsl_dataset_long_rele(dmu_objset_ds(os), upgrade_tag);
1560 txg_wait_synced(os->os_spa->spa_dsl_pool, 0);
1562 mutex_exit(&os->os_upgrade_lock);
1602 objset_t *os = arg;
1603 dnode_phys_t *dnp = &os->os_phys->os_meta_dnode;
1621 if (os->os_dsl_dataset != NULL)
1622 rrw_enter(&os->os_dsl_dataset->ds_bp_rwlock, RW_WRITER, FTAG);
1623 *os->os_rootbp = *bp;
1624 if (os->os_dsl_dataset != NULL)
1625 rrw_exit(&os->os_dsl_dataset->ds_bp_rwlock, FTAG);
1634 objset_t *os = arg;
1639 dsl_dataset_t *ds = os->os_dsl_dataset;
1640 dmu_tx_t *tx = os->os_synctx;
1671 objset_t *os = soa->soa_os;
1673 uint_t allocator = spa_acq_allocator(os->os_spa);
1680 spa_rel_allocator(os->os_spa, allocator);
1692 taskq_dispatch_ent(dmu_objset_pool(os)->dp_sync_taskq,
1705 objset_t *os = soa->soa_os;
1712 list_t *list = &DMU_META_DNODE(os)->dn_dirty_records[txgoff];
1719 if (os->os_freed_dnodes >= dmu_rescan_dnode_threshold) {
1720 os->os_rescan_dnodes = B_TRUE;
1721 os->os_freed_dnodes = 0;
1727 zil_sync(os->os_zil, tx);
1728 os->os_phys->os_zil_header = os->os_zil_header;
1737 dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
1745 blkptr_t *blkptr_copy = kmem_alloc(sizeof (*os->os_rootbp), KM_SLEEP);
1746 *blkptr_copy = *os->os_rootbp;
1748 dprintf_ds(os->os_dsl_dataset, "txg=%llu\n", (u_longlong_t)tx->tx_txg);
1752 os->os_synctx = tx;
1754 if (os->os_dsl_dataset == NULL) {
1760 os->os_copies = spa_max_replication(os->os_spa);
1766 SET_BOOKMARK(&zb, os->os_dsl_dataset ?
1767 os->os_dsl_dataset->ds_object : DMU_META_OBJSET,
1769 arc_release(os->os_phys_buf, &os->os_phys_buf);
1771 dmu_write_policy(os, NULL, 0, 0, &zp);
1778 if (os->os_raw_receive ||
1779 os->os_next_write_raw[tx->tx_txg & TXG_MASK]) {
1780 ASSERT(os->os_encrypted);
1781 arc_convert_to_raw(os->os_phys_buf,
1782 os->os_dsl_dataset->ds_object, ZFS_HOST_BYTEORDER,
1786 zio = arc_write(pio, os->os_spa, tx->tx_txg,
1787 blkptr_copy, os->os_phys_buf, B_FALSE, dmu_os_is_l2cacheable(os),
1789 os, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb);
1794 DMU_META_DNODE(os)->dn_zio = zio;
1795 dnode_sync(DMU_META_DNODE(os), tx);
1797 os->os_phys->os_flags = os->os_flags;
1799 if (DMU_USERUSED_DNODE(os) &&
1800 DMU_USERUSED_DNODE(os)->dn_type != DMU_OT_NONE) {
1801 DMU_USERUSED_DNODE(os)->dn_zio = zio;
1802 dnode_sync(DMU_USERUSED_DNODE(os), tx);
1803 DMU_GROUPUSED_DNODE(os)->dn_zio = zio;
1804 dnode_sync(DMU_GROUPUSED_DNODE(os), tx);
1807 if (DMU_PROJECTUSED_DNODE(os) &&
1808 DMU_PROJECTUSED_DNODE(os)->dn_type != DMU_OT_NONE) {
1809 DMU_PROJECTUSED_DNODE(os)->dn_zio = zio;
1810 dnode_sync(DMU_PROJECTUSED_DNODE(os), tx);
1820 if (os->os_synced_dnodes.ml_sublists == NULL) {
1821 multilist_create(&os->os_synced_dnodes, sizeof (dnode_t),
1825 ASSERT3U(os->os_synced_dnodes.ml_offset, ==,
1836 soa->soa_os = os;
1841 ml = &os->os_dirty_dnodes[txgoff];
1850 taskq_dispatch_ent(dmu_objset_pool(os)->dp_sync_taskq,
1867 dmu_objset_pool(os)->dp_sync_taskq,
1875 dmu_objset_is_dirty(objset_t *os, uint64_t txg)
1877 return (!multilist_is_empty(&os->os_dirty_dnodes[txg & TXG_MASK]));
1889 dmu_get_file_info(objset_t *os, dmu_object_type_t bonustype, const void *data,
1892 file_info_cb_t *cb = file_cbs[os->os_phys->os_type];
1899 dmu_objset_userused_enabled(objset_t *os)
1901 return (spa_version(os->os_spa) >= SPA_VERSION_USERSPACE &&
1902 file_cbs[os->os_phys->os_type] != NULL &&
1903 DMU_USERUSED_DNODE(os) != NULL);
1907 dmu_objset_userobjused_enabled(objset_t *os)
1909 return (dmu_objset_userused_enabled(os) &&
1910 spa_feature_is_enabled(os->os_spa, SPA_FEATURE_USEROBJ_ACCOUNTING));
1914 dmu_objset_projectquota_enabled(objset_t *os)
1916 return (file_cbs[os->os_phys->os_type] != NULL &&
1917 DMU_PROJECTUSED_DNODE(os) != NULL &&
1918 spa_feature_is_enabled(os->os_spa, SPA_FEATURE_PROJECT_QUOTA));
1951 do_userquota_cacheflush(objset_t *os, userquota_cache_t *cache, dmu_tx_t *tx)
1966 mutex_enter(&os->os_userused_lock);
1967 VERIFY0(zap_increment(os, DMU_USERUSED_OBJECT,
1969 mutex_exit(&os->os_userused_lock);
1977 mutex_enter(&os->os_userused_lock);
1978 VERIFY0(zap_increment(os, DMU_GROUPUSED_OBJECT,
1980 mutex_exit(&os->os_userused_lock);
1985 if (dmu_objset_projectquota_enabled(os)) {
1989 mutex_enter(&os->os_userused_lock);
1990 VERIFY0(zap_increment(os, DMU_PROJECTUSED_OBJECT,
1992 mutex_exit(&os->os_userused_lock);
2021 do_userquota_update(objset_t *os, userquota_cache_t *cache, uint64_t used,
2038 if (dmu_objset_projectquota_enabled(os)) {
2048 do_userobjquota_update(objset_t *os, userquota_cache_t *cache, uint64_t flags,
2063 if (dmu_objset_projectquota_enabled(os)) {
2082 objset_t *os = uua->uua_os;
2088 &os->os_synced_dnodes, uua->uua_sublist_idx);
2091 dmu_objset_userused_enabled(os));
2096 if (dmu_objset_projectquota_enabled(os))
2111 do_userquota_update(os, &cache, dn->dn_oldused,
2114 do_userobjquota_update(os, &cache, dn->dn_oldflags,
2119 do_userquota_update(os, &cache,
2123 do_userobjquota_update(os, &cache,
2145 dnode_rele(dn, &os->os_synced_dnodes);
2147 do_userquota_cacheflush(os, &cache, tx);
2168 objset_t *os = uua->uua_os;
2171 &os->os_synced_dnodes, uua->uua_sublist_idx);
2176 dnode_rele(dn, &os->os_synced_dnodes);
2186 dmu_objset_do_userquota_updates_prep(objset_t *os, dmu_tx_t *tx)
2188 if (!dmu_objset_userused_enabled(os))
2198 if (os->os_encrypted && dmu_objset_is_receiving(os))
2201 if (tx->tx_txg <= os->os_spa->spa_claim_max_txg)
2205 if (DMU_USERUSED_DNODE(os)->dn_type == DMU_OT_NONE) {
2206 VERIFY0(zap_create_claim(os,
2209 VERIFY0(zap_create_claim(os,
2214 if (dmu_objset_projectquota_enabled(os) &&
2215 DMU_PROJECTUSED_DNODE(os)->dn_type == DMU_OT_NONE) {
2216 VERIFY0(zap_create_claim(os, DMU_PROJECTUSED_OBJECT,
2228 dmu_objset_sync_done(objset_t *os, dmu_tx_t *tx)
2230 boolean_t need_userquota = dmu_objset_do_userquota_updates_prep(os, tx);
2232 int num_sublists = multilist_get_num_sublists(&os->os_synced_dnodes);
2236 uua->uua_os = os;
2244 (void) taskq_dispatch(dmu_objset_pool(os)->dp_sync_taskq,
2286 objset_t *os = dn->dn_objset;
2305 if (os->os_encrypted && dmu_objset_is_receiving(os))
2347 error = file_cbs[os->os_phys->os_type](dn->dn_bonustype, data, &zfi);
2400 dmu_objset_userspace_present(objset_t *os)
2402 return (os->os_phys->os_flags &
2407 dmu_objset_userobjspace_present(objset_t *os)
2409 return (os->os_phys->os_flags &
2414 dmu_objset_projectquota_present(objset_t *os)
2416 return (os->os_phys->os_flags &
2421 dmu_objset_space_upgrade(objset_t *os)
2434 for (obj = 0; err == 0; err = dmu_object_next(os, &obj, FALSE, 0)) {
2439 mutex_enter(&os->os_upgrade_lock);
2440 if (os->os_upgrade_exit)
2442 mutex_exit(&os->os_upgrade_lock);
2449 objerr = dmu_bonus_hold(os, obj, FTAG, &db);
2452 tx = dmu_tx_create(os);
2468 dmu_objset_userspace_upgrade_cb(objset_t *os)
2472 if (dmu_objset_userspace_present(os))
2474 if (dmu_objset_is_snapshot(os))
2476 if (!dmu_objset_userused_enabled(os))
2479 err = dmu_objset_space_upgrade(os);
2483 os->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
2484 txg_wait_synced(dmu_objset_pool(os), 0);
2489 dmu_objset_userspace_upgrade(objset_t *os)
2491 dmu_objset_upgrade(os, dmu_objset_userspace_upgrade_cb);
2495 dmu_objset_id_quota_upgrade_cb(objset_t *os)
2499 if (dmu_objset_userobjspace_present(os) &&
2500 dmu_objset_projectquota_present(os))
2502 if (dmu_objset_is_snapshot(os))
2504 if (!dmu_objset_userused_enabled(os))
2506 if (!dmu_objset_projectquota_enabled(os) &&
2507 dmu_objset_userobjspace_present(os))
2510 if (dmu_objset_userobjused_enabled(os))
2511 dmu_objset_ds(os)->ds_feature_activation[
2513 if (dmu_objset_projectquota_enabled(os))
2514 dmu_objset_ds(os)->ds_feature_activation[
2517 err = dmu_objset_space_upgrade(os);
2521 os->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
2522 if (dmu_objset_userobjused_enabled(os))
2523 os->os_flags |= OBJSET_FLAG_USEROBJACCOUNTING_COMPLETE;
2524 if (dmu_objset_projectquota_enabled(os))
2525 os->os_flags |= OBJSET_FLAG_PROJECTQUOTA_COMPLETE;
2527 txg_wait_synced(dmu_objset_pool(os), 0);
2532 dmu_objset_id_quota_upgrade(objset_t *os)
2534 dmu_objset_upgrade(os, dmu_objset_id_quota_upgrade_cb);
2538 dmu_objset_userobjspace_upgradable(objset_t *os)
2540 return (dmu_objset_type(os) == DMU_OST_ZFS &&
2541 !dmu_objset_is_snapshot(os) &&
2542 dmu_objset_userobjused_enabled(os) &&
2543 !dmu_objset_userobjspace_present(os) &&
2544 spa_writeable(dmu_objset_spa(os)));
2548 dmu_objset_projectquota_upgradable(objset_t *os)
2550 return (dmu_objset_type(os) == DMU_OST_ZFS &&
2551 !dmu_objset_is_snapshot(os) &&
2552 dmu_objset_projectquota_enabled(os) &&
2553 !dmu_objset_projectquota_present(os) &&
2554 spa_writeable(dmu_objset_spa(os)));
2558 dmu_objset_space(objset_t *os, uint64_t *refdbytesp, uint64_t *availbytesp,
2561 dsl_dataset_space(os->os_dsl_dataset, refdbytesp, availbytesp,
2566 dmu_objset_fsid_guid(objset_t *os)
2568 return (dsl_dataset_fsid_guid(os->os_dsl_dataset));
2572 dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *stat)
2574 stat->dds_type = os->os_phys->os_type;
2575 if (os->os_dsl_dataset)
2576 dsl_dataset_fast_stat(os->os_dsl_dataset, stat);
2580 dmu_objset_stats(objset_t *os, nvlist_t *nv)
2582 ASSERT(os->os_dsl_dataset ||
2583 os->os_phys->os_type == DMU_OST_META);
2585 if (os->os_dsl_dataset != NULL)
2586 dsl_dataset_stats(os->os_dsl_dataset, nv);
2589 os->os_phys->os_type);
2591 dmu_objset_userspace_present(os));
2595 dmu_objset_is_snapshot(objset_t *os)
2597 if (os->os_dsl_dataset != NULL)
2598 return (os->os_dsl_dataset->ds_is_snapshot);
2604 dmu_snapshot_realname(objset_t *os, const char *name, char *real, int maxlen,
2607 dsl_dataset_t *ds = os->os_dsl_dataset;
2619 dmu_snapshot_list_next(objset_t *os, int namelen, char *name,
2622 dsl_dataset_t *ds = os->os_dsl_dataset;
2626 ASSERT(dsl_pool_config_held(dmu_objset_pool(os)));
2662 dmu_snapshot_lookup(objset_t *os, const char *name, uint64_t *value)
2664 return (dsl_dataset_snap_lookup(os->os_dsl_dataset, name, value));
2668 dmu_dir_list_next(objset_t *os, int namelen, char *name,
2671 dsl_dir_t *dd = os->os_dsl_dataset->ds_dir;
2676 if (os->os_dsl_dataset->ds_object !=
3081 dmu_objset_incompatible_encryption_version(objset_t *os)
3084 os->os_dsl_dataset->ds_dir));
3088 dmu_objset_set_user(objset_t *os, void *user_ptr)
3090 ASSERT(MUTEX_HELD(&os->os_user_ptr_lock));
3091 os->os_user_ptr = user_ptr;
3095 dmu_objset_get_user(objset_t *os)
3097 ASSERT(MUTEX_HELD(&os->os_user_ptr_lock));
3098 return (os->os_user_ptr);
3131 dmu_objset_willuse_space(objset_t *os, int64_t space, dmu_tx_t *tx)
3133 dsl_dataset_t *ds = os->os_dsl_dataset;
3134 int64_t aspace = spa_get_worst_case_asize(os->os_spa, space);