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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/sys/zap_leaf.h
          +++ new/usr/src/uts/common/fs/zfs/sys/zap_leaf.h
↓ open down ↓ 119 lines elided ↑ open up ↑
 120  120           * The header is followed by a hash table with
 121  121           * ZAP_LEAF_HASH_NUMENTRIES(zap) entries.  The hash table is
 122  122           * followed by an array of ZAP_LEAF_NUMCHUNKS(zap)
 123  123           * zap_leaf_chunk structures.  These structures are accessed
 124  124           * with the ZAP_LEAF_CHUNK() macro.
 125  125           */
 126  126  
 127  127          uint16_t l_hash[1];
 128  128  } zap_leaf_phys_t;
 129  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 +
 130  135  typedef union zap_leaf_chunk {
 131  136          struct zap_leaf_entry {
 132  137                  uint8_t le_type;                /* always ZAP_CHUNK_ENTRY */
 133  138                  uint8_t le_value_intlen;        /* size of value's ints */
 134  139                  uint16_t le_next;               /* next entry in hash chain */
 135  140                  uint16_t le_name_chunk;         /* first chunk of the name */
 136  141                  uint16_t le_name_numints;       /* ints in name (incl null) */
 137  142                  uint16_t le_value_chunk;        /* first chunk of the value */
 138  143                  uint16_t le_value_numints;      /* value length in ints */
 139  144                  uint32_t le_cd;                 /* collision differentiator */
↓ open down ↓ 5 lines elided ↑ open up ↑
 145  150                  uint16_t la_next;               /* next blk or CHAIN_END */
 146  151          } l_array;
 147  152          struct zap_leaf_free {
 148  153                  uint8_t lf_type;                /* always ZAP_CHUNK_FREE */
 149  154                  uint8_t lf_pad[ZAP_LEAF_ARRAY_BYTES];
 150  155                  uint16_t lf_next;       /* next in free list, or CHAIN_END */
 151  156          } l_free;
 152  157  } zap_leaf_chunk_t;
 153  158  
 154  159  typedef struct zap_leaf {
      160 +        dmu_buf_user_t db_evict;
 155  161          krwlock_t l_rwlock;
 156  162          uint64_t l_blkid;               /* 1<<ZAP_BLOCK_SHIFT byte block off */
 157  163          int l_bs;                       /* block size shift */
 158      -        dmu_buf_t *l_dbuf;
 159      -        zap_leaf_phys_t *l_phys;
      164 +        union {
      165 +                dmu_buf_t *l_dmu_db;
      166 +                zap_leaf_dbuf_t *l_db;
      167 +        } zl_db_u;
 160  168  } zap_leaf_t;
 161  169  
      170 +#define l_dbuf zl_db_u.l_dmu_db
      171 +#define l_phys zl_db_u.l_db->zldb_data
 162  172  
 163  173  typedef struct zap_entry_handle {
 164  174          /* below is set by zap_leaf.c and is public to zap.c */
 165  175          uint64_t zeh_num_integers;
 166  176          uint64_t zeh_hash;
 167  177          uint32_t zeh_cd;
 168  178          uint8_t zeh_integer_size;
 169  179  
 170  180          /* below is private to zap_leaf.c */
 171  181          uint16_t zeh_fakechunk;
↓ open down ↓ 74 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX