dmu_objset.c (5147:5e950ccc9585) dmu_objset.c (5326:6752aa2bd5bc)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 30 unchanged lines hidden (view full) ---

39#include <sys/zvol.h>
40#include <sys/dmu_tx.h>
41#include <sys/zio_checksum.h>
42#include <sys/zap.h>
43#include <sys/zil.h>
44#include <sys/dmu_impl.h>
45#include <sys/zfs_ioctl.h>
46
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 30 unchanged lines hidden (view full) ---

39#include <sys/zvol.h>
40#include <sys/dmu_tx.h>
41#include <sys/zio_checksum.h>
42#include <sys/zap.h>
43#include <sys/zil.h>
44#include <sys/dmu_impl.h>
45#include <sys/zfs_ioctl.h>
46
47
48spa_t *
49dmu_objset_spa(objset_t *os)
50{
51 return (os->os->os_spa);
52}
53
54zilog_t *
55dmu_objset_zil(objset_t *os)

--- 183 unchanged lines hidden (view full) ---

239 }
240 list_create(&osi->os_dnodes, sizeof (dnode_t),
241 offsetof(dnode_t, dn_link));
242 list_create(&osi->os_downgraded_dbufs, sizeof (dmu_buf_impl_t),
243 offsetof(dmu_buf_impl_t, db_link));
244
245 mutex_init(&osi->os_lock, NULL, MUTEX_DEFAULT, NULL);
246 mutex_init(&osi->os_obj_lock, NULL, MUTEX_DEFAULT, NULL);
47spa_t *
48dmu_objset_spa(objset_t *os)
49{
50 return (os->os->os_spa);
51}
52
53zilog_t *
54dmu_objset_zil(objset_t *os)

--- 183 unchanged lines hidden (view full) ---

238 }
239 list_create(&osi->os_dnodes, sizeof (dnode_t),
240 offsetof(dnode_t, dn_link));
241 list_create(&osi->os_downgraded_dbufs, sizeof (dmu_buf_impl_t),
242 offsetof(dmu_buf_impl_t, db_link));
243
244 mutex_init(&osi->os_lock, NULL, MUTEX_DEFAULT, NULL);
245 mutex_init(&osi->os_obj_lock, NULL, MUTEX_DEFAULT, NULL);
246 mutex_init(&osi->os_user_ptr_lock, NULL, MUTEX_DEFAULT, NULL);
247
248 osi->os_meta_dnode = dnode_special_open(osi,
249 &osi->os_phys->os_meta_dnode, DMU_META_DNODE_OBJECT);
250
251 /*
252 * We should be the only thread trying to do this because we
253 * have ds_opening_lock
254 */

--- 6 unchanged lines hidden (view full) ---

261 return (0);
262}
263
264/* called from zpl */
265int
266dmu_objset_open(const char *name, dmu_objset_type_t type, int mode,
267 objset_t **osp)
268{
247
248 osi->os_meta_dnode = dnode_special_open(osi,
249 &osi->os_phys->os_meta_dnode, DMU_META_DNODE_OBJECT);
250
251 /*
252 * We should be the only thread trying to do this because we
253 * have ds_opening_lock
254 */

--- 6 unchanged lines hidden (view full) ---

261 return (0);
262}
263
264/* called from zpl */
265int
266dmu_objset_open(const char *name, dmu_objset_type_t type, int mode,
267 objset_t **osp)
268{
269 dsl_dataset_t *ds;
270 int err;
271 objset_t *os;
269 objset_t *os;
270 dsl_dataset_t *ds;
272 objset_impl_t *osi;
271 objset_impl_t *osi;
272 int err;
273
274 os = kmem_alloc(sizeof (objset_t), KM_SLEEP);
275 err = dsl_dataset_open(name, mode, os, &ds);
276 if (err) {
277 kmem_free(os, sizeof (objset_t));
278 return (err);
279 }
280

--- 101 unchanged lines hidden (view full) ---

382 ASSERT3P(list_head(&osi->os_meta_dnode->dn_dbufs), ==, NULL);
383
384 dnode_special_close(osi->os_meta_dnode);
385 zil_free(osi->os_zil);
386
387 VERIFY(arc_buf_remove_ref(osi->os_phys_buf, &osi->os_phys_buf) == 1);
388 mutex_destroy(&osi->os_lock);
389 mutex_destroy(&osi->os_obj_lock);
273
274 os = kmem_alloc(sizeof (objset_t), KM_SLEEP);
275 err = dsl_dataset_open(name, mode, os, &ds);
276 if (err) {
277 kmem_free(os, sizeof (objset_t));
278 return (err);
279 }
280

--- 101 unchanged lines hidden (view full) ---

382 ASSERT3P(list_head(&osi->os_meta_dnode->dn_dbufs), ==, NULL);
383
384 dnode_special_close(osi->os_meta_dnode);
385 zil_free(osi->os_zil);
386
387 VERIFY(arc_buf_remove_ref(osi->os_phys_buf, &osi->os_phys_buf) == 1);
388 mutex_destroy(&osi->os_lock);
389 mutex_destroy(&osi->os_obj_lock);
390 mutex_destroy(&osi->os_user_ptr_lock);
390 kmem_free(osi, sizeof (objset_impl_t));
391}
392
393/* called from dsl for meta-objset */
394objset_impl_t *
395dmu_objset_create_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
396 dmu_objset_type_t type, dmu_tx_t *tx)
397{

--- 646 unchanged lines hidden (view full) ---

1044
1045 /*
1046 * Apply to self if appropriate.
1047 */
1048 if (do_self)
1049 err = func(name, arg);
1050 return (err);
1051}
391 kmem_free(osi, sizeof (objset_impl_t));
392}
393
394/* called from dsl for meta-objset */
395objset_impl_t *
396dmu_objset_create_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
397 dmu_objset_type_t type, dmu_tx_t *tx)
398{

--- 646 unchanged lines hidden (view full) ---

1045
1046 /*
1047 * Apply to self if appropriate.
1048 */
1049 if (do_self)
1050 err = func(name, arg);
1051 return (err);
1052}
1053
1054void
1055dmu_objset_set_user(objset_t *os, void *user_ptr)
1056{
1057 ASSERT(MUTEX_HELD(&os->os->os_user_ptr_lock));
1058 os->os->os_user_ptr = user_ptr;
1059}
1060
1061void *
1062dmu_objset_get_user(objset_t *os)
1063{
1064 ASSERT(MUTEX_HELD(&os->os->os_user_ptr_lock));
1065 return (os->os->os_user_ptr);
1066}