Lines Matching refs:os

9  * or http://www.opensolaris.org/os/licensing.
92 dmu_objset_spa(objset_t *os)
94 return (os->os_spa);
98 dmu_objset_zil(objset_t *os)
100 return (os->os_zil);
104 dmu_objset_pool(objset_t *os)
108 if ((ds = os->os_dsl_dataset) != NULL && ds->ds_dir)
111 return (spa_get_dsl(os->os_spa));
115 dmu_objset_ds(objset_t *os)
117 return (os->os_dsl_dataset);
121 dmu_objset_type(objset_t *os)
123 return (os->os_phys->os_type);
127 dmu_objset_name(objset_t *os, char *buf)
129 dsl_dataset_name(os->os_dsl_dataset, buf);
133 dmu_objset_id(objset_t *os)
135 dsl_dataset_t *ds = os->os_dsl_dataset;
141 dmu_objset_syncprop(objset_t *os)
143 return (os->os_sync);
147 dmu_objset_logbias(objset_t *os)
149 return (os->os_logbias);
155 objset_t *os = arg;
162 os->os_checksum = zio_checksum_select(newval, ZIO_CHECKSUM_ON_VALUE);
168 objset_t *os = arg;
175 os->os_compress = zio_compress_select(os->os_spa, newval,
182 objset_t *os = arg;
188 ASSERT(newval <= spa_max_replication(os->os_spa));
190 os->os_copies = newval;
196 objset_t *os = arg;
197 spa_t *spa = os->os_spa;
207 os->os_dedup_checksum = checksum & ZIO_CHECKSUM_MASK;
208 os->os_dedup_verify = !!(checksum & ZIO_CHECKSUM_VERIFY);
214 objset_t *os = arg;
222 os->os_primary_cache = newval;
228 objset_t *os = arg;
236 os->os_secondary_cache = newval;
242 objset_t *os = arg;
250 os->os_sync = newval;
251 if (os->os_zil)
252 zil_set_sync(os->os_zil, newval);
258 objset_t *os = arg;
266 os->os_redundant_metadata = newval;
272 objset_t *os = arg;
276 os->os_logbias = newval;
277 if (os->os_zil)
278 zil_set_logbias(os->os_zil, newval);
284 objset_t *os = arg;
286 os->os_recordsize = newval;
309 objset_t *os;
314 os = kmem_zalloc(sizeof (objset_t), KM_SLEEP);
315 os->os_dsl_dataset = ds;
316 os->os_spa = spa;
317 os->os_rootbp = bp;
318 if (!BP_IS_HOLE(os->os_rootbp)) {
324 if (DMU_OS_IS_L2CACHEABLE(os))
327 dprintf_bp(os->os_rootbp, "reading %s", "");
328 err = arc_read(NULL, spa, os->os_rootbp,
329 arc_getbuf_func, &os->os_phys_buf,
332 kmem_free(os, sizeof (objset_t));
341 arc_buf_size(os->os_phys_buf) < sizeof (objset_phys_t)) {
342 arc_buf_t *buf = arc_alloc_buf(spa, &os->os_phys_buf,
345 bcopy(os->os_phys_buf->b_data, buf->b_data,
346 arc_buf_size(os->os_phys_buf));
347 arc_buf_destroy(os->os_phys_buf, &os->os_phys_buf);
348 os->os_phys_buf = buf;
351 os->os_phys = os->os_phys_buf->b_data;
352 os->os_flags = os->os_phys->os_flags;
356 os->os_phys_buf = arc_alloc_buf(spa, &os->os_phys_buf,
358 os->os_phys = os->os_phys_buf->b_data;
359 bzero(os->os_phys, size);
376 if (!dsl_pool_config_held(dmu_objset_pool(os))) {
378 dsl_pool_config_enter(dmu_objset_pool(os), FTAG);
382 primary_cache_changed_cb, os);
386 secondary_cache_changed_cb, os);
392 checksum_changed_cb, os);
397 compression_changed_cb, os);
402 copies_changed_cb, os);
407 dedup_changed_cb, os);
412 logbias_changed_cb, os);
417 sync_changed_cb, os);
423 redundant_metadata_changed_cb, os);
428 recordsize_changed_cb, os);
432 dsl_pool_config_exit(dmu_objset_pool(os), FTAG);
434 arc_buf_destroy(os->os_phys_buf, &os->os_phys_buf);
435 kmem_free(os, sizeof (objset_t));
440 os->os_checksum = ZIO_CHECKSUM_FLETCHER_4;
441 os->os_compress = ZIO_COMPRESS_ON;
442 os->os_copies = spa_max_replication(spa);
443 os->os_dedup_checksum = ZIO_CHECKSUM_OFF;
444 os->os_dedup_verify = B_FALSE;
445 os->os_logbias = ZFS_LOGBIAS_LATENCY;
446 os->os_sync = ZFS_SYNC_STANDARD;
447 os->os_primary_cache = ZFS_CACHE_ALL;
448 os->os_secondary_cache = ZFS_CACHE_ALL;
452 os->os_zil_header = os->os_phys->os_zil_header;
453 os->os_zil = zil_alloc(os, &os->os_zil_header);
456 list_create(&os->os_dirty_dnodes[i], sizeof (dnode_t),
458 list_create(&os->os_free_dnodes[i], sizeof (dnode_t),
461 list_create(&os->os_dnodes, sizeof (dnode_t),
463 list_create(&os->os_downgraded_dbufs, sizeof (dmu_buf_impl_t),
466 mutex_init(&os->os_lock, NULL, MUTEX_DEFAULT, NULL);
467 mutex_init(&os->os_obj_lock, NULL, MUTEX_DEFAULT, NULL);
468 mutex_init(&os->os_user_ptr_lock, NULL, MUTEX_DEFAULT, NULL);
470 dnode_special_open(os, &os->os_phys->os_meta_dnode,
471 DMU_META_DNODE_OBJECT, &os->os_meta_dnode);
472 if (arc_buf_size(os->os_phys_buf) >= sizeof (objset_phys_t)) {
473 dnode_special_open(os, &os->os_phys->os_userused_dnode,
474 DMU_USERUSED_OBJECT, &os->os_userused_dnode);
475 dnode_special_open(os, &os->os_phys->os_groupused_dnode,
476 DMU_GROUPUSED_OBJECT, &os->os_groupused_dnode);
479 *osp = os;
497 objset_t *os;
500 ds, dsl_dataset_get_blkptr(ds), &os);
506 ds->ds_objset = os;
605 dmu_objset_rele(objset_t *os, void *tag)
607 dsl_pool_t *dp = dmu_objset_pool(os);
608 dsl_dataset_rele(os->os_dsl_dataset, tag);
613 * When we are called, os MUST refer to an objset associated with a dataset
624 dmu_objset_refresh_ownership(objset_t *os, void *tag)
630 ds = os->os_dsl_dataset;
636 dp = dmu_objset_pool(os);
638 dmu_objset_disown(os, tag);
640 VERIFY3P(newds, ==, os->os_dsl_dataset);
645 dmu_objset_disown(objset_t *os, void *tag)
647 dsl_dataset_disown(os->os_dsl_dataset, tag);
651 dmu_objset_evict_dbufs(objset_t *os)
656 mutex_enter(&os->os_lock);
657 dn = list_head(&os->os_dnodes);
665 list_insert_after(&os->os_dnodes, dn, &dn_marker);
666 mutex_exit(&os->os_lock);
671 mutex_enter(&os->os_lock);
672 dn = list_next(&os->os_dnodes, &dn_marker);
673 list_remove(&os->os_dnodes, &dn_marker);
675 dn = list_next(&os->os_dnodes, dn);
678 mutex_exit(&os->os_lock);
680 if (DMU_USERUSED_DNODE(os) != NULL) {
681 dnode_evict_dbufs(DMU_GROUPUSED_DNODE(os));
682 dnode_evict_dbufs(DMU_USERUSED_DNODE(os));
684 dnode_evict_dbufs(DMU_META_DNODE(os));
691 * second phase of eviction. Once os->os_dnodes has been cleared by
698 * objset to have no holds even though os->os_dnodes is not empty.
701 dmu_objset_evict(objset_t *os)
703 dsl_dataset_t *ds = os->os_dsl_dataset;
706 ASSERT(!dmu_objset_is_dirty(os, t));
709 dsl_prop_unregister_all(ds, os);
711 if (os->os_sa)
712 sa_tear_down(os);
714 dmu_objset_evict_dbufs(os);
716 mutex_enter(&os->os_lock);
717 spa_evicting_os_register(os->os_spa, os);
718 if (list_is_empty(&os->os_dnodes)) {
719 mutex_exit(&os->os_lock);
720 dmu_objset_evict_done(os);
722 mutex_exit(&os->os_lock);
727 dmu_objset_evict_done(objset_t *os)
729 ASSERT3P(list_head(&os->os_dnodes), ==, NULL);
731 dnode_special_close(&os->os_meta_dnode);
732 if (DMU_USERUSED_DNODE(os)) {
733 dnode_special_close(&os->os_userused_dnode);
734 dnode_special_close(&os->os_groupused_dnode);
736 zil_free(os->os_zil);
738 arc_buf_destroy(os->os_phys_buf, &os->os_phys_buf);
749 mutex_destroy(&os->os_lock);
750 mutex_destroy(&os->os_obj_lock);
751 mutex_destroy(&os->os_user_ptr_lock);
752 spa_evicting_os_deregister(os->os_spa, os);
753 kmem_free(os, sizeof (objset_t));
757 dmu_objset_snap_cmtime(objset_t *os)
759 return (dsl_dir_snap_cmtime(os->os_dsl_dataset->ds_dir));
767 objset_t *os;
773 VERIFY0(dmu_objset_from_ds(ds, &os));
775 VERIFY0(dmu_objset_open_impl(spa, NULL, bp, &os));
777 mdn = DMU_META_DNODE(os);
818 os->os_phys->os_type = type;
819 if (dmu_objset_userused_enabled(os)) {
820 os->os_phys->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
821 os->os_flags = os->os_phys->os_flags;
826 return (os);
832 void (*doca_userfunc)(objset_t *os, void *arg,
879 objset_t *os;
889 os = dmu_objset_create_impl(pdd->dd_pool->dp_spa,
894 doca->doca_userfunc(os, doca->doca_userarg,
905 void (*func)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx), void *arg)
1060 objset_t *os = arg;
1061 dnode_phys_t *dnp = &os->os_phys->os_meta_dnode;
1076 if (os->os_dsl_dataset != NULL)
1077 rrw_enter(&os->os_dsl_dataset->ds_bp_rwlock, RW_WRITER, FTAG);
1078 *os->os_rootbp = *bp;
1079 if (os->os_dsl_dataset != NULL)
1080 rrw_exit(&os->os_dsl_dataset->ds_bp_rwlock, FTAG);
1089 objset_t *os = arg;
1094 dsl_dataset_t *ds = os->os_dsl_dataset;
1095 dmu_tx_t *tx = os->os_synctx;
1105 dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
1114 blkptr_t *blkptr_copy = kmem_alloc(sizeof (*os->os_rootbp), KM_SLEEP);
1115 *blkptr_copy = *os->os_rootbp;
1117 dprintf_ds(os->os_dsl_dataset, "txg=%llu\n", tx->tx_txg);
1121 os->os_synctx = tx;
1123 if (os->os_dsl_dataset == NULL) {
1129 os->os_copies = spa_max_replication(os->os_spa);
1135 SET_BOOKMARK(&zb, os->os_dsl_dataset ?
1136 os->os_dsl_dataset->ds_object : DMU_META_OBJSET,
1138 arc_release(os->os_phys_buf, &os->os_phys_buf);
1140 dmu_write_policy(os, NULL, 0, 0, ZIO_COMPRESS_INHERIT, &zp);
1142 zio = arc_write(pio, os->os_spa, tx->tx_txg,
1143 blkptr_copy, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os),
1145 os, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb);
1150 DMU_META_DNODE(os)->dn_zio = zio;
1151 dnode_sync(DMU_META_DNODE(os), tx);
1153 os->os_phys->os_flags = os->os_flags;
1155 if (DMU_USERUSED_DNODE(os) &&
1156 DMU_USERUSED_DNODE(os)->dn_type != DMU_OT_NONE) {
1157 DMU_USERUSED_DNODE(os)->dn_zio = zio;
1158 dnode_sync(DMU_USERUSED_DNODE(os), tx);
1159 DMU_GROUPUSED_DNODE(os)->dn_zio = zio;
1160 dnode_sync(DMU_GROUPUSED_DNODE(os), tx);
1165 if (dmu_objset_userused_enabled(os)) {
1166 newlist = &os->os_synced_dnodes;
1175 dmu_objset_sync_dnodes(&os->os_free_dnodes[txgoff], newlist, tx);
1176 dmu_objset_sync_dnodes(&os->os_dirty_dnodes[txgoff], newlist, tx);
1178 list = &DMU_META_DNODE(os)->dn_dirty_records[txgoff];
1187 if (os->os_freed_dnodes >= dmu_rescan_dnode_threshold) {
1188 os->os_rescan_dnodes = B_TRUE;
1189 os->os_freed_dnodes = 0;
1195 zil_sync(os->os_zil, tx);
1196 os->os_phys->os_zil_header = os->os_zil_header;
1201 dmu_objset_is_dirty(objset_t *os, uint64_t txg)
1203 return (!list_is_empty(&os->os_dirty_dnodes[txg & TXG_MASK]) ||
1204 !list_is_empty(&os->os_free_dnodes[txg & TXG_MASK]));
1216 dmu_objset_userused_enabled(objset_t *os)
1218 return (spa_version(os->os_spa) >= SPA_VERSION_USERSPACE &&
1219 used_cbs[os->os_phys->os_type] != NULL &&
1220 DMU_USERUSED_DNODE(os) != NULL);
1248 do_userquota_cacheflush(objset_t *os, userquota_cache_t *cache, dmu_tx_t *tx)
1258 VERIFY0(zap_increment_int(os, DMU_USERUSED_OBJECT,
1267 VERIFY0(zap_increment_int(os, DMU_GROUPUSED_OBJECT,
1304 dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx)
1307 list_t *list = &os->os_synced_dnodes;
1310 ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os));
1325 if (DMU_USERUSED_DNODE(os)->dn_type == DMU_OT_NONE) {
1326 VERIFY0(zap_create_claim(os,
1329 VERIFY0(zap_create_claim(os,
1366 do_userquota_cacheflush(os, &cache, tx);
1412 objset_t *os = dn->dn_objset;
1471 error = used_cbs[os->os_phys->os_type](dn->dn_bonustype, data,
1512 dmu_objset_userspace_present(objset_t *os)
1514 return (os->os_phys->os_flags &
1519 dmu_objset_userspace_upgrade(objset_t *os)
1524 if (dmu_objset_userspace_present(os))
1526 if (!dmu_objset_userused_enabled(os))
1528 if (dmu_objset_is_snapshot(os))
1539 for (obj = 0; err == 0; err = dmu_object_next(os, &obj, FALSE, 0)) {
1547 objerr = dmu_bonus_hold(os, obj, FTAG, &db);
1550 tx = dmu_tx_create(os);
1562 os->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
1563 txg_wait_synced(dmu_objset_pool(os), 0);
1568 dmu_objset_space(objset_t *os, uint64_t *refdbytesp, uint64_t *availbytesp,
1571 dsl_dataset_space(os->os_dsl_dataset, refdbytesp, availbytesp,
1576 dmu_objset_fsid_guid(objset_t *os)
1578 return (dsl_dataset_fsid_guid(os->os_dsl_dataset));
1582 dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *stat)
1584 stat->dds_type = os->os_phys->os_type;
1585 if (os->os_dsl_dataset)
1586 dsl_dataset_fast_stat(os->os_dsl_dataset, stat);
1590 dmu_objset_stats(objset_t *os, nvlist_t *nv)
1592 ASSERT(os->os_dsl_dataset ||
1593 os->os_phys->os_type == DMU_OST_META);
1595 if (os->os_dsl_dataset != NULL)
1596 dsl_dataset_stats(os->os_dsl_dataset, nv);
1599 os->os_phys->os_type);
1601 dmu_objset_userspace_present(os));
1605 dmu_objset_is_snapshot(objset_t *os)
1607 if (os->os_dsl_dataset != NULL)
1608 return (os->os_dsl_dataset->ds_is_snapshot);
1614 dmu_snapshot_realname(objset_t *os, char *name, char *real, int maxlen,
1617 dsl_dataset_t *ds = os->os_dsl_dataset;
1629 dmu_snapshot_list_next(objset_t *os, int namelen, char *name,
1632 dsl_dataset_t *ds = os->os_dsl_dataset;
1636 ASSERT(dsl_pool_config_held(dmu_objset_pool(os)));
1668 dmu_dir_list_next(objset_t *os, int namelen, char *name,
1671 dsl_dir_t *dd = os->os_dsl_dataset->ds_dir;
1676 if (os->os_dsl_dataset->ds_object !=
2077 dmu_objset_set_user(objset_t *os, void *user_ptr)
2079 ASSERT(MUTEX_HELD(&os->os_user_ptr_lock));
2080 os->os_user_ptr = user_ptr;
2084 dmu_objset_get_user(objset_t *os)
2086 ASSERT(MUTEX_HELD(&os->os_user_ptr_lock));
2087 return (os->os_user_ptr);