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/dsl_prop.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_prop.c
↓ open down ↓ 159 lines elided ↑ open up ↑
 160  160  dsl_prop_get_ds(dsl_dataset_t *ds, const char *propname,
 161  161      int intsz, int numints, void *buf, char *setpoint)
 162  162  {
 163  163          zfs_prop_t prop = zfs_name_to_prop(propname);
 164  164          boolean_t inheritable;
 165  165          boolean_t snapshot;
 166  166          uint64_t zapobj;
 167  167  
 168  168          ASSERT(dsl_pool_config_held(ds->ds_dir->dd_pool));
 169  169          inheritable = (prop == ZPROP_INVAL || zfs_prop_inheritable(prop));
 170      -        snapshot = (ds->ds_phys != NULL && dsl_dataset_is_snapshot(ds));
 171      -        zapobj = (ds->ds_phys == NULL ? 0 : ds->ds_phys->ds_props_obj);
      170 +        snapshot = (DS_HAS_PHYS(ds) && dsl_dataset_is_snapshot(ds));
      171 +        zapobj = (DS_HAS_PHYS(ds) ? ds->ds_phys->ds_props_obj : 0);
 172  172  
 173  173          if (zapobj != 0) {
 174  174                  objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset;
 175  175                  int err;
 176  176  
 177  177                  ASSERT(snapshot);
 178  178  
 179  179                  /* Check for a local value. */
 180  180                  err = zap_lookup(mos, zapobj, propname, intsz, numints, buf);
 181  181                  if (err != ENOENT) {
↓ open down ↓ 354 lines elided ↑ open up ↑
 536  536          char valbuf[32];
 537  537          const char *valstr = NULL;
 538  538          char *inheritstr;
 539  539          char *recvdstr;
 540  540          char *tbuf = NULL;
 541  541          int err;
 542  542          uint64_t version = spa_version(ds->ds_dir->dd_pool->dp_spa);
 543  543  
 544  544          isint = (dodefault(propname, 8, 1, &intval) == 0);
 545  545  
 546      -        if (ds->ds_phys != NULL && dsl_dataset_is_snapshot(ds)) {
      546 +        if (DS_HAS_PHYS(ds) && dsl_dataset_is_snapshot(ds)) {
 547  547                  ASSERT(version >= SPA_VERSION_SNAP_PROPS);
 548  548                  if (ds->ds_phys->ds_props_obj == 0) {
 549  549                          dmu_buf_will_dirty(ds->ds_dbuf, tx);
 550  550                          ds->ds_phys->ds_props_obj =
 551  551                              zap_create(mos,
 552  552                              DMU_OT_DSL_PROPS, DMU_OT_NONE, 0, tx);
 553  553                  }
 554  554                  zapobj = ds->ds_phys->ds_props_obj;
 555  555          } else {
 556  556                  zapobj = ds->ds_dir->dd_phys->dd_props_zapobj;
↓ open down ↓ 80 lines elided ↑ open up ↑
 637  637          default:
 638  638                  cmn_err(CE_PANIC, "unexpected property source: %d", source);
 639  639          }
 640  640  
 641  641          strfree(inheritstr);
 642  642          strfree(recvdstr);
 643  643  
 644  644          if (isint) {
 645  645                  VERIFY0(dsl_prop_get_int_ds(ds, propname, &intval));
 646  646  
 647      -                if (ds->ds_phys != NULL && dsl_dataset_is_snapshot(ds)) {
      647 +                if (DS_HAS_PHYS(ds) && dsl_dataset_is_snapshot(ds)) {
 648  648                          dsl_prop_cb_record_t *cbr;
 649  649                          /*
 650  650                           * It's a snapshot; nothing can inherit this
 651  651                           * property, so just look for callbacks on this
 652  652                           * ds here.
 653  653                           */
 654  654                          mutex_enter(&ds->ds_dir->dd_lock);
 655  655                          for (cbr = list_head(&ds->ds_dir->dd_prop_cbs); cbr;
 656  656                              cbr = list_next(&ds->ds_dir->dd_prop_cbs, cbr)) {
 657  657                                  if (cbr->cbr_ds == ds &&
↓ open down ↓ 472 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX