diff options
author | Justin T. Gibbs <[email protected]> | 2015-04-02 02:14:34 +1100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-04-28 16:25:20 -0700 |
commit | d683ddbb7272a179da3918cc4f922d92a2195ba2 (patch) | |
tree | 82e1d7a9e0a269de978e2d3d07fa785db63961f7 /include/sys | |
parent | 945dd93525d6e33f822beb44e3a3076c8bc89f86 (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 'include/sys')
-rw-r--r-- | include/sys/dbuf.h | 1 | ||||
-rw-r--r-- | include/sys/dmu.h | 13 | ||||
-rw-r--r-- | include/sys/dsl_dataset.h | 20 | ||||
-rw-r--r-- | include/sys/dsl_dir.h | 11 | ||||
-rw-r--r-- | include/sys/zap_impl.h | 19 | ||||
-rw-r--r-- | include/sys/zap_leaf.h | 8 |
6 files changed, 46 insertions, 26 deletions
diff --git a/include/sys/dbuf.h b/include/sys/dbuf.h index d253add59..d4e39b73f 100644 --- a/include/sys/dbuf.h +++ b/include/sys/dbuf.h @@ -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; diff --git a/include/sys/dmu.h b/include/sys/dmu.h index c9c687b5a..127cdcdb7 100644 --- a/include/sys/dmu.h +++ b/include/sys/dmu.h @@ -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); /* diff --git a/include/sys/dsl_dataset.h b/include/sys/dsl_dataset.h index 2d8987006..c6280f2b8 100644 --- a/include/sys/dsl_dataset.h +++ b/include/sys/dsl_dataset.h @@ -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); diff --git a/include/sys/dsl_dir.h b/include/sys/dsl_dir.h index a9c4f6751..46223f84c 100644 --- a/include/sys/dsl_dir.h +++ b/include/sys/dsl_dir.h @@ -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); diff --git a/include/sys/zap_impl.h b/include/sys/zap_impl.h index 1dc322e02..4b51a2ae2 100644 --- a/include/sys/zap_impl.h +++ b/include/sys/zap_impl.h @@ -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; diff --git a/include/sys/zap_leaf.h b/include/sys/zap_leaf.h index f6947a72d..d3749f368 100644 --- a/include/sys/zap_leaf.h +++ b/include/sys/zap_leaf.h @@ -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 */ |