mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +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
@@ -228,7 +228,6 @@ typedef struct dmu_buf_impl {
|
||||
|
||||
/* stuff we store for the user (see dmu_buf_set_user) */
|
||||
void *db_user_ptr;
|
||||
void **db_user_data_ptr_ptr;
|
||||
dmu_buf_evict_func_t *db_evict_func;
|
||||
|
||||
uint8_t db_immediate_evict;
|
||||
|
||||
+3
-10
@@ -481,12 +481,6 @@ void dmu_buf_rele_array(dmu_buf_t **, int numbufs, void *tag);
|
||||
*
|
||||
* user_ptr is for use by the user and can be obtained via dmu_buf_get_user().
|
||||
*
|
||||
* user_data_ptr_ptr should be NULL, or a pointer to a pointer which
|
||||
* will be set to db->db_data when you are allowed to access it. Note
|
||||
* that db->db_data (the pointer) can change when you do dmu_buf_read(),
|
||||
* dmu_buf_tryupgrade(), dmu_buf_will_dirty(), or dmu_buf_will_fill().
|
||||
* *user_data_ptr_ptr will be set to the new value when it changes.
|
||||
*
|
||||
* If non-NULL, pageout func will be called when this buffer is being
|
||||
* excised from the cache, so that you can clean up the data structure
|
||||
* pointed to by user_ptr.
|
||||
@@ -494,17 +488,16 @@ void dmu_buf_rele_array(dmu_buf_t **, int numbufs, void *tag);
|
||||
* dmu_evict_user() will call the pageout func for all buffers in a
|
||||
* objset with a given pageout func.
|
||||
*/
|
||||
void *dmu_buf_set_user(dmu_buf_t *db, void *user_ptr, void *user_data_ptr_ptr,
|
||||
void *dmu_buf_set_user(dmu_buf_t *db, void *user_ptr,
|
||||
dmu_buf_evict_func_t *pageout_func);
|
||||
/*
|
||||
* set_user_ie is the same as set_user, but request immediate eviction
|
||||
* when hold count goes to zero.
|
||||
*/
|
||||
void *dmu_buf_set_user_ie(dmu_buf_t *db, void *user_ptr,
|
||||
void *user_data_ptr_ptr, dmu_buf_evict_func_t *pageout_func);
|
||||
void *dmu_buf_update_user(dmu_buf_t *db_fake, void *old_user_ptr,
|
||||
void *user_ptr, void *user_data_ptr_ptr,
|
||||
dmu_buf_evict_func_t *pageout_func);
|
||||
void *dmu_buf_update_user(dmu_buf_t *db_fake, void *old_user_ptr,
|
||||
void *user_ptr, dmu_buf_evict_func_t *pageout_func);
|
||||
void dmu_evict_user(objset_t *os, dmu_buf_evict_func_t *func);
|
||||
|
||||
/*
|
||||
|
||||
@@ -48,7 +48,7 @@ struct dsl_pool;
|
||||
|
||||
#define DS_FLAG_INCONSISTENT (1ULL<<0)
|
||||
#define DS_IS_INCONSISTENT(ds) \
|
||||
((ds)->ds_phys->ds_flags & DS_FLAG_INCONSISTENT)
|
||||
(dsl_dataset_phys(ds)->ds_flags & DS_FLAG_INCONSISTENT)
|
||||
|
||||
/*
|
||||
* Do not allow this dataset to be promoted.
|
||||
@@ -68,7 +68,7 @@ struct dsl_pool;
|
||||
*/
|
||||
#define DS_FLAG_DEFER_DESTROY (1ULL<<3)
|
||||
#define DS_IS_DEFER_DESTROY(ds) \
|
||||
((ds)->ds_phys->ds_flags & DS_FLAG_DEFER_DESTROY)
|
||||
(dsl_dataset_phys(ds)->ds_flags & DS_FLAG_DEFER_DESTROY)
|
||||
|
||||
/*
|
||||
* DS_FIELD_* are strings that are used in the "extensified" dataset zap object.
|
||||
@@ -127,7 +127,6 @@ typedef struct dsl_dataset_phys {
|
||||
typedef struct dsl_dataset {
|
||||
/* Immutable: */
|
||||
struct dsl_dir *ds_dir;
|
||||
dsl_dataset_phys_t *ds_phys;
|
||||
dmu_buf_t *ds_dbuf;
|
||||
uint64_t ds_object;
|
||||
uint64_t ds_fsid_guid;
|
||||
@@ -177,17 +176,26 @@ typedef struct dsl_dataset {
|
||||
char ds_snapname[MAXNAMELEN];
|
||||
} dsl_dataset_t;
|
||||
|
||||
static inline dsl_dataset_phys_t *
|
||||
dsl_dataset_phys(dsl_dataset_t *ds)
|
||||
{
|
||||
return (ds->ds_dbuf->db_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* The max length of a temporary tag prefix is the number of hex digits
|
||||
* required to express UINT64_MAX plus one for the hyphen.
|
||||
*/
|
||||
#define MAX_TAG_PREFIX_LEN 17
|
||||
|
||||
#define dsl_dataset_is_snapshot(ds) \
|
||||
((ds)->ds_phys->ds_num_children != 0)
|
||||
static inline boolean_t
|
||||
dsl_dataset_is_snapshot(dsl_dataset_t *ds)
|
||||
{
|
||||
return (dsl_dataset_phys(ds)->ds_num_children != 0);
|
||||
}
|
||||
|
||||
#define DS_UNIQUE_IS_ACCURATE(ds) \
|
||||
(((ds)->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)
|
||||
((dsl_dataset_phys(ds)->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)
|
||||
|
||||
int dsl_dataset_hold(struct dsl_pool *dp, const char *name, void *tag,
|
||||
dsl_dataset_t **dsp);
|
||||
|
||||
@@ -86,10 +86,11 @@ typedef struct dsl_dir_phys {
|
||||
struct dsl_dir {
|
||||
/* These are immutable; no lock needed: */
|
||||
uint64_t dd_object;
|
||||
dsl_dir_phys_t *dd_phys;
|
||||
dmu_buf_t *dd_dbuf;
|
||||
dsl_pool_t *dd_pool;
|
||||
|
||||
/* Stable until user eviction; no lock needed: */
|
||||
dmu_buf_t *dd_dbuf;
|
||||
|
||||
/* protected by lock on pool's dp_dirty_dirs list */
|
||||
txg_node_t dd_dirty_link;
|
||||
|
||||
@@ -111,6 +112,12 @@ struct dsl_dir {
|
||||
char dd_myname[MAXNAMELEN];
|
||||
};
|
||||
|
||||
static inline dsl_dir_phys_t *
|
||||
dsl_dir_phys(dsl_dir_t *dd)
|
||||
{
|
||||
return (dd->dd_dbuf->db_data);
|
||||
}
|
||||
|
||||
void dsl_dir_rele(dsl_dir_t *dd, void *tag);
|
||||
int dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||
dsl_dir_t **, const char **tail);
|
||||
|
||||
+14
-5
@@ -70,7 +70,7 @@ typedef struct mzap_ent {
|
||||
} mzap_ent_t;
|
||||
|
||||
#define MZE_PHYS(zap, mze) \
|
||||
(&(zap)->zap_m.zap_phys->mz_chunk[(mze)->mze_chunkid])
|
||||
(&zap_m_phys(zap)->mz_chunk[(mze)->mze_chunkid])
|
||||
|
||||
/*
|
||||
* The (fat) zap is stored in one object. It is an array of
|
||||
@@ -104,7 +104,7 @@ struct zap_leaf;
|
||||
* word number (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap)).
|
||||
*/
|
||||
#define ZAP_EMBEDDED_PTRTBL_ENT(zap, idx) \
|
||||
((uint64_t *)(zap)->zap_f.zap_phys) \
|
||||
((uint64_t *)zap_f_phys(zap)) \
|
||||
[(idx) + (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap))]
|
||||
|
||||
/*
|
||||
@@ -149,8 +149,6 @@ typedef struct zap {
|
||||
uint64_t zap_salt;
|
||||
union {
|
||||
struct {
|
||||
zap_phys_t *zap_phys;
|
||||
|
||||
/*
|
||||
* zap_num_entries_mtx protects
|
||||
* zap_num_entries
|
||||
@@ -159,7 +157,6 @@ typedef struct zap {
|
||||
int zap_block_shift;
|
||||
} zap_fat;
|
||||
struct {
|
||||
mzap_phys_t *zap_phys;
|
||||
int16_t zap_num_entries;
|
||||
int16_t zap_num_chunks;
|
||||
int16_t zap_alloc_next;
|
||||
@@ -168,6 +165,18 @@ typedef struct zap {
|
||||
} zap_u;
|
||||
} zap_t;
|
||||
|
||||
static inline zap_phys_t *
|
||||
zap_f_phys(zap_t *zap)
|
||||
{
|
||||
return (zap->zap_dbuf->db_data);
|
||||
}
|
||||
|
||||
static inline mzap_phys_t *
|
||||
zap_m_phys(zap_t *zap)
|
||||
{
|
||||
return (zap->zap_dbuf->db_data);
|
||||
}
|
||||
|
||||
typedef struct zap_name {
|
||||
zap_t *zn_zap;
|
||||
int zn_key_intlen;
|
||||
|
||||
@@ -83,7 +83,7 @@ struct zap_stats;
|
||||
*/
|
||||
#define ZAP_LEAF_CHUNK(l, idx) \
|
||||
((zap_leaf_chunk_t *) \
|
||||
((l)->l_phys->l_hash + ZAP_LEAF_HASH_NUMENTRIES(l)))[idx]
|
||||
(zap_leaf_phys(l)->l_hash + ZAP_LEAF_HASH_NUMENTRIES(l)))[idx]
|
||||
#define ZAP_LEAF_ENTRY(l, idx) (&ZAP_LEAF_CHUNK(l, idx).l_entry)
|
||||
|
||||
typedef enum zap_chunk_type {
|
||||
@@ -156,9 +156,13 @@ typedef struct zap_leaf {
|
||||
uint64_t l_blkid; /* 1<<ZAP_BLOCK_SHIFT byte block off */
|
||||
int l_bs; /* block size shift */
|
||||
dmu_buf_t *l_dbuf;
|
||||
zap_leaf_phys_t *l_phys;
|
||||
} zap_leaf_t;
|
||||
|
||||
static inline zap_leaf_phys_t *
|
||||
zap_leaf_phys(zap_leaf_t *l)
|
||||
{
|
||||
return (l->l_dbuf->db_data);
|
||||
}
|
||||
|
||||
typedef struct zap_entry_handle {
|
||||
/* Set by zap_leaf and public to ZAP */
|
||||
|
||||
Reference in New Issue
Block a user