aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_dir.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/dsl_dir.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/dsl_dir.c')
-rw-r--r--module/zfs/dsl_dir.c189
1 files changed, 100 insertions, 89 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index 3e6b7a018..0a0a0fa7c 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -122,6 +122,8 @@
* such as those created by zfs diff.
*/
+extern inline dsl_dir_phys_t *dsl_dir_phys(dsl_dir_t *dd);
+
static uint64_t dsl_dir_space_towrite(dsl_dir_t *dd);
/* ARGSUSED */
@@ -181,7 +183,6 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
dd->dd_object = ddobj;
dd->dd_dbuf = dbuf;
dd->dd_pool = dp;
- dd->dd_phys = dbuf->db_data;
mutex_init(&dd->dd_lock, NULL, MUTEX_DEFAULT, NULL);
list_create(&dd->dd_prop_cbs, sizeof (dsl_prop_cb_record_t),
@@ -189,9 +190,10 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
dsl_dir_snap_cmtime_update(dd);
- if (dd->dd_phys->dd_parent_obj) {
- err = dsl_dir_hold_obj(dp, dd->dd_phys->dd_parent_obj,
- NULL, dd, &dd->dd_parent);
+ if (dsl_dir_phys(dd)->dd_parent_obj) {
+ err = dsl_dir_hold_obj(dp,
+ dsl_dir_phys(dd)->dd_parent_obj, NULL, dd,
+ &dd->dd_parent);
if (err != 0)
goto errout;
if (tail) {
@@ -199,14 +201,16 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
uint64_t foundobj;
err = zap_lookup(dp->dp_meta_objset,
- dd->dd_parent->dd_phys->dd_child_dir_zapobj,
- tail, sizeof (foundobj), 1, &foundobj);
+ dsl_dir_phys(dd->dd_parent)->
+ dd_child_dir_zapobj, tail,
+ sizeof (foundobj), 1, &foundobj);
ASSERT(err || foundobj == ddobj);
#endif
(void) strcpy(dd->dd_myname, tail);
} else {
err = zap_value_search(dp->dp_meta_objset,
- dd->dd_parent->dd_phys->dd_child_dir_zapobj,
+ dsl_dir_phys(dd->dd_parent)->
+ dd_child_dir_zapobj,
ddobj, 0, dd->dd_myname);
}
if (err != 0)
@@ -225,7 +229,8 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
* Just look at its phys directly instead.
*/
err = dmu_bonus_hold(dp->dp_meta_objset,
- dd->dd_phys->dd_origin_obj, FTAG, &origin_bonus);
+ dsl_dir_phys(dd)->dd_origin_obj, FTAG,
+ &origin_bonus);
if (err != 0)
goto errout;
origin_phys = origin_bonus->db_data;
@@ -234,8 +239,7 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
dmu_buf_rele(origin_bonus, FTAG);
}
- winner = dmu_buf_set_user_ie(dbuf, dd, &dd->dd_phys,
- dsl_dir_evict);
+ winner = dmu_buf_set_user_ie(dbuf, dd, dsl_dir_evict);
if (winner) {
if (dd->dd_parent)
dsl_dir_rele(dd->dd_parent, dd);
@@ -421,10 +425,10 @@ dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
if (next[0] == '@')
break;
dprintf("looking up %s in obj%lld\n",
- buf, dd->dd_phys->dd_child_dir_zapobj);
+ buf, dsl_dir_phys(dd)->dd_child_dir_zapobj);
err = zap_lookup(dp->dp_meta_objset,
- dd->dd_phys->dd_child_dir_zapobj,
+ dsl_dir_phys(dd)->dd_child_dir_zapobj,
buf, sizeof (ddobj), 1, &ddobj);
if (err != 0) {
if (err == ENOENT)
@@ -507,7 +511,7 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, dmu_tx_t *tx)
za = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP);
/* Iterate my child dirs */
- for (zap_cursor_init(zc, os, dd->dd_phys->dd_child_dir_zapobj);
+ for (zap_cursor_init(zc, os, dsl_dir_phys(dd)->dd_child_dir_zapobj);
zap_cursor_retrieve(zc, za) == 0; zap_cursor_advance(zc)) {
dsl_dir_t *chld_dd;
uint64_t count;
@@ -541,9 +545,9 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, dmu_tx_t *tx)
zap_cursor_fini(zc);
/* Count my snapshots (we counted children's snapshots above) */
VERIFY0(dsl_dataset_hold_obj(dd->dd_pool,
- dd->dd_phys->dd_head_dataset_obj, FTAG, &ds));
+ dsl_dir_phys(dd)->dd_head_dataset_obj, FTAG, &ds));
- for (zap_cursor_init(zc, os, ds->ds_phys->ds_snapnames_zapobj);
+ for (zap_cursor_init(zc, os, dsl_dataset_phys(ds)->ds_snapnames_zapobj);
zap_cursor_retrieve(zc, za) == 0;
zap_cursor_advance(zc)) {
/* Don't count temporary snapshots */
@@ -691,7 +695,7 @@ dsl_enforce_ds_ss_limits(dsl_dir_t *dd, zfs_prop_t prop, cred_t *cr)
return (ENFORCE_NEVER);
#endif
- if ((obj = dd->dd_phys->dd_head_dataset_obj) == 0)
+ if ((obj = dsl_dir_phys(dd)->dd_head_dataset_obj) == 0)
return (ENFORCE_ALWAYS);
ASSERT(dsl_pool_config_held(dd->dd_pool));
@@ -869,7 +873,7 @@ dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds, const char *name,
ddobj = dmu_object_alloc(mos, DMU_OT_DSL_DIR, 0,
DMU_OT_DSL_DIR, sizeof (dsl_dir_phys_t), tx);
if (pds) {
- VERIFY(0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj,
+ VERIFY(0 == zap_add(mos, dsl_dir_phys(pds)->dd_child_dir_zapobj,
name, sizeof (uint64_t), 1, &ddobj, tx));
} else {
/* it's the root dir */
@@ -901,9 +905,9 @@ dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds, const char *name,
boolean_t
dsl_dir_is_clone(dsl_dir_t *dd)
{
- return (dd->dd_phys->dd_origin_obj &&
+ return (dsl_dir_phys(dd)->dd_origin_obj &&
(dd->dd_pool->dp_origin_snap == NULL ||
- dd->dd_phys->dd_origin_obj !=
+ dsl_dir_phys(dd)->dd_origin_obj !=
dd->dd_pool->dp_origin_snap->ds_object));
}
@@ -912,26 +916,27 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv)
{
mutex_enter(&dd->dd_lock);
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USED,
- dd->dd_phys->dd_used_bytes);
- dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_QUOTA, dd->dd_phys->dd_quota);
+ dsl_dir_phys(dd)->dd_used_bytes);
+ dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_QUOTA,
+ dsl_dir_phys(dd)->dd_quota);
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_RESERVATION,
- dd->dd_phys->dd_reserved);
+ dsl_dir_phys(dd)->dd_reserved);
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO,
- dd->dd_phys->dd_compressed_bytes == 0 ? 100 :
- (dd->dd_phys->dd_uncompressed_bytes * 100 /
- dd->dd_phys->dd_compressed_bytes));
+ dsl_dir_phys(dd)->dd_compressed_bytes == 0 ? 100 :
+ (dsl_dir_phys(dd)->dd_uncompressed_bytes * 100 /
+ dsl_dir_phys(dd)->dd_compressed_bytes));
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALUSED,
- dd->dd_phys->dd_uncompressed_bytes);
- if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
+ dsl_dir_phys(dd)->dd_uncompressed_bytes);
+ if (dsl_dir_phys(dd)->dd_flags & DD_FLAG_USED_BREAKDOWN) {
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDSNAP,
- dd->dd_phys->dd_used_breakdown[DD_USED_SNAP]);
+ dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_SNAP]);
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDDS,
- dd->dd_phys->dd_used_breakdown[DD_USED_HEAD]);
+ dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_HEAD]);
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDREFRESERV,
- dd->dd_phys->dd_used_breakdown[DD_USED_REFRSRV]);
+ dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_REFRSRV]);
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDCHILD,
- dd->dd_phys->dd_used_breakdown[DD_USED_CHILD] +
- dd->dd_phys->dd_used_breakdown[DD_USED_CHILD_RSRV]);
+ dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_CHILD] +
+ dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_CHILD_RSRV]);
}
mutex_exit(&dd->dd_lock);
@@ -956,7 +961,7 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv)
char buf[MAXNAMELEN];
VERIFY0(dsl_dataset_hold_obj(dd->dd_pool,
- dd->dd_phys->dd_origin_obj, FTAG, &ds));
+ dsl_dir_phys(dd)->dd_origin_obj, FTAG, &ds));
dsl_dataset_name(ds, buf);
dsl_dataset_rele(ds, FTAG);
dsl_prop_nvlist_add_string(nv, ZFS_PROP_ORIGIN, buf);
@@ -968,7 +973,7 @@ dsl_dir_dirty(dsl_dir_t *dd, dmu_tx_t *tx)
{
dsl_pool_t *dp = dd->dd_pool;
- ASSERT(dd->dd_phys);
+ ASSERT(dsl_dir_phys(dd));
if (txg_list_add(&dp->dp_dirty_dirs, dd, tx->tx_txg)) {
/* up the hold count until we can be written out */
@@ -979,8 +984,9 @@ dsl_dir_dirty(dsl_dir_t *dd, dmu_tx_t *tx)
static int64_t
parent_delta(dsl_dir_t *dd, uint64_t used, int64_t delta)
{
- uint64_t old_accounted = MAX(used, dd->dd_phys->dd_reserved);
- uint64_t new_accounted = MAX(used + delta, dd->dd_phys->dd_reserved);
+ uint64_t old_accounted = MAX(used, dsl_dir_phys(dd)->dd_reserved);
+ uint64_t new_accounted =
+ MAX(used + delta, dsl_dir_phys(dd)->dd_reserved);
return (new_accounted - old_accounted);
}
@@ -1039,9 +1045,9 @@ dsl_dir_space_available(dsl_dir_t *dd,
}
mutex_enter(&dd->dd_lock);
- if (dd->dd_phys->dd_quota != 0)
- quota = dd->dd_phys->dd_quota;
- used = dd->dd_phys->dd_used_bytes;
+ if (dsl_dir_phys(dd)->dd_quota != 0)
+ quota = dsl_dir_phys(dd)->dd_quota;
+ used = dsl_dir_phys(dd)->dd_used_bytes;
if (!ondiskonly)
used += dsl_dir_space_towrite(dd);
@@ -1050,12 +1056,12 @@ dsl_dir_space_available(dsl_dir_t *dd,
quota = MIN(quota, poolsize);
}
- if (dd->dd_phys->dd_reserved > used && parentspace != UINT64_MAX) {
+ if (dsl_dir_phys(dd)->dd_reserved > used && parentspace != UINT64_MAX) {
/*
* We have some space reserved, in addition to what our
* parent gave us.
*/
- parentspace += dd->dd_phys->dd_reserved - used;
+ parentspace += dsl_dir_phys(dd)->dd_reserved - used;
}
if (dd == ancestor) {
@@ -1114,7 +1120,7 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
est_inflight = dsl_dir_space_towrite(dd);
for (i = 0; i < TXG_SIZE; i++)
est_inflight += dd->dd_tempreserved[i];
- used_on_disk = dd->dd_phys->dd_used_bytes;
+ used_on_disk = dsl_dir_phys(dd)->dd_used_bytes;
/*
* On the first iteration, fetch the dataset's used-on-disk and
@@ -1138,10 +1144,10 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
* If this transaction will result in a net free of space,
* we want to let it through.
*/
- if (ignorequota || netfree || dd->dd_phys->dd_quota == 0)
+ if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0)
quota = UINT64_MAX;
else
- quota = dd->dd_phys->dd_quota;
+ quota = dsl_dir_phys(dd)->dd_quota;
/*
* Adjust the quota against the actual pool size at the root
@@ -1196,7 +1202,7 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
/* see if it's OK with our parent */
if (dd->dd_parent && parent_rsrv) {
- boolean_t ismos = (dd->dd_phys->dd_head_dataset_obj == 0);
+ boolean_t ismos = (dsl_dir_phys(dd)->dd_head_dataset_obj == 0);
return (dsl_dir_tempreserve_impl(dd->dd_parent,
parent_rsrv, netfree, ismos, TRUE, tr_list, tx, FALSE));
@@ -1321,7 +1327,7 @@ dsl_dir_willuse_space(dsl_dir_t *dd, int64_t space, dmu_tx_t *tx)
dd->dd_space_towrite[tx->tx_txg & TXG_MASK] += space;
est_used = dsl_dir_space_towrite(dd) +
- dd->dd_phys->dd_used_bytes;
+ dsl_dir_phys(dd)->dd_used_bytes;
parent_space = parent_delta(dd, est_used, space);
mutex_exit(&dd->dd_lock);
@@ -1356,27 +1362,28 @@ dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type,
if (needlock)
mutex_enter(&dd->dd_lock);
- accounted_delta = parent_delta(dd, dd->dd_phys->dd_used_bytes, used);
- ASSERT(used >= 0 || dd->dd_phys->dd_used_bytes >= -used);
+ accounted_delta =
+ parent_delta(dd, dsl_dir_phys(dd)->dd_used_bytes, used);
+ ASSERT(used >= 0 || dsl_dir_phys(dd)->dd_used_bytes >= -used);
ASSERT(compressed >= 0 ||
- dd->dd_phys->dd_compressed_bytes >= -compressed);
+ dsl_dir_phys(dd)->dd_compressed_bytes >= -compressed);
ASSERT(uncompressed >= 0 ||
- dd->dd_phys->dd_uncompressed_bytes >= -uncompressed);
- dd->dd_phys->dd_used_bytes += used;
- dd->dd_phys->dd_uncompressed_bytes += uncompressed;
- dd->dd_phys->dd_compressed_bytes += compressed;
+ dsl_dir_phys(dd)->dd_uncompressed_bytes >= -uncompressed);
+ dsl_dir_phys(dd)->dd_used_bytes += used;
+ dsl_dir_phys(dd)->dd_uncompressed_bytes += uncompressed;
+ dsl_dir_phys(dd)->dd_compressed_bytes += compressed;
- if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
+ if (dsl_dir_phys(dd)->dd_flags & DD_FLAG_USED_BREAKDOWN) {
ASSERT(used > 0 ||
- dd->dd_phys->dd_used_breakdown[type] >= -used);
- dd->dd_phys->dd_used_breakdown[type] += used;
+ dsl_dir_phys(dd)->dd_used_breakdown[type] >= -used);
+ dsl_dir_phys(dd)->dd_used_breakdown[type] += used;
#ifdef DEBUG
{
dd_used_t t;
uint64_t u = 0;
for (t = 0; t < DD_USED_NUM; t++)
- u += dd->dd_phys->dd_used_breakdown[t];
- ASSERT3U(u, ==, dd->dd_phys->dd_used_bytes);
+ u += dsl_dir_phys(dd)->dd_used_breakdown[t];
+ ASSERT3U(u, ==, dsl_dir_phys(dd)->dd_used_bytes);
}
#endif
}
@@ -1400,17 +1407,18 @@ dsl_dir_transfer_space(dsl_dir_t *dd, int64_t delta,
ASSERT(oldtype < DD_USED_NUM);
ASSERT(newtype < DD_USED_NUM);
- if (delta == 0 || !(dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN))
+ if (delta == 0 ||
+ !(dsl_dir_phys(dd)->dd_flags & DD_FLAG_USED_BREAKDOWN))
return;
dmu_buf_will_dirty(dd->dd_dbuf, tx);
mutex_enter(&dd->dd_lock);
ASSERT(delta > 0 ?
- dd->dd_phys->dd_used_breakdown[oldtype] >= delta :
- dd->dd_phys->dd_used_breakdown[newtype] >= -delta);
- ASSERT(dd->dd_phys->dd_used_bytes >= ABS(delta));
- dd->dd_phys->dd_used_breakdown[oldtype] -= delta;
- dd->dd_phys->dd_used_breakdown[newtype] += delta;
+ dsl_dir_phys(dd)->dd_used_breakdown[oldtype] >= delta :
+ dsl_dir_phys(dd)->dd_used_breakdown[newtype] >= -delta);
+ ASSERT(dsl_dir_phys(dd)->dd_used_bytes >= ABS(delta));
+ dsl_dir_phys(dd)->dd_used_breakdown[oldtype] -= delta;
+ dsl_dir_phys(dd)->dd_used_breakdown[newtype] += delta;
mutex_exit(&dd->dd_lock);
}
@@ -1454,8 +1462,8 @@ dsl_dir_set_quota_check(void *arg, dmu_tx_t *tx)
*/
towrite = dsl_dir_space_towrite(ds->ds_dir);
if ((dmu_tx_is_syncing(tx) || towrite == 0) &&
- (newval < ds->ds_dir->dd_phys->dd_reserved ||
- newval < ds->ds_dir->dd_phys->dd_used_bytes + towrite)) {
+ (newval < dsl_dir_phys(ds->ds_dir)->dd_reserved ||
+ newval < dsl_dir_phys(ds->ds_dir)->dd_used_bytes + towrite)) {
error = SET_ERROR(ENOSPC);
}
mutex_exit(&ds->ds_dir->dd_lock);
@@ -1488,7 +1496,7 @@ dsl_dir_set_quota_sync(void *arg, dmu_tx_t *tx)
dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx);
mutex_enter(&ds->ds_dir->dd_lock);
- ds->ds_dir->dd_phys->dd_quota = newval;
+ dsl_dir_phys(ds->ds_dir)->dd_quota = newval;
mutex_exit(&ds->ds_dir->dd_lock);
dsl_dataset_rele(ds, FTAG);
}
@@ -1539,7 +1547,7 @@ dsl_dir_set_reservation_check(void *arg, dmu_tx_t *tx)
}
mutex_enter(&dd->dd_lock);
- used = dd->dd_phys->dd_used_bytes;
+ used = dsl_dir_phys(dd)->dd_used_bytes;
mutex_exit(&dd->dd_lock);
if (dd->dd_parent) {
@@ -1549,13 +1557,13 @@ dsl_dir_set_reservation_check(void *arg, dmu_tx_t *tx)
avail = dsl_pool_adjustedsize(dd->dd_pool, B_FALSE) - used;
}
- if (MAX(used, newval) > MAX(used, dd->dd_phys->dd_reserved)) {
+ if (MAX(used, newval) > MAX(used, dsl_dir_phys(dd)->dd_reserved)) {
uint64_t delta = MAX(used, newval) -
- MAX(used, dd->dd_phys->dd_reserved);
+ MAX(used, dsl_dir_phys(dd)->dd_reserved);
if (delta > avail ||
- (dd->dd_phys->dd_quota > 0 &&
- newval > dd->dd_phys->dd_quota))
+ (dsl_dir_phys(dd)->dd_quota > 0 &&
+ newval > dsl_dir_phys(dd)->dd_quota))
error = SET_ERROR(ENOSPC);
}
@@ -1572,9 +1580,9 @@ dsl_dir_set_reservation_sync_impl(dsl_dir_t *dd, uint64_t value, dmu_tx_t *tx)
dmu_buf_will_dirty(dd->dd_dbuf, tx);
mutex_enter(&dd->dd_lock);
- used = dd->dd_phys->dd_used_bytes;
- delta = MAX(used, value) - MAX(used, dd->dd_phys->dd_reserved);
- dd->dd_phys->dd_reserved = value;
+ used = dsl_dir_phys(dd)->dd_used_bytes;
+ delta = MAX(used, value) - MAX(used, dsl_dir_phys(dd)->dd_reserved);
+ dsl_dir_phys(dd)->dd_reserved = value;
if (dd->dd_parent != NULL) {
/* Roll up this additional usage into our ancestors */
@@ -1651,7 +1659,7 @@ would_change(dsl_dir_t *dd, int64_t delta, dsl_dir_t *ancestor)
return (delta);
mutex_enter(&dd->dd_lock);
- delta = parent_delta(dd, dd->dd_phys->dd_used_bytes, delta);
+ delta = parent_delta(dd, dsl_dir_phys(dd)->dd_used_bytes, delta);
mutex_exit(&dd->dd_lock);
return (would_change(dd->dd_parent, delta, ancestor));
}
@@ -1742,7 +1750,8 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx)
if (newparent != dd->dd_parent) {
/* is there enough space? */
uint64_t myspace =
- MAX(dd->dd_phys->dd_used_bytes, dd->dd_phys->dd_reserved);
+ MAX(dsl_dir_phys(dd)->dd_used_bytes,
+ dsl_dir_phys(dd)->dd_reserved);
objset_t *os = dd->dd_pool->dp_meta_objset;
uint64_t fs_cnt = 0;
uint64_t ss_cnt = 0;
@@ -1841,17 +1850,18 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t *tx)
DD_FIELD_SNAPSHOT_COUNT, tx);
dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD,
- -dd->dd_phys->dd_used_bytes,
- -dd->dd_phys->dd_compressed_bytes,
- -dd->dd_phys->dd_uncompressed_bytes, tx);
+ -dsl_dir_phys(dd)->dd_used_bytes,
+ -dsl_dir_phys(dd)->dd_compressed_bytes,
+ -dsl_dir_phys(dd)->dd_uncompressed_bytes, tx);
dsl_dir_diduse_space(newparent, DD_USED_CHILD,
- dd->dd_phys->dd_used_bytes,
- dd->dd_phys->dd_compressed_bytes,
- dd->dd_phys->dd_uncompressed_bytes, tx);
+ dsl_dir_phys(dd)->dd_used_bytes,
+ dsl_dir_phys(dd)->dd_compressed_bytes,
+ dsl_dir_phys(dd)->dd_uncompressed_bytes, tx);
- if (dd->dd_phys->dd_reserved > dd->dd_phys->dd_used_bytes) {
- uint64_t unused_rsrv = dd->dd_phys->dd_reserved -
- dd->dd_phys->dd_used_bytes;
+ if (dsl_dir_phys(dd)->dd_reserved >
+ dsl_dir_phys(dd)->dd_used_bytes) {
+ uint64_t unused_rsrv = dsl_dir_phys(dd)->dd_reserved -
+ dsl_dir_phys(dd)->dd_used_bytes;
dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD_RSRV,
-unused_rsrv, 0, 0, tx);
@@ -1863,18 +1873,19 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t *tx)
dmu_buf_will_dirty(dd->dd_dbuf, tx);
/* remove from old parent zapobj */
- error = zap_remove(mos, dd->dd_parent->dd_phys->dd_child_dir_zapobj,
+ error = zap_remove(mos,
+ dsl_dir_phys(dd->dd_parent)->dd_child_dir_zapobj,
dd->dd_myname, tx);
ASSERT0(error);
(void) strcpy(dd->dd_myname, mynewname);
dsl_dir_rele(dd->dd_parent, dd);
- dd->dd_phys->dd_parent_obj = newparent->dd_object;
+ dsl_dir_phys(dd)->dd_parent_obj = newparent->dd_object;
VERIFY0(dsl_dir_hold_obj(dp,
newparent->dd_object, NULL, dd, &dd->dd_parent));
/* add to new parent zapobj */
- VERIFY0(zap_add(mos, newparent->dd_phys->dd_child_dir_zapobj,
+ VERIFY0(zap_add(mos, dsl_dir_phys(newparent)->dd_child_dir_zapobj,
dd->dd_myname, 8, 1, &dd->dd_object, tx));
#ifdef _KERNEL