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


  57         uint64_t dd_child_dir_zapobj;
  58         /*
  59          * how much space our children are accounting for; for leaf
  60          * datasets, == physical space used by fs + snaps
  61          */
  62         uint64_t dd_used_bytes;
  63         uint64_t dd_compressed_bytes;
  64         uint64_t dd_uncompressed_bytes;
  65         /* Administrative quota setting */
  66         uint64_t dd_quota;
  67         /* Administrative reservation setting */
  68         uint64_t dd_reserved;
  69         uint64_t dd_props_zapobj;
  70         uint64_t dd_deleg_zapobj; /* dataset delegation permissions */
  71         uint64_t dd_flags;
  72         uint64_t dd_used_breakdown[DD_USED_NUM];
  73         uint64_t dd_clones; /* dsl_dir objects */
  74         uint64_t dd_pad[13]; /* pad out to 256 bytes for good measure */
  75 } dsl_dir_phys_t;
  76 





  77 struct dsl_dir {


  78         /* These are immutable; no lock needed: */
  79         uint64_t dd_object;
  80         dsl_dir_phys_t *dd_phys;
  81         dmu_buf_t *dd_dbuf;


  82         dsl_pool_t *dd_pool;
  83 
  84         /* protected by lock on pool's dp_dirty_dirs list */
  85         txg_node_t dd_dirty_link;
  86 
  87         /* protected by dp_config_rwlock */
  88         dsl_dir_t *dd_parent;
  89 
  90         /* Protected by dd_lock */
  91         kmutex_t dd_lock;
  92         list_t dd_prop_cbs; /* list of dsl_prop_cb_record_t's */
  93         timestruc_t dd_snap_cmtime; /* last time snapshot namespace changed */
  94         uint64_t dd_origin_txg;
  95 
  96         /* gross estimate of space used by in-flight tx's */
  97         uint64_t dd_tempreserved[TXG_SIZE];
  98         /* amount of space we expect to write; == amount of dirty data */
  99         int64_t dd_space_towrite[TXG_SIZE];
 100 
 101         /* protected by dd_lock; keep at end of struct for better locality */
 102         char dd_myname[MAXNAMELEN];
 103 };
 104 




 105 void dsl_dir_rele(dsl_dir_t *dd, void *tag);
 106 int dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
 107     dsl_dir_t **, const char **tail);
 108 int dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
 109     const char *tail, void *tag, dsl_dir_t **);
 110 void dsl_dir_name(dsl_dir_t *dd, char *buf);
 111 int dsl_dir_namelen(dsl_dir_t *dd);
 112 uint64_t dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds,
 113     const char *name, dmu_tx_t *tx);
 114 void dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv);
 115 uint64_t dsl_dir_space_available(dsl_dir_t *dd,
 116     dsl_dir_t *ancestor, int64_t delta, int ondiskonly);
 117 void dsl_dir_dirty(dsl_dir_t *dd, dmu_tx_t *tx);
 118 void dsl_dir_sync(dsl_dir_t *dd, dmu_tx_t *tx);
 119 int dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t mem,
 120     uint64_t asize, uint64_t fsize, uint64_t usize, void **tr_cookiep,
 121     dmu_tx_t *tx);
 122 void dsl_dir_tempreserve_clear(void *tr_cookie, dmu_tx_t *tx);
 123 void dsl_dir_willuse_space(dsl_dir_t *dd, int64_t space, dmu_tx_t *tx);
 124 void dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type,




  57         uint64_t dd_child_dir_zapobj;
  58         /*
  59          * how much space our children are accounting for; for leaf
  60          * datasets, == physical space used by fs + snaps
  61          */
  62         uint64_t dd_used_bytes;
  63         uint64_t dd_compressed_bytes;
  64         uint64_t dd_uncompressed_bytes;
  65         /* Administrative quota setting */
  66         uint64_t dd_quota;
  67         /* Administrative reservation setting */
  68         uint64_t dd_reserved;
  69         uint64_t dd_props_zapobj;
  70         uint64_t dd_deleg_zapobj; /* dataset delegation permissions */
  71         uint64_t dd_flags;
  72         uint64_t dd_used_breakdown[DD_USED_NUM];
  73         uint64_t dd_clones; /* dsl_dir objects */
  74         uint64_t dd_pad[13]; /* pad out to 256 bytes for good measure */
  75 } dsl_dir_phys_t;
  76 
  77 typedef struct dsl_dir_dbuf {
  78         uint8_t dddb_pad[offsetof(dmu_buf_t, db_data)];
  79         dsl_dir_phys_t *dddb_data;
  80 } dsl_dir_dbuf_t;
  81 
  82 struct dsl_dir {
  83         dmu_buf_user_t db_evict;
  84 
  85         /* These are immutable; no lock needed: */
  86         uint64_t dd_object;
  87         union {
  88                 dmu_buf_t *dd_dmu_db;
  89                 dsl_dir_dbuf_t *dd_db;
  90         } dd_db_u;
  91         dsl_pool_t *dd_pool;
  92 
  93         /* protected by lock on pool's dp_dirty_dirs list */
  94         txg_node_t dd_dirty_link;
  95 
  96         /* protected by dp_config_rwlock */
  97         dsl_dir_t *dd_parent;
  98 
  99         /* Protected by dd_lock */
 100         kmutex_t dd_lock;
 101         list_t dd_prop_cbs; /* list of dsl_prop_cb_record_t's */
 102         timestruc_t dd_snap_cmtime; /* last time snapshot namespace changed */
 103         uint64_t dd_origin_txg;
 104 
 105         /* gross estimate of space used by in-flight tx's */
 106         uint64_t dd_tempreserved[TXG_SIZE];
 107         /* amount of space we expect to write; == amount of dirty data */
 108         int64_t dd_space_towrite[TXG_SIZE];
 109 
 110         /* protected by dd_lock; keep at end of struct for better locality */
 111         char dd_myname[MAXNAMELEN];
 112 };
 113 
 114 /* See sys/dmu.h:dmu_buf_user_t for why we have these. */
 115 #define dd_dbuf dd_db_u.dd_dmu_db
 116 #define dd_phys dd_db_u.dd_db->dddb_data
 117 
 118 void dsl_dir_rele(dsl_dir_t *dd, void *tag);
 119 int dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
 120     dsl_dir_t **, const char **tail);
 121 int dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
 122     const char *tail, void *tag, dsl_dir_t **);
 123 void dsl_dir_name(dsl_dir_t *dd, char *buf);
 124 int dsl_dir_namelen(dsl_dir_t *dd);
 125 uint64_t dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds,
 126     const char *name, dmu_tx_t *tx);
 127 void dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv);
 128 uint64_t dsl_dir_space_available(dsl_dir_t *dd,
 129     dsl_dir_t *ancestor, int64_t delta, int ondiskonly);
 130 void dsl_dir_dirty(dsl_dir_t *dd, dmu_tx_t *tx);
 131 void dsl_dir_sync(dsl_dir_t *dd, dmu_tx_t *tx);
 132 int dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t mem,
 133     uint64_t asize, uint64_t fsize, uint64_t usize, void **tr_cookiep,
 134     dmu_tx_t *tx);
 135 void dsl_dir_tempreserve_clear(void *tr_cookie, dmu_tx_t *tx);
 136 void dsl_dir_willuse_space(dsl_dir_t *dd, int64_t space, dmu_tx_t *tx);
 137 void dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type,