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/dsl_dir.h
          +++ new/usr/src/uts/common/fs/zfs/sys/dsl_dir.h
↓ open down ↓ 66 lines elided ↑ open up ↑
  67   67          /* Administrative reservation setting */
  68   68          uint64_t dd_reserved;
  69   69          uint64_t dd_props_zapobj;
  70   70          uint64_t dd_deleg_zapobj; /* dataset delegation permissions */
  71   71          uint64_t dd_flags;
  72   72          uint64_t dd_used_breakdown[DD_USED_NUM];
  73   73          uint64_t dd_clones; /* dsl_dir objects */
  74   74          uint64_t dd_pad[13]; /* pad out to 256 bytes for good measure */
  75   75  } dsl_dir_phys_t;
  76   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 +
  77   82  struct dsl_dir {
       83 +        dmu_buf_user_t db_evict;
       84 +
  78   85          /* These are immutable; no lock needed: */
  79   86          uint64_t dd_object;
  80      -        dsl_dir_phys_t *dd_phys;
  81      -        dmu_buf_t *dd_dbuf;
       87 +        union {
       88 +                dmu_buf_t *dd_dmu_db;
       89 +                dsl_dir_dbuf_t *dd_db;
       90 +        } dd_db_u;
  82   91          dsl_pool_t *dd_pool;
  83   92  
  84   93          /* protected by lock on pool's dp_dirty_dirs list */
  85   94          txg_node_t dd_dirty_link;
  86   95  
  87   96          /* protected by dp_config_rwlock */
  88   97          dsl_dir_t *dd_parent;
  89   98  
  90   99          /* Protected by dd_lock */
  91  100          kmutex_t dd_lock;
↓ open down ↓ 3 lines elided ↑ open up ↑
  95  104  
  96  105          /* gross estimate of space used by in-flight tx's */
  97  106          uint64_t dd_tempreserved[TXG_SIZE];
  98  107          /* amount of space we expect to write; == amount of dirty data */
  99  108          int64_t dd_space_towrite[TXG_SIZE];
 100  109  
 101  110          /* protected by dd_lock; keep at end of struct for better locality */
 102  111          char dd_myname[MAXNAMELEN];
 103  112  };
 104  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 +
 105  118  void dsl_dir_rele(dsl_dir_t *dd, void *tag);
 106  119  int dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
 107  120      dsl_dir_t **, const char **tail);
 108  121  int dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
 109  122      const char *tail, void *tag, dsl_dir_t **);
 110  123  void dsl_dir_name(dsl_dir_t *dd, char *buf);
 111  124  int dsl_dir_namelen(dsl_dir_t *dd);
 112  125  uint64_t dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds,
 113  126      const char *name, dmu_tx_t *tx);
 114  127  void dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv);
↓ open down ↓ 52 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX