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


 192 typedef enum sa_buf_type {
 193         SA_BONUS = 1,
 194         SA_SPILL = 2
 195 } sa_buf_type_t;
 196 
 197 typedef enum sa_data_op {
 198         SA_LOOKUP,
 199         SA_UPDATE,
 200         SA_ADD,
 201         SA_REPLACE,
 202         SA_REMOVE
 203 } sa_data_op_t;
 204 
 205 /*
 206  * Opaque handle used for most sa functions
 207  *
 208  * This needs to be kept as small as possible.
 209  */
 210 
 211 struct sa_handle {

 212         kmutex_t        sa_lock;
 213         dmu_buf_t       *sa_bonus;
 214         dmu_buf_t       *sa_spill;
 215         objset_t        *sa_os;
 216         void            *sa_userp;
 217         sa_idx_tab_t    *sa_bonus_tab;   /* idx of bonus */
 218         sa_idx_tab_t    *sa_spill_tab; /* only present if spill activated */
 219 };
 220 
 221 #define SA_GET_DB(hdl, type)    \
 222         (dmu_buf_impl_t *)((type == SA_BONUS) ? hdl->sa_bonus : hdl->sa_spill)
 223 
 224 #define SA_GET_HDR(hdl, type) \
 225         ((sa_hdr_phys_t *)((dmu_buf_impl_t *)(SA_GET_DB(hdl, \
 226         type))->db.db_data))
 227 
 228 #define SA_IDX_TAB_GET(hdl, type) \
 229         (type == SA_BONUS ? hdl->sa_bonus_tab : hdl->sa_spill_tab)
 230 
 231 #define IS_SA_BONUSTYPE(a)      \




 192 typedef enum sa_buf_type {
 193         SA_BONUS = 1,
 194         SA_SPILL = 2
 195 } sa_buf_type_t;
 196 
 197 typedef enum sa_data_op {
 198         SA_LOOKUP,
 199         SA_UPDATE,
 200         SA_ADD,
 201         SA_REPLACE,
 202         SA_REMOVE
 203 } sa_data_op_t;
 204 
 205 /*
 206  * Opaque handle used for most sa functions
 207  *
 208  * This needs to be kept as small as possible.
 209  */
 210 
 211 struct sa_handle {
 212         dmu_buf_user_t  db_evict;
 213         kmutex_t        sa_lock;
 214         dmu_buf_t       *sa_bonus;
 215         dmu_buf_t       *sa_spill;
 216         objset_t        *sa_os;
 217         void            *sa_userp;
 218         sa_idx_tab_t    *sa_bonus_tab;   /* idx of bonus */
 219         sa_idx_tab_t    *sa_spill_tab; /* only present if spill activated */
 220 };
 221 
 222 #define SA_GET_DB(hdl, type)    \
 223         (dmu_buf_impl_t *)((type == SA_BONUS) ? hdl->sa_bonus : hdl->sa_spill)
 224 
 225 #define SA_GET_HDR(hdl, type) \
 226         ((sa_hdr_phys_t *)((dmu_buf_impl_t *)(SA_GET_DB(hdl, \
 227         type))->db.db_data))
 228 
 229 #define SA_IDX_TAB_GET(hdl, type) \
 230         (type == SA_BONUS ? hdl->sa_bonus_tab : hdl->sa_spill_tab)
 231 
 232 #define IS_SA_BONUSTYPE(a)      \