mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 11:47:43 +03:00
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 <justing@spectralogic.com> Reviewed by: Andriy Gapon <avg@freebsd.org> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Will Andrews <willa@spectralogic.com> Approved by: Dan McDonald <danmcd@omniti.com> References: https://www.illumos.org/issues/5314 https://github.com/illumos/illumos-gate/commit/c137962 Ported-by: Chris Dunlop <chris@onthe.net.au> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
committed by
Brian Behlendorf
parent
945dd93525
commit
d683ddbb72
+14
-12
@@ -38,6 +38,8 @@
|
||||
#include <sys/sunddi.h>
|
||||
#endif
|
||||
|
||||
extern inline mzap_phys_t *zap_m_phys(zap_t *zap);
|
||||
|
||||
static int mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags);
|
||||
|
||||
uint64_t
|
||||
@@ -45,7 +47,7 @@ zap_getflags(zap_t *zap)
|
||||
{
|
||||
if (zap->zap_ismicro)
|
||||
return (0);
|
||||
return (zap->zap_u.zap_fat.zap_phys->zap_flags);
|
||||
return (zap_f_phys(zap)->zap_flags);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -384,7 +386,7 @@ mzap_open(objset_t *os, uint64_t obj, dmu_buf_t *db)
|
||||
* it, because zap_lockdir() checks zap_ismicro without the lock
|
||||
* held.
|
||||
*/
|
||||
winner = dmu_buf_set_user(db, zap, &zap->zap_m.zap_phys, zap_evict);
|
||||
winner = dmu_buf_set_user(db, zap, zap_evict);
|
||||
|
||||
if (winner != NULL) {
|
||||
rw_exit(&zap->zap_rwlock);
|
||||
@@ -396,15 +398,15 @@ mzap_open(objset_t *os, uint64_t obj, dmu_buf_t *db)
|
||||
}
|
||||
|
||||
if (zap->zap_ismicro) {
|
||||
zap->zap_salt = zap->zap_m.zap_phys->mz_salt;
|
||||
zap->zap_normflags = zap->zap_m.zap_phys->mz_normflags;
|
||||
zap->zap_salt = zap_m_phys(zap)->mz_salt;
|
||||
zap->zap_normflags = zap_m_phys(zap)->mz_normflags;
|
||||
zap->zap_m.zap_num_chunks = db->db_size / MZAP_ENT_LEN - 1;
|
||||
avl_create(&zap->zap_m.zap_avl, mze_compare,
|
||||
sizeof (mzap_ent_t), offsetof(mzap_ent_t, mze_node));
|
||||
|
||||
for (i = 0; i < zap->zap_m.zap_num_chunks; i++) {
|
||||
mzap_ent_phys_t *mze =
|
||||
&zap->zap_m.zap_phys->mz_chunk[i];
|
||||
&zap_m_phys(zap)->mz_chunk[i];
|
||||
if (mze->mze_name[0]) {
|
||||
zap_name_t *zn;
|
||||
|
||||
@@ -416,8 +418,8 @@ mzap_open(objset_t *os, uint64_t obj, dmu_buf_t *db)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
zap->zap_salt = zap->zap_f.zap_phys->zap_salt;
|
||||
zap->zap_normflags = zap->zap_f.zap_phys->zap_normflags;
|
||||
zap->zap_salt = zap_f_phys(zap)->zap_salt;
|
||||
zap->zap_normflags = zap_f_phys(zap)->zap_normflags;
|
||||
|
||||
ASSERT3U(sizeof (struct zap_leaf_header), ==,
|
||||
2*ZAP_LEAF_CHUNKSIZE);
|
||||
@@ -427,7 +429,7 @@ mzap_open(objset_t *os, uint64_t obj, dmu_buf_t *db)
|
||||
* other members.
|
||||
*/
|
||||
ASSERT3P(&ZAP_EMBEDDED_PTRTBL_ENT(zap, 0), >,
|
||||
&zap->zap_f.zap_phys->zap_salt);
|
||||
&zap_f_phys(zap)->zap_salt);
|
||||
|
||||
/*
|
||||
* The embedded pointer table should end at the end of
|
||||
@@ -435,7 +437,7 @@ mzap_open(objset_t *os, uint64_t obj, dmu_buf_t *db)
|
||||
*/
|
||||
ASSERT3U((uintptr_t)&ZAP_EMBEDDED_PTRTBL_ENT(zap,
|
||||
1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap)) -
|
||||
(uintptr_t)zap->zap_f.zap_phys, ==,
|
||||
(uintptr_t)zap_f_phys(zap), ==,
|
||||
zap->zap_dbuf->db_size);
|
||||
}
|
||||
rw_exit(&zap->zap_rwlock);
|
||||
@@ -936,7 +938,7 @@ mzap_addent(zap_name_t *zn, uint64_t value)
|
||||
#ifdef ZFS_DEBUG
|
||||
for (i = 0; i < zap->zap_m.zap_num_chunks; i++) {
|
||||
ASSERTV(mzap_ent_phys_t *mze);
|
||||
ASSERT(mze = &zap->zap_m.zap_phys->mz_chunk[i]);
|
||||
ASSERT(mze = &zap_m_phys(zap)->mz_chunk[i]);
|
||||
ASSERT(strcmp(zn->zn_key_orig, mze->mze_name) != 0);
|
||||
}
|
||||
#endif
|
||||
@@ -947,7 +949,7 @@ mzap_addent(zap_name_t *zn, uint64_t value)
|
||||
|
||||
again:
|
||||
for (i = start; i < zap->zap_m.zap_num_chunks; i++) {
|
||||
mzap_ent_phys_t *mze = &zap->zap_m.zap_phys->mz_chunk[i];
|
||||
mzap_ent_phys_t *mze = &zap_m_phys(zap)->mz_chunk[i];
|
||||
if (mze->mze_name[0] == 0) {
|
||||
mze->mze_value = value;
|
||||
mze->mze_cd = cd;
|
||||
@@ -1149,7 +1151,7 @@ zap_remove_norm(objset_t *os, uint64_t zapobj, const char *name,
|
||||
err = SET_ERROR(ENOENT);
|
||||
} else {
|
||||
zap->zap_m.zap_num_entries--;
|
||||
bzero(&zap->zap_m.zap_phys->mz_chunk[mze->mze_chunkid],
|
||||
bzero(&zap_m_phys(zap)->mz_chunk[mze->mze_chunkid],
|
||||
sizeof (mzap_ent_phys_t));
|
||||
mze_remove(zap, mze);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user