Print this page
3752 want more verifiable dbuf user eviction
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Submitted by:   Will Andrews <willa@spectralogic.com>


 110                 uint16_t lh_prefix_len;         /* num bits used to id this */
 111 
 112 /* above is accessable to zap, below is zap_leaf private */
 113 
 114                 uint16_t lh_freelist;           /* chunk head of free list */
 115                 uint8_t lh_flags;               /* ZLF_* flags */
 116                 uint8_t lh_pad2[11];
 117         } l_hdr; /* 2 24-byte chunks */
 118 
 119         /*
 120          * The header is followed by a hash table with
 121          * ZAP_LEAF_HASH_NUMENTRIES(zap) entries.  The hash table is
 122          * followed by an array of ZAP_LEAF_NUMCHUNKS(zap)
 123          * zap_leaf_chunk structures.  These structures are accessed
 124          * with the ZAP_LEAF_CHUNK() macro.
 125          */
 126 
 127         uint16_t l_hash[1];
 128 } zap_leaf_phys_t;
 129 





 130 typedef union zap_leaf_chunk {
 131         struct zap_leaf_entry {
 132                 uint8_t le_type;                /* always ZAP_CHUNK_ENTRY */
 133                 uint8_t le_value_intlen;        /* size of value's ints */
 134                 uint16_t le_next;               /* next entry in hash chain */
 135                 uint16_t le_name_chunk;         /* first chunk of the name */
 136                 uint16_t le_name_numints;       /* ints in name (incl null) */
 137                 uint16_t le_value_chunk;        /* first chunk of the value */
 138                 uint16_t le_value_numints;      /* value length in ints */
 139                 uint32_t le_cd;                 /* collision differentiator */
 140                 uint64_t le_hash;               /* hash value of the name */
 141         } l_entry;
 142         struct zap_leaf_array {
 143                 uint8_t la_type;                /* always ZAP_CHUNK_ARRAY */
 144                 uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
 145                 uint16_t la_next;               /* next blk or CHAIN_END */
 146         } l_array;
 147         struct zap_leaf_free {
 148                 uint8_t lf_type;                /* always ZAP_CHUNK_FREE */
 149                 uint8_t lf_pad[ZAP_LEAF_ARRAY_BYTES];
 150                 uint16_t lf_next;       /* next in free list, or CHAIN_END */
 151         } l_free;
 152 } zap_leaf_chunk_t;
 153 
 154 typedef struct zap_leaf {

 155         krwlock_t l_rwlock;
 156         uint64_t l_blkid;               /* 1<<ZAP_BLOCK_SHIFT byte block off */
 157         int l_bs;                       /* block size shift */
 158         dmu_buf_t *l_dbuf;
 159         zap_leaf_phys_t *l_phys;


 160 } zap_leaf_t;
 161 


 162 
 163 typedef struct zap_entry_handle {
 164         /* below is set by zap_leaf.c and is public to zap.c */
 165         uint64_t zeh_num_integers;
 166         uint64_t zeh_hash;
 167         uint32_t zeh_cd;
 168         uint8_t zeh_integer_size;
 169 
 170         /* below is private to zap_leaf.c */
 171         uint16_t zeh_fakechunk;
 172         uint16_t *zeh_chunkp;
 173         zap_leaf_t *zeh_leaf;
 174 } zap_entry_handle_t;
 175 
 176 /*
 177  * Return a handle to the named entry, or ENOENT if not found.  The hash
 178  * value must equal zap_hash(name).
 179  */
 180 extern int zap_leaf_lookup(zap_leaf_t *l,
 181     struct zap_name *zn, zap_entry_handle_t *zeh);




 110                 uint16_t lh_prefix_len;         /* num bits used to id this */
 111 
 112 /* above is accessable to zap, below is zap_leaf private */
 113 
 114                 uint16_t lh_freelist;           /* chunk head of free list */
 115                 uint8_t lh_flags;               /* ZLF_* flags */
 116                 uint8_t lh_pad2[11];
 117         } l_hdr; /* 2 24-byte chunks */
 118 
 119         /*
 120          * The header is followed by a hash table with
 121          * ZAP_LEAF_HASH_NUMENTRIES(zap) entries.  The hash table is
 122          * followed by an array of ZAP_LEAF_NUMCHUNKS(zap)
 123          * zap_leaf_chunk structures.  These structures are accessed
 124          * with the ZAP_LEAF_CHUNK() macro.
 125          */
 126 
 127         uint16_t l_hash[1];
 128 } zap_leaf_phys_t;
 129 
 130 typedef struct zap_leaf_dbuf {
 131         uint8_t zldb_pad[offsetof(dmu_buf_t, db_data)];
 132         zap_leaf_phys_t *zldb_data;
 133 } zap_leaf_dbuf_t;
 134 
 135 typedef union zap_leaf_chunk {
 136         struct zap_leaf_entry {
 137                 uint8_t le_type;                /* always ZAP_CHUNK_ENTRY */
 138                 uint8_t le_value_intlen;        /* size of value's ints */
 139                 uint16_t le_next;               /* next entry in hash chain */
 140                 uint16_t le_name_chunk;         /* first chunk of the name */
 141                 uint16_t le_name_numints;       /* ints in name (incl null) */
 142                 uint16_t le_value_chunk;        /* first chunk of the value */
 143                 uint16_t le_value_numints;      /* value length in ints */
 144                 uint32_t le_cd;                 /* collision differentiator */
 145                 uint64_t le_hash;               /* hash value of the name */
 146         } l_entry;
 147         struct zap_leaf_array {
 148                 uint8_t la_type;                /* always ZAP_CHUNK_ARRAY */
 149                 uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
 150                 uint16_t la_next;               /* next blk or CHAIN_END */
 151         } l_array;
 152         struct zap_leaf_free {
 153                 uint8_t lf_type;                /* always ZAP_CHUNK_FREE */
 154                 uint8_t lf_pad[ZAP_LEAF_ARRAY_BYTES];
 155                 uint16_t lf_next;       /* next in free list, or CHAIN_END */
 156         } l_free;
 157 } zap_leaf_chunk_t;
 158 
 159 typedef struct zap_leaf {
 160         dmu_buf_user_t db_evict;
 161         krwlock_t l_rwlock;
 162         uint64_t l_blkid;               /* 1<<ZAP_BLOCK_SHIFT byte block off */
 163         int l_bs;                       /* block size shift */
 164         union {
 165                 dmu_buf_t *l_dmu_db;
 166                 zap_leaf_dbuf_t *l_db;
 167         } zl_db_u;
 168 } zap_leaf_t;
 169 
 170 #define l_dbuf zl_db_u.l_dmu_db
 171 #define l_phys zl_db_u.l_db->zldb_data
 172 
 173 typedef struct zap_entry_handle {
 174         /* below is set by zap_leaf.c and is public to zap.c */
 175         uint64_t zeh_num_integers;
 176         uint64_t zeh_hash;
 177         uint32_t zeh_cd;
 178         uint8_t zeh_integer_size;
 179 
 180         /* below is private to zap_leaf.c */
 181         uint16_t zeh_fakechunk;
 182         uint16_t *zeh_chunkp;
 183         zap_leaf_t *zeh_leaf;
 184 } zap_entry_handle_t;
 185 
 186 /*
 187  * Return a handle to the named entry, or ENOENT if not found.  The hash
 188  * value must equal zap_hash(name).
 189  */
 190 extern int zap_leaf_lookup(zap_leaf_t *l,
 191     struct zap_name *zn, zap_entry_handle_t *zeh);