summaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_pool.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/dsl_pool.c')
-rw-r--r--module/zfs/dsl_pool.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c
index b54c03bc3..96a599780 100644
--- a/module/zfs/dsl_pool.c
+++ b/module/zfs/dsl_pool.c
@@ -137,7 +137,7 @@ dsl_pool_open_special_dir(dsl_pool_t *dp, const char *name, dsl_dir_t **ddp)
int err;
err = zap_lookup(dp->dp_meta_objset,
- dp->dp_root_dir->dd_phys->dd_child_dir_zapobj,
+ dsl_dir_phys(dp->dp_root_dir)->dd_child_dir_zapobj,
name, sizeof (obj), 1, &obj);
if (err)
return (err);
@@ -219,11 +219,11 @@ dsl_pool_open(dsl_pool_t *dp)
err = dsl_pool_open_special_dir(dp, ORIGIN_DIR_NAME, &dd);
if (err)
goto out;
- err = dsl_dataset_hold_obj(dp, dd->dd_phys->dd_head_dataset_obj,
- FTAG, &ds);
+ err = dsl_dataset_hold_obj(dp,
+ dsl_dir_phys(dd)->dd_head_dataset_obj, FTAG, &ds);
if (err == 0) {
err = dsl_dataset_hold_obj(dp,
- ds->ds_phys->ds_prev_snap_obj, dp,
+ dsl_dataset_phys(ds)->ds_prev_snap_obj, dp,
&dp->dp_origin_snap);
dsl_dataset_rele(ds, FTAG);
}
@@ -683,15 +683,15 @@ upgrade_clones_cb(dsl_pool_t *dp, dsl_dataset_t *hds, void *arg)
if (err)
return (err);
- while (ds->ds_phys->ds_prev_snap_obj != 0) {
- err = dsl_dataset_hold_obj(dp, ds->ds_phys->ds_prev_snap_obj,
- FTAG, &prev);
+ while (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) {
+ err = dsl_dataset_hold_obj(dp,
+ dsl_dataset_phys(ds)->ds_prev_snap_obj, FTAG, &prev);
if (err) {
dsl_dataset_rele(ds, FTAG);
return (err);
}
- if (prev->ds_phys->ds_next_snap_obj != ds->ds_object)
+ if (dsl_dataset_phys(prev)->ds_next_snap_obj != ds->ds_object)
break;
dsl_dataset_rele(ds, FTAG);
ds = prev;
@@ -705,7 +705,7 @@ upgrade_clones_cb(dsl_pool_t *dp, dsl_dataset_t *hds, void *arg)
* The $ORIGIN can't have any data, or the accounting
* will be wrong.
*/
- ASSERT0(prev->ds_phys->ds_bp.blk_birth);
+ ASSERT0(dsl_dataset_phys(prev)->ds_bp.blk_birth);
/* The origin doesn't get attached to itself */
if (ds->ds_object == prev->ds_object) {
@@ -714,33 +714,35 @@ upgrade_clones_cb(dsl_pool_t *dp, dsl_dataset_t *hds, void *arg)
}
dmu_buf_will_dirty(ds->ds_dbuf, tx);
- ds->ds_phys->ds_prev_snap_obj = prev->ds_object;
- ds->ds_phys->ds_prev_snap_txg = prev->ds_phys->ds_creation_txg;
+ dsl_dataset_phys(ds)->ds_prev_snap_obj = prev->ds_object;
+ dsl_dataset_phys(ds)->ds_prev_snap_txg =
+ dsl_dataset_phys(prev)->ds_creation_txg;
dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx);
- ds->ds_dir->dd_phys->dd_origin_obj = prev->ds_object;
+ dsl_dir_phys(ds->ds_dir)->dd_origin_obj = prev->ds_object;
dmu_buf_will_dirty(prev->ds_dbuf, tx);
- prev->ds_phys->ds_num_children++;
+ dsl_dataset_phys(prev)->ds_num_children++;
- if (ds->ds_phys->ds_next_snap_obj == 0) {
+ if (dsl_dataset_phys(ds)->ds_next_snap_obj == 0) {
ASSERT(ds->ds_prev == NULL);
VERIFY0(dsl_dataset_hold_obj(dp,
- ds->ds_phys->ds_prev_snap_obj, ds, &ds->ds_prev));
+ dsl_dataset_phys(ds)->ds_prev_snap_obj,
+ ds, &ds->ds_prev));
}
}
- ASSERT3U(ds->ds_dir->dd_phys->dd_origin_obj, ==, prev->ds_object);
- ASSERT3U(ds->ds_phys->ds_prev_snap_obj, ==, prev->ds_object);
+ ASSERT3U(dsl_dir_phys(ds->ds_dir)->dd_origin_obj, ==, prev->ds_object);
+ ASSERT3U(dsl_dataset_phys(ds)->ds_prev_snap_obj, ==, prev->ds_object);
- if (prev->ds_phys->ds_next_clones_obj == 0) {
+ if (dsl_dataset_phys(prev)->ds_next_clones_obj == 0) {
dmu_buf_will_dirty(prev->ds_dbuf, tx);
- prev->ds_phys->ds_next_clones_obj =
+ dsl_dataset_phys(prev)->ds_next_clones_obj =
zap_create(dp->dp_meta_objset,
DMU_OT_NEXT_CLONES, DMU_OT_NONE, 0, tx);
}
VERIFY0(zap_add_int(dp->dp_meta_objset,
- prev->ds_phys->ds_next_clones_obj, ds->ds_object, tx));
+ dsl_dataset_phys(prev)->ds_next_clones_obj, ds->ds_object, tx));
dsl_dataset_rele(ds, FTAG);
if (prev != dp->dp_origin_snap)
@@ -765,20 +767,22 @@ upgrade_dir_clones_cb(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
dmu_tx_t *tx = arg;
objset_t *mos = dp->dp_meta_objset;
- if (ds->ds_dir->dd_phys->dd_origin_obj != 0) {
+ if (dsl_dir_phys(ds->ds_dir)->dd_origin_obj != 0) {
dsl_dataset_t *origin;
VERIFY0(dsl_dataset_hold_obj(dp,
- ds->ds_dir->dd_phys->dd_origin_obj, FTAG, &origin));
+ dsl_dir_phys(ds->ds_dir)->dd_origin_obj, FTAG, &origin));
- if (origin->ds_dir->dd_phys->dd_clones == 0) {
+ if (dsl_dir_phys(origin->ds_dir)->dd_clones == 0) {
dmu_buf_will_dirty(origin->ds_dir->dd_dbuf, tx);
- origin->ds_dir->dd_phys->dd_clones = zap_create(mos,
- DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
+ dsl_dir_phys(origin->ds_dir)->dd_clones =
+ zap_create(mos, DMU_OT_DSL_CLONES, DMU_OT_NONE,
+ 0, tx);
}
VERIFY0(zap_add_int(dp->dp_meta_objset,
- origin->ds_dir->dd_phys->dd_clones, ds->ds_object, tx));
+ dsl_dir_phys(origin->ds_dir)->dd_clones,
+ ds->ds_object, tx));
dsl_dataset_rele(origin, FTAG);
}
@@ -826,7 +830,7 @@ dsl_pool_create_origin(dsl_pool_t *dp, dmu_tx_t *tx)
NULL, 0, kcred, tx);
VERIFY0(dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
dsl_dataset_snapshot_sync_impl(ds, ORIGIN_DIR_NAME, tx);
- VERIFY0(dsl_dataset_hold_obj(dp, ds->ds_phys->ds_prev_snap_obj,
+ VERIFY0(dsl_dataset_hold_obj(dp, dsl_dataset_phys(ds)->ds_prev_snap_obj,
dp, &dp->dp_origin_snap));
dsl_dataset_rele(ds, FTAG);
}