Print this page
4171 clean up spa_feature_*() interfaces
4172 implement extensible_dataset feature for use by other zpool features
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/bpobj.c
          +++ new/usr/src/uts/common/fs/zfs/bpobj.c
↓ open down ↓ 28 lines elided ↑ open up ↑
  29   29  #include <sys/dsl_pool.h>
  30   30  #include <sys/zfeature.h>
  31   31  #include <sys/zap.h>
  32   32  
  33   33  /*
  34   34   * Return an empty bpobj, preferably the empty dummy one (dp_empty_bpobj).
  35   35   */
  36   36  uint64_t
  37   37  bpobj_alloc_empty(objset_t *os, int blocksize, dmu_tx_t *tx)
  38   38  {
  39      -        zfeature_info_t *empty_bpobj_feat =
  40      -            &spa_feature_table[SPA_FEATURE_EMPTY_BPOBJ];
  41   39          spa_t *spa = dmu_objset_spa(os);
  42   40          dsl_pool_t *dp = dmu_objset_pool(os);
  43   41  
  44      -        if (spa_feature_is_enabled(spa, empty_bpobj_feat)) {
  45      -                if (!spa_feature_is_active(spa, empty_bpobj_feat)) {
       42 +        if (spa_feature_is_enabled(spa, SPA_FEATURE_EMPTY_BPOBJ)) {
       43 +                if (!spa_feature_is_active(spa, SPA_FEATURE_EMPTY_BPOBJ)) {
  46   44                          ASSERT0(dp->dp_empty_bpobj);
  47   45                          dp->dp_empty_bpobj =
  48   46                              bpobj_alloc(os, SPA_MAXBLOCKSIZE, tx);
  49   47                          VERIFY(zap_add(os,
  50   48                              DMU_POOL_DIRECTORY_OBJECT,
  51   49                              DMU_POOL_EMPTY_BPOBJ, sizeof (uint64_t), 1,
  52   50                              &dp->dp_empty_bpobj, tx) == 0);
  53   51                  }
  54      -                spa_feature_incr(spa, empty_bpobj_feat, tx);
       52 +                spa_feature_incr(spa, SPA_FEATURE_EMPTY_BPOBJ, tx);
  55   53                  ASSERT(dp->dp_empty_bpobj != 0);
  56   54                  return (dp->dp_empty_bpobj);
  57   55          } else {
  58   56                  return (bpobj_alloc(os, blocksize, tx));
  59   57          }
  60   58  }
  61   59  
  62   60  void
  63   61  bpobj_decr_empty(objset_t *os, dmu_tx_t *tx)
  64   62  {
  65      -        zfeature_info_t *empty_bpobj_feat =
  66      -            &spa_feature_table[SPA_FEATURE_EMPTY_BPOBJ];
  67   63          dsl_pool_t *dp = dmu_objset_pool(os);
  68   64  
  69      -        spa_feature_decr(dmu_objset_spa(os), empty_bpobj_feat, tx);
  70      -        if (!spa_feature_is_active(dmu_objset_spa(os), empty_bpobj_feat)) {
       65 +        spa_feature_decr(dmu_objset_spa(os), SPA_FEATURE_EMPTY_BPOBJ, tx);
       66 +        if (!spa_feature_is_active(dmu_objset_spa(os),
       67 +            SPA_FEATURE_EMPTY_BPOBJ)) {
  71   68                  VERIFY3U(0, ==, zap_remove(dp->dp_meta_objset,
  72   69                      DMU_POOL_DIRECTORY_OBJECT,
  73   70                      DMU_POOL_EMPTY_BPOBJ, tx));
  74   71                  VERIFY3U(0, ==, dmu_object_free(os, dp->dp_empty_bpobj, tx));
  75   72                  dp->dp_empty_bpobj = 0;
  76   73          }
  77   74  }
  78   75  
  79   76  uint64_t
  80   77  bpobj_alloc(objset_t *os, int blocksize, dmu_tx_t *tx)
↓ open down ↓ 177 lines elided ↑ open up ↑
 258  255          }
 259  256          if (err || !bpo->bpo_havesubobj || bpo->bpo_phys->bpo_subobjs == 0)
 260  257                  goto out;
 261  258  
 262  259          ASSERT(bpo->bpo_havecomp);
 263  260          err = dmu_object_info(bpo->bpo_os, bpo->bpo_phys->bpo_subobjs, &doi);
 264  261          if (err) {
 265  262                  mutex_exit(&bpo->bpo_lock);
 266  263                  return (err);
 267  264          }
      265 +        ASSERT3U(doi.doi_type, ==, DMU_OT_BPOBJ_SUBOBJ);
 268  266          epb = doi.doi_data_block_size / sizeof (uint64_t);
 269  267  
 270  268          for (i = bpo->bpo_phys->bpo_num_subobjs - 1; i >= 0; i--) {
 271  269                  uint64_t *objarray;
 272  270                  uint64_t offset, blkoff;
 273  271                  bpobj_t sublist;
 274  272                  uint64_t used_before, comp_before, uncomp_before;
 275  273                  uint64_t used_after, comp_after, uncomp_after;
 276  274  
 277  275                  offset = i * sizeof (uint64_t);
↓ open down ↓ 289 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX