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_dataset.h
          +++ new/usr/src/uts/common/fs/zfs/sys/dsl_dataset.h
↓ open down ↓ 37 lines elided ↑ open up ↑
  38   38  #include <sys/refcount.h>
  39   39  
  40   40  #ifdef  __cplusplus
  41   41  extern "C" {
  42   42  #endif
  43   43  
  44   44  struct dsl_dataset;
  45   45  struct dsl_dir;
  46   46  struct dsl_pool;
  47   47  
       48 +#define DS_HAS_PHYS(ds) \
       49 +        ((ds)->ds_dbuf != NULL && (ds)->ds_dbuf->db_data != NULL)
       50 +
  48   51  #define DS_FLAG_INCONSISTENT    (1ULL<<0)
  49   52  #define DS_IS_INCONSISTENT(ds)  \
  50   53          ((ds)->ds_phys->ds_flags & DS_FLAG_INCONSISTENT)
  51   54  /*
  52   55   * Note: nopromote can not yet be set, but we want support for it in this
  53   56   * on-disk version, so that we don't need to upgrade for it later.
  54   57   */
  55   58  #define DS_FLAG_NOPROMOTE       (1ULL<<1)
  56   59  
  57   60  /*
↓ open down ↓ 46 lines elided ↑ open up ↑
 104  107          uint64_t ds_fsid_guid;
 105  108          uint64_t ds_guid;
 106  109          uint64_t ds_flags;              /* DS_FLAG_* */
 107  110          blkptr_t ds_bp;
 108  111          uint64_t ds_next_clones_obj;    /* DMU_OT_DSL_CLONES */
 109  112          uint64_t ds_props_obj;          /* DMU_OT_DSL_PROPS for snaps */
 110  113          uint64_t ds_userrefs_obj;       /* DMU_OT_USERREFS */
 111  114          uint64_t ds_pad[5]; /* pad out to 320 bytes for good measure */
 112  115  } dsl_dataset_phys_t;
 113  116  
      117 +typedef struct dsl_dataset_dbuf {
      118 +        uint8_t dsdb_pad[offsetof(dmu_buf_t, db_data)];
      119 +        dsl_dataset_phys_t *dsdb_data;
      120 +} dsl_dataset_dbuf_t;
      121 +
 114  122  typedef struct dsl_dataset {
      123 +        dmu_buf_user_t db_evict;
      124 +
 115  125          /* Immutable: */
 116  126          struct dsl_dir *ds_dir;
 117      -        dsl_dataset_phys_t *ds_phys;
 118      -        dmu_buf_t *ds_dbuf;
      127 +        union {
      128 +                dmu_buf_t *ds_dmu_db;
      129 +                dsl_dataset_dbuf_t *ds_db;
      130 +        } ds_db_u;
 119  131          uint64_t ds_object;
 120  132          uint64_t ds_fsid_guid;
 121  133  
 122  134          /* only used in syncing context, only valid for non-snapshots: */
 123  135          struct dsl_dataset *ds_prev;
 124  136  
 125  137          /* has internal locking: */
 126  138          dsl_deadlist_t ds_deadlist;
 127  139          bplist_t ds_pending_deadlist;
 128  140  
↓ open down ↓ 27 lines elided ↑ open up ↑
 156  168          uint64_t ds_reserved;   /* cached refreservation */
 157  169          uint64_t ds_quota;      /* cached refquota */
 158  170  
 159  171          kmutex_t ds_sendstream_lock;
 160  172          list_t ds_sendstreams;
 161  173  
 162  174          /* Protected by ds_lock; keep at end of struct for better locality */
 163  175          char ds_snapname[MAXNAMELEN];
 164  176  } dsl_dataset_t;
 165  177  
      178 +/* See sys/dmu.h:dmu_buf_user_t for why we have these. */
      179 +#define ds_dbuf ds_db_u.ds_dmu_db
      180 +#define ds_phys ds_db_u.ds_db->dsdb_data
      181 +
      182 +struct dsl_ds_destroyarg {
      183 +        dsl_dataset_t *ds;              /* ds to destroy */
      184 +        dsl_dataset_t *rm_origin;       /* also remove our origin? */
      185 +        boolean_t is_origin_rm;         /* set if removing origin snap */
      186 +        boolean_t defer;                /* destroy -d requested? */
      187 +        boolean_t releasing;            /* destroying due to release? */
      188 +        boolean_t need_prep;            /* do we need to retry due to EBUSY? */
      189 +};
      190 +
 166  191  /*
 167  192   * The max length of a temporary tag prefix is the number of hex digits
 168  193   * required to express UINT64_MAX plus one for the hyphen.
 169  194   */
 170  195  #define MAX_TAG_PREFIX_LEN      17
 171  196  
 172  197  #define dsl_dataset_is_snapshot(ds) \
 173  198          ((ds)->ds_phys->ds_num_children != 0)
 174  199  
 175  200  #define DS_UNIQUE_IS_ACCURATE(ds)       \
↓ open down ↓ 112 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX