aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dmu_send.c
diff options
context:
space:
mode:
authorJustin T. Gibbs <[email protected]>2015-04-02 02:14:34 +1100
committerBrian Behlendorf <[email protected]>2015-04-28 16:25:20 -0700
commitd683ddbb7272a179da3918cc4f922d92a2195ba2 (patch)
tree82e1d7a9e0a269de978e2d3d07fa785db63961f7 /module/zfs/dmu_send.c
parent945dd93525d6e33f822beb44e3a3076c8bc89f86 (diff)
Illumos 5314 - Remove "dbuf phys" db->db_data pointer aliases in ZFS
5314 Remove "dbuf phys" db->db_data pointer aliases in ZFS Author: Justin T. Gibbs <[email protected]> Reviewed by: Andriy Gapon <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Will Andrews <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5314 https://github.com/illumos/illumos-gate/commit/c137962 Ported-by: Chris Dunlop <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module/zfs/dmu_send.c')
-rw-r--r--module/zfs/dmu_send.c86
1 files changed, 48 insertions, 38 deletions
diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c
index 1ce17a2fa..36d811138 100644
--- a/module/zfs/dmu_send.c
+++ b/module/zfs/dmu_send.c
@@ -602,12 +602,12 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds,
featureflags);
drr->drr_u.drr_begin.drr_creation_time =
- ds->ds_phys->ds_creation_time;
+ dsl_dataset_phys(ds)->ds_creation_time;
drr->drr_u.drr_begin.drr_type = dmu_objset_type(os);
if (is_clone)
drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CLONE;
- drr->drr_u.drr_begin.drr_toguid = ds->ds_phys->ds_guid;
- if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET)
+ drr->drr_u.drr_begin.drr_toguid = dsl_dataset_phys(ds)->ds_guid;
+ if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET)
drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CI_DATA;
if (fromzb != NULL) {
@@ -628,7 +628,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds,
dsp->dsa_proc = curproc;
dsp->dsa_os = os;
dsp->dsa_off = off;
- dsp->dsa_toguid = ds->ds_phys->ds_guid;
+ dsp->dsa_toguid = dsl_dataset_phys(ds)->ds_guid;
ZIO_SET_CHECKSUM(&dsp->dsa_zc, 0, 0, 0, 0);
dsp->dsa_pending_op = PENDING_NONE;
dsp->dsa_incremental = (fromzb != NULL);
@@ -713,9 +713,10 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
}
if (!dsl_dataset_is_before(ds, fromds, 0))
err = SET_ERROR(EXDEV);
- zb.zbm_creation_time = fromds->ds_phys->ds_creation_time;
- zb.zbm_creation_txg = fromds->ds_phys->ds_creation_txg;
- zb.zbm_guid = fromds->ds_phys->ds_guid;
+ zb.zbm_creation_time =
+ dsl_dataset_phys(fromds)->ds_creation_time;
+ zb.zbm_creation_txg = dsl_dataset_phys(fromds)->ds_creation_txg;
+ zb.zbm_guid = dsl_dataset_phys(fromds)->ds_guid;
is_clone = (fromds->ds_dir != ds->ds_dir);
dsl_dataset_rele(fromds, FTAG);
err = dmu_send_impl(FTAG, dp, ds, &zb, is_clone, embedok,
@@ -781,10 +782,10 @@ dmu_send(const char *tosnap, const char *fromsnap, boolean_t embedok,
if (!dsl_dataset_is_before(ds, fromds, 0))
err = SET_ERROR(EXDEV);
zb.zbm_creation_time =
- fromds->ds_phys->ds_creation_time;
+ dsl_dataset_phys(fromds)->ds_creation_time;
zb.zbm_creation_txg =
- fromds->ds_phys->ds_creation_txg;
- zb.zbm_guid = fromds->ds_phys->ds_guid;
+ dsl_dataset_phys(fromds)->ds_creation_txg;
+ zb.zbm_guid = dsl_dataset_phys(fromds)->ds_guid;
is_clone = (ds->ds_dir != fromds->ds_dir);
dsl_dataset_rele(fromds, FTAG);
}
@@ -831,7 +832,7 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl_dataset_t *fromds, uint64_t *sizep)
/* Get uncompressed size estimate of changed data. */
if (fromds == NULL) {
- size = ds->ds_phys->ds_uncompressed_bytes;
+ size = dsl_dataset_phys(ds)->ds_uncompressed_bytes;
} else {
uint64_t used, comp;
err = dsl_dataset_space_written(fromds, ds,
@@ -885,15 +886,15 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
/* temporary clone name must not exist */
error = zap_lookup(dp->dp_meta_objset,
- ds->ds_dir->dd_phys->dd_child_dir_zapobj, recv_clone_name,
+ dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, recv_clone_name,
8, 1, &val);
if (error != ENOENT)
return (error == 0 ? EBUSY : error);
/* new snapshot name must not exist */
error = zap_lookup(dp->dp_meta_objset,
- ds->ds_phys->ds_snapnames_zapobj, drba->drba_cookie->drc_tosnap,
- 8, 1, &val);
+ dsl_dataset_phys(ds)->ds_snapnames_zapobj,
+ drba->drba_cookie->drc_tosnap, 8, 1, &val);
if (error != ENOENT)
return (error == 0 ? EEXIST : error);
@@ -913,7 +914,7 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
if (fromguid != 0) {
dsl_dataset_t *snap;
- uint64_t obj = ds->ds_phys->ds_prev_snap_obj;
+ uint64_t obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
/* Find snapshot in this dir that matches fromguid. */
while (obj != 0) {
@@ -925,9 +926,9 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
dsl_dataset_rele(snap, FTAG);
return (SET_ERROR(ENODEV));
}
- if (snap->ds_phys->ds_guid == fromguid)
+ if (dsl_dataset_phys(snap)->ds_guid == fromguid)
break;
- obj = snap->ds_phys->ds_prev_snap_obj;
+ obj = dsl_dataset_phys(snap)->ds_prev_snap_obj;
dsl_dataset_rele(snap, FTAG);
}
if (obj == 0)
@@ -950,9 +951,9 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
dsl_dataset_rele(snap, FTAG);
} else {
/* if full, most recent snapshot must be $ORIGIN */
- if (ds->ds_phys->ds_prev_snap_txg >= TXG_INITIAL)
+ if (dsl_dataset_phys(ds)->ds_prev_snap_txg >= TXG_INITIAL)
return (SET_ERROR(ENODEV));
- drba->drba_snapobj = ds->ds_phys->ds_prev_snap_obj;
+ drba->drba_snapobj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
}
return (0);
@@ -1061,7 +1062,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx)
dsl_dataset_rele(ds, FTAG);
return (SET_ERROR(EINVAL));
}
- if (origin->ds_phys->ds_guid != fromguid) {
+ if (dsl_dataset_phys(origin)->ds_guid != fromguid) {
dsl_dataset_rele(origin, FTAG);
dsl_dataset_rele(ds, FTAG);
return (SET_ERROR(ENODEV));
@@ -1125,7 +1126,7 @@ dmu_recv_begin_sync(void *arg, dmu_tx_t *tx)
VERIFY0(dsl_dataset_own_obj(dp, dsobj, dmu_recv_tag, &newds));
dmu_buf_will_dirty(newds->ds_dbuf, tx);
- newds->ds_phys->ds_flags |= DS_FLAG_INCONSISTENT;
+ dsl_dataset_phys(newds)->ds_flags |= DS_FLAG_INCONSISTENT;
/*
* If we actually created a non-clone, we need to create the
@@ -1764,7 +1765,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp,
*/
VERIFY0(dmu_objset_from_ds(drc->drc_ds, &os));
- ASSERT(drc->drc_ds->ds_phys->ds_flags & DS_FLAG_INCONSISTENT);
+ ASSERT(dsl_dataset_phys(drc->drc_ds)->ds_flags & DS_FLAG_INCONSISTENT);
featureflags = DMU_GET_FEATUREFLAGS(drc->drc_drrb->drr_versioninfo);
@@ -1927,8 +1928,11 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx)
* the snap before drc_ds, because drc_ds can not
* have any snaps of its own).
*/
- uint64_t obj = origin_head->ds_phys->ds_prev_snap_obj;
- while (obj != drc->drc_ds->ds_phys->ds_prev_snap_obj) {
+ uint64_t obj;
+
+ obj = dsl_dataset_phys(origin_head)->ds_prev_snap_obj;
+ while (obj !=
+ dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj) {
dsl_dataset_t *snap;
error = dsl_dataset_hold_obj(dp, obj, FTAG,
&snap);
@@ -1940,7 +1944,7 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx)
error = dsl_destroy_snapshot_check_impl(
snap, B_FALSE);
}
- obj = snap->ds_phys->ds_prev_snap_obj;
+ obj = dsl_dataset_phys(snap)->ds_prev_snap_obj;
dsl_dataset_rele(snap, FTAG);
if (error != 0)
return (error);
@@ -1986,13 +1990,16 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
* Destroy any snapshots of drc_tofs (origin_head)
* after the origin (the snap before drc_ds).
*/
- uint64_t obj = origin_head->ds_phys->ds_prev_snap_obj;
- while (obj != drc->drc_ds->ds_phys->ds_prev_snap_obj) {
+ uint64_t obj;
+
+ obj = dsl_dataset_phys(origin_head)->ds_prev_snap_obj;
+ while (obj !=
+ dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj) {
dsl_dataset_t *snap;
VERIFY0(dsl_dataset_hold_obj(dp, obj, FTAG,
&snap));
ASSERT3P(snap->ds_dir, ==, origin_head->ds_dir);
- obj = snap->ds_phys->ds_prev_snap_obj;
+ obj = dsl_dataset_phys(snap)->ds_prev_snap_obj;
dsl_destroy_snapshot_sync_impl(snap,
B_FALSE, tx);
dsl_dataset_rele(snap, FTAG);
@@ -2008,15 +2015,16 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
/* set snapshot's creation time and guid */
dmu_buf_will_dirty(origin_head->ds_prev->ds_dbuf, tx);
- origin_head->ds_prev->ds_phys->ds_creation_time =
+ dsl_dataset_phys(origin_head->ds_prev)->ds_creation_time =
drc->drc_drrb->drr_creation_time;
- origin_head->ds_prev->ds_phys->ds_guid =
+ dsl_dataset_phys(origin_head->ds_prev)->ds_guid =
drc->drc_drrb->drr_toguid;
- origin_head->ds_prev->ds_phys->ds_flags &=
+ dsl_dataset_phys(origin_head->ds_prev)->ds_flags &=
~DS_FLAG_INCONSISTENT;
dmu_buf_will_dirty(origin_head->ds_dbuf, tx);
- origin_head->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT;
+ dsl_dataset_phys(origin_head)->ds_flags &=
+ ~DS_FLAG_INCONSISTENT;
dsl_dataset_rele(origin_head, FTAG);
dsl_destroy_head_sync_impl(drc->drc_ds, tx);
@@ -2030,15 +2038,17 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
/* set snapshot's creation time and guid */
dmu_buf_will_dirty(ds->ds_prev->ds_dbuf, tx);
- ds->ds_prev->ds_phys->ds_creation_time =
+ dsl_dataset_phys(ds->ds_prev)->ds_creation_time =
drc->drc_drrb->drr_creation_time;
- ds->ds_prev->ds_phys->ds_guid = drc->drc_drrb->drr_toguid;
- ds->ds_prev->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT;
+ dsl_dataset_phys(ds->ds_prev)->ds_guid =
+ drc->drc_drrb->drr_toguid;
+ dsl_dataset_phys(ds->ds_prev)->ds_flags &=
+ ~DS_FLAG_INCONSISTENT;
dmu_buf_will_dirty(ds->ds_dbuf, tx);
- ds->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT;
+ dsl_dataset_phys(ds)->ds_flags &= ~DS_FLAG_INCONSISTENT;
}
- drc->drc_newsnapobj = drc->drc_ds->ds_phys->ds_prev_snap_obj;
+ drc->drc_newsnapobj = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj;
/*
* Release the hold from dmu_recv_begin. This must be done before
* we return to open context, so that when we free the dataset's dnode,
@@ -2064,7 +2074,7 @@ add_ds_to_guidmap(const char *name, avl_tree_t *guid_map, uint64_t snapobj)
gmep = kmem_alloc(sizeof (*gmep), KM_SLEEP);
err = dsl_dataset_hold_obj(dp, snapobj, gmep, &snapds);
if (err == 0) {
- gmep->guid = snapds->ds_phys->ds_guid;
+ gmep->guid = dsl_dataset_phys(snapds)->ds_guid;
gmep->gme_ds = snapds;
avl_add(guid_map, gmep);
dsl_dataset_long_hold(snapds, gmep);