Lines Matching refs:os

9  * or http://www.opensolaris.org/os/licensing.
46 dmu_objset_spa(objset_t *os)
48 return (os->os_spa);
52 dmu_objset_zil(objset_t *os)
54 return (os->os_zil);
58 dmu_objset_pool(objset_t *os)
62 if ((ds = os->os_dsl_dataset) != NULL && ds->ds_dir)
65 return (spa_get_dsl(os->os_spa));
69 dmu_objset_ds(objset_t *os)
71 return (os->os_dsl_dataset);
75 dmu_objset_type(objset_t *os)
77 return (os->os_phys->os_type);
81 dmu_objset_name(objset_t *os, char *buf)
83 dsl_dataset_name(os->os_dsl_dataset, buf);
87 dmu_objset_id(objset_t *os)
89 dsl_dataset_t *ds = os->os_dsl_dataset;
95 dmu_objset_logbias(objset_t *os)
97 return (os->os_logbias);
103 objset_t *os = arg;
110 os->os_checksum = zio_checksum_select(newval, ZIO_CHECKSUM_ON_VALUE);
116 objset_t *os = arg;
123 os->os_compress = zio_compress_select(newval, ZIO_COMPRESS_ON_VALUE);
129 objset_t *os = arg;
135 ASSERT(newval <= spa_max_replication(os->os_spa));
137 os->os_copies = newval;
143 objset_t *os = arg;
144 spa_t *spa = os->os_spa;
154 os->os_dedup_checksum = checksum & ZIO_CHECKSUM_MASK;
155 os->os_dedup_verify = !!(checksum & ZIO_CHECKSUM_VERIFY);
161 objset_t *os = arg;
169 os->os_primary_cache = newval;
175 objset_t *os = arg;
183 os->os_secondary_cache = newval;
189 objset_t *os = arg;
193 os->os_logbias = newval;
194 if (os->os_zil)
195 zil_set_logbias(os->os_zil, newval);
218 objset_t *os;
223 os = kmem_zalloc(sizeof (objset_t), KM_SLEEP);
224 os->os_dsl_dataset = ds;
225 os->os_spa = spa;
226 os->os_rootbp = bp;
227 if (!BP_IS_HOLE(os->os_rootbp)) {
233 if (DMU_OS_IS_L2CACHEABLE(os))
236 dprintf_bp(os->os_rootbp, "reading %s", "");
242 err = arc_read_nolock(NULL, spa, os->os_rootbp,
243 arc_getbuf_func, &os->os_phys_buf,
246 kmem_free(os, sizeof (objset_t));
255 arc_buf_size(os->os_phys_buf) < sizeof (objset_phys_t)) {
257 sizeof (objset_phys_t), &os->os_phys_buf,
260 bcopy(os->os_phys_buf->b_data, buf->b_data,
261 arc_buf_size(os->os_phys_buf));
262 (void) arc_buf_remove_ref(os->os_phys_buf,
263 &os->os_phys_buf);
264 os->os_phys_buf = buf;
267 os->os_phys = os->os_phys_buf->b_data;
268 os->os_flags = os->os_phys->os_flags;
272 os->os_phys_buf = arc_buf_alloc(spa, size,
273 &os->os_phys_buf, ARC_BUFC_METADATA);
274 os->os_phys = os->os_phys_buf->b_data;
275 bzero(os->os_phys, size);
286 primary_cache_changed_cb, os);
289 secondary_cache_changed_cb, os);
293 checksum_changed_cb, os);
296 compression_changed_cb, os);
299 copies_changed_cb, os);
302 dedup_changed_cb, os);
305 logbias_changed_cb, os);
308 VERIFY(arc_buf_remove_ref(os->os_phys_buf,
309 &os->os_phys_buf) == 1);
310 kmem_free(os, sizeof (objset_t));
315 os->os_checksum = ZIO_CHECKSUM_FLETCHER_4;
316 os->os_compress = ZIO_COMPRESS_LZJB;
317 os->os_copies = spa_max_replication(spa);
318 os->os_dedup_checksum = ZIO_CHECKSUM_OFF;
319 os->os_dedup_verify = 0;
320 os->os_logbias = 0;
321 os->os_primary_cache = ZFS_CACHE_ALL;
322 os->os_secondary_cache = ZFS_CACHE_ALL;
325 os->os_zil_header = os->os_phys->os_zil_header;
326 os->os_zil = zil_alloc(os, &os->os_zil_header);
329 list_create(&os->os_dirty_dnodes[i], sizeof (dnode_t),
331 list_create(&os->os_free_dnodes[i], sizeof (dnode_t),
334 list_create(&os->os_dnodes, sizeof (dnode_t),
336 list_create(&os->os_downgraded_dbufs, sizeof (dmu_buf_impl_t),
339 mutex_init(&os->os_lock, NULL, MUTEX_DEFAULT, NULL);
340 mutex_init(&os->os_obj_lock, NULL, MUTEX_DEFAULT, NULL);
341 mutex_init(&os->os_user_ptr_lock, NULL, MUTEX_DEFAULT, NULL);
343 os->os_meta_dnode = dnode_special_open(os,
344 &os->os_phys->os_meta_dnode, DMU_META_DNODE_OBJECT);
345 if (arc_buf_size(os->os_phys_buf) >= sizeof (objset_phys_t)) {
346 os->os_userused_dnode = dnode_special_open(os,
347 &os->os_phys->os_userused_dnode, DMU_USERUSED_OBJECT);
348 os->os_groupused_dnode = dnode_special_open(os,
349 &os->os_phys->os_groupused_dnode, DMU_GROUPUSED_OBJECT);
359 ds->ds_objset = os;
363 *osp = os;
426 dmu_objset_rele(objset_t *os, void *tag)
428 dsl_dataset_rele(os->os_dsl_dataset, tag);
432 dmu_objset_disown(objset_t *os, void *tag)
434 dsl_dataset_disown(os->os_dsl_dataset, tag);
438 dmu_objset_evict_dbufs(objset_t *os)
442 mutex_enter(&os->os_lock);
445 list_remove(&os->os_dnodes, os->os_meta_dnode);
446 list_insert_tail(&os->os_dnodes, os->os_meta_dnode);
454 for (dn = list_head(&os->os_dnodes);
456 dn = list_next(&os->os_dnodes, dn))
463 next_dn = list_next(&os->os_dnodes, next_dn);
466 mutex_exit(&os->os_lock);
469 mutex_enter(&os->os_lock);
472 mutex_exit(&os->os_lock);
473 return (list_head(&os->os_dnodes) != os->os_meta_dnode);
477 dmu_objset_evict(objset_t *os)
479 dsl_dataset_t *ds = os->os_dsl_dataset;
482 ASSERT(!dmu_objset_is_dirty(os, t));
487 checksum_changed_cb, os));
489 compression_changed_cb, os));
491 copies_changed_cb, os));
493 dedup_changed_cb, os));
495 logbias_changed_cb, os));
498 primary_cache_changed_cb, os));
500 secondary_cache_changed_cb, os));
507 (void) dmu_objset_evict_dbufs(os);
509 dnode_special_close(os->os_meta_dnode);
510 if (os->os_userused_dnode) {
511 dnode_special_close(os->os_userused_dnode);
512 dnode_special_close(os->os_groupused_dnode);
514 zil_free(os->os_zil);
516 ASSERT3P(list_head(&os->os_dnodes), ==, NULL);
518 VERIFY(arc_buf_remove_ref(os->os_phys_buf, &os->os_phys_buf) == 1);
519 mutex_destroy(&os->os_lock);
520 mutex_destroy(&os->os_obj_lock);
521 mutex_destroy(&os->os_user_ptr_lock);
522 kmem_free(os, sizeof (objset_t));
526 dmu_objset_snap_cmtime(objset_t *os)
528 return (dsl_dir_snap_cmtime(os->os_dsl_dataset->ds_dir));
536 objset_t *os;
542 VERIFY(0 == dmu_objset_open_impl(spa, ds, bp, &os));
545 mdn = os->os_meta_dnode;
580 os->os_phys->os_type = type;
581 if (dmu_objset_userused_enabled(os)) {
582 os->os_phys->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
583 os->os_flags = os->os_phys->os_flags;
588 return (os);
592 void (*userfunc)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx);
643 objset_t *os;
650 os = dmu_objset_create_impl(dsl_dataset_get_spa(ds),
654 oa->userfunc(os, oa->userarg, cr, tx);
664 void (*func)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx), void *arg)
734 objset_t *os;
735 if (dmu_objset_from_ds(ds, &os) == 0)
736 zil_destroy(dmu_objset_zil(os), B_FALSE);
755 objset_t *os = arg1;
760 return (dsl_dataset_snapshot_check(os->os_dsl_dataset,
767 objset_t *os = arg1;
768 dsl_dataset_t *ds = os->os_dsl_dataset;
785 objset_t *os;
809 err = dmu_objset_hold(name, sn, &os);
819 if (os->os_dsl_dataset->ds_phys->ds_flags & DS_FLAG_INCONSISTENT) {
820 dmu_objset_rele(os, sn);
829 err = zil_suspend(dmu_objset_zil(os));
832 snapshot_sync, os, sn, 3);
834 dmu_objset_rele(os, sn);
872 objset_t *os = dst->dst_arg1;
873 dsl_dataset_t *ds = os->os_dsl_dataset;
876 zil_resume(dmu_objset_zil(os));
877 dmu_objset_rele(os, &sn);
919 objset_t *os = arg;
920 dnode_phys_t *dnp = &os->os_phys->os_meta_dnode;
922 ASSERT(bp == os->os_rootbp);
943 objset_t *os = arg;
948 dsl_dataset_t *ds = os->os_dsl_dataset;
949 dmu_tx_t *tx = os->os_synctx;
958 dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
968 dprintf_ds(os->os_dsl_dataset, "txg=%llu\n", tx->tx_txg);
972 os->os_synctx = tx;
974 if (os->os_dsl_dataset == NULL) {
980 os->os_copies = spa_max_replication(os->os_spa);
986 arc_release(os->os_phys_buf, &os->os_phys_buf);
988 SET_BOOKMARK(&zb, os->os_dsl_dataset ?
989 os->os_dsl_dataset->ds_object : DMU_META_OBJSET,
992 dmu_write_policy(os, NULL, 0, 0, &zp);
994 zio = arc_write(pio, os->os_spa, tx->tx_txg,
995 os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), &zp,
996 dmu_objset_write_ready, dmu_objset_write_done, os,
1002 os->os_meta_dnode->dn_zio = zio;
1003 dnode_sync(os->os_meta_dnode, tx);
1005 os->os_phys->os_flags = os->os_flags;
1007 if (os->os_userused_dnode &&
1008 os->os_userused_dnode->dn_type != DMU_OT_NONE) {
1009 os->os_userused_dnode->dn_zio = zio;
1010 dnode_sync(os->os_userused_dnode, tx);
1011 os->os_groupused_dnode->dn_zio = zio;
1012 dnode_sync(os->os_groupused_dnode, tx);
1017 if (dmu_objset_userused_enabled(os)) {
1018 newlist = &os->os_synced_dnodes;
1027 dmu_objset_sync_dnodes(&os->os_free_dnodes[txgoff], newlist, tx);
1028 dmu_objset_sync_dnodes(&os->os_dirty_dnodes[txgoff], newlist, tx);
1030 list = &os->os_meta_dnode->dn_dirty_records[txgoff];
1040 zil_sync(os->os_zil, tx);
1041 os->os_phys->os_zil_header = os->os_zil_header;
1046 dmu_objset_is_dirty(objset_t *os, uint64_t txg)
1048 return (!list_is_empty(&os->os_dirty_dnodes[txg & TXG_MASK]) ||
1049 !list_is_empty(&os->os_free_dnodes[txg & TXG_MASK]));
1061 dmu_objset_userused_enabled(objset_t *os)
1063 return (spa_version(os->os_spa) >= SPA_VERSION_USERSPACE &&
1064 used_cbs[os->os_phys->os_type] &&
1065 os->os_userused_dnode);
1069 do_userquota_callback(objset_t *os, dnode_phys_t *dnp,
1080 0 == used_cbs[os->os_phys->os_type](dnp->dn_bonustype,
1085 VERIFY3U(0, ==, zap_increment_int(os, DMU_USERUSED_OBJECT,
1087 VERIFY3U(0, ==, zap_increment_int(os, DMU_GROUPUSED_OBJECT,
1093 dmu_objset_do_userquota_callbacks(objset_t *os, dmu_tx_t *tx)
1096 list_t *list = &os->os_synced_dnodes;
1098 ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os));
1108 if (os->os_userused_dnode->dn_type == DMU_OT_NONE) {
1109 VERIFY(0 == zap_create_claim(os,
1112 VERIFY(0 == zap_create_claim(os,
1124 do_userquota_callback(os, dn->dn_oldphys, B_TRUE, tx);
1125 do_userquota_callback(os, dn->dn_phys, B_FALSE, tx);
1141 dmu_objset_userspace_present(objset_t *os)
1143 return (os->os_phys->os_flags &
1148 dmu_objset_userspace_upgrade(objset_t *os)
1153 if (dmu_objset_userspace_present(os))
1155 if (!dmu_objset_userused_enabled(os))
1157 if (dmu_objset_is_snapshot(os))
1168 for (obj = 0; err == 0; err = dmu_object_next(os, &obj, FALSE, 0)) {
1176 objerr = dmu_bonus_hold(os, obj, FTAG, &db);
1179 tx = dmu_tx_create(os);
1191 os->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
1192 txg_wait_synced(dmu_objset_pool(os), 0);
1197 dmu_objset_space(objset_t *os, uint64_t *refdbytesp, uint64_t *availbytesp,
1200 dsl_dataset_space(os->os_dsl_dataset, refdbytesp, availbytesp,
1205 dmu_objset_fsid_guid(objset_t *os)
1207 return (dsl_dataset_fsid_guid(os->os_dsl_dataset));
1211 dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *stat)
1213 stat->dds_type = os->os_phys->os_type;
1214 if (os->os_dsl_dataset)
1215 dsl_dataset_fast_stat(os->os_dsl_dataset, stat);
1219 dmu_objset_stats(objset_t *os, nvlist_t *nv)
1221 ASSERT(os->os_dsl_dataset ||
1222 os->os_phys->os_type == DMU_OST_META);
1224 if (os->os_dsl_dataset != NULL)
1225 dsl_dataset_stats(os->os_dsl_dataset, nv);
1228 os->os_phys->os_type);
1230 dmu_objset_userspace_present(os));
1234 dmu_objset_is_snapshot(objset_t *os)
1236 if (os->os_dsl_dataset != NULL)
1237 return (dsl_dataset_is_snapshot(os->os_dsl_dataset));
1243 dmu_snapshot_realname(objset_t *os, char *name, char *real, int maxlen,
1246 dsl_dataset_t *ds = os->os_dsl_dataset;
1258 dmu_snapshot_list_next(objset_t *os, int namelen, char *name,
1261 dsl_dataset_t *ds = os->os_dsl_dataset;
1295 dmu_dir_list_next(objset_t *os, int namelen, char *name,
1298 dsl_dir_t *dd = os->os_dsl_dataset->ds_dir;
1303 if (os->os_dsl_dataset->ds_object !=
1494 dmu_objset_set_user(objset_t *os, void *user_ptr)
1496 ASSERT(MUTEX_HELD(&os->os_user_ptr_lock));
1497 os->os_user_ptr = user_ptr;
1501 dmu_objset_get_user(objset_t *os)
1503 ASSERT(MUTEX_HELD(&os->os_user_ptr_lock));
1504 return (os->os_user_ptr);