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

@@ -72,15 +72,24 @@
         uint64_t dd_used_breakdown[DD_USED_NUM];
         uint64_t dd_clones; /* dsl_dir objects */
         uint64_t dd_pad[13]; /* pad out to 256 bytes for good measure */
 } dsl_dir_phys_t;
 
+typedef struct dsl_dir_dbuf {
+        uint8_t dddb_pad[offsetof(dmu_buf_t, db_data)];
+        dsl_dir_phys_t *dddb_data;
+} dsl_dir_dbuf_t;
+
 struct dsl_dir {
+        dmu_buf_user_t db_evict;
+
         /* These are immutable; no lock needed: */
         uint64_t dd_object;
-        dsl_dir_phys_t *dd_phys;
-        dmu_buf_t *dd_dbuf;
+        union {
+                dmu_buf_t *dd_dmu_db;
+                dsl_dir_dbuf_t *dd_db;
+        } dd_db_u;
         dsl_pool_t *dd_pool;
 
         /* protected by lock on pool's dp_dirty_dirs list */
         txg_node_t dd_dirty_link;
 

@@ -100,10 +109,14 @@
 
         /* protected by dd_lock; keep at end of struct for better locality */
         char dd_myname[MAXNAMELEN];
 };
 
+/* See sys/dmu.h:dmu_buf_user_t for why we have these. */
+#define dd_dbuf dd_db_u.dd_dmu_db
+#define dd_phys dd_db_u.dd_db->dddb_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);
 int dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
     const char *tail, void *tag, dsl_dir_t **);