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/dsl_scan.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_scan.c
↓ open down ↓ 94 lines elided ↑ open up ↑
  95   95          scn = dp->dp_scan = kmem_zalloc(sizeof (dsl_scan_t), KM_SLEEP);
  96   96          scn->scn_dp = dp;
  97   97  
  98   98          /*
  99   99           * It's possible that we're resuming a scan after a reboot so
 100  100           * make sure that the scan_async_destroying flag is initialized
 101  101           * appropriately.
 102  102           */
 103  103          ASSERT(!scn->scn_async_destroying);
 104  104          scn->scn_async_destroying = spa_feature_is_active(dp->dp_spa,
 105      -            &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY]);
      105 +            SPA_FEATURE_ASYNC_DESTROY);
 106  106  
 107  107          err = zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
 108  108              "scrub_func", sizeof (uint64_t), 1, &f);
 109  109          if (err == 0) {
 110  110                  /*
 111  111                   * There was an old-style scrub in progress.  Restart a
 112  112                   * new-style scrub from the beginning.
 113  113                   */
 114  114                  scn->scn_restart_txg = txg;
 115  115                  zfs_dbgmsg("old-style scrub was in progress; "
↓ open down ↓ 1230 lines elided ↑ open up ↑
1346 1346  boolean_t
1347 1347  dsl_scan_active(dsl_scan_t *scn)
1348 1348  {
1349 1349          spa_t *spa = scn->scn_dp->dp_spa;
1350 1350          uint64_t used = 0, comp, uncomp;
1351 1351  
1352 1352          if (spa->spa_load_state != SPA_LOAD_NONE)
1353 1353                  return (B_FALSE);
1354 1354          if (spa_shutting_down(spa))
1355 1355                  return (B_FALSE);
1356      -
1357 1356          if (scn->scn_phys.scn_state == DSS_SCANNING ||
1358 1357              scn->scn_async_destroying)
1359 1358                  return (B_TRUE);
1360 1359  
1361 1360          if (spa_version(scn->scn_dp->dp_spa) >= SPA_VERSION_DEADLISTS) {
1362 1361                  (void) bpobj_space(&scn->scn_dp->dp_free_bpobj,
1363 1362                      &used, &comp, &uncomp);
1364 1363          }
1365 1364          return (used != 0);
1366 1365  }
↓ open down ↓ 38 lines elided ↑ open up ↑
1405 1404           */
1406 1405          if (spa_version(dp->dp_spa) >= SPA_VERSION_DEADLISTS) {
1407 1406                  scn->scn_is_bptree = B_FALSE;
1408 1407                  scn->scn_zio_root = zio_root(dp->dp_spa, NULL,
1409 1408                      NULL, ZIO_FLAG_MUSTSUCCEED);
1410 1409                  err = bpobj_iterate(&dp->dp_free_bpobj,
1411 1410                      dsl_scan_free_block_cb, scn, tx);
1412 1411                  VERIFY3U(0, ==, zio_wait(scn->scn_zio_root));
1413 1412  
1414 1413                  if (err == 0 && spa_feature_is_active(spa,
1415      -                    &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
     1414 +                    SPA_FEATURE_ASYNC_DESTROY)) {
1416 1415                          ASSERT(scn->scn_async_destroying);
1417 1416                          scn->scn_is_bptree = B_TRUE;
1418 1417                          scn->scn_zio_root = zio_root(dp->dp_spa, NULL,
1419 1418                              NULL, ZIO_FLAG_MUSTSUCCEED);
1420 1419                          err = bptree_iterate(dp->dp_meta_objset,
1421 1420                              dp->dp_bptree_obj, B_TRUE, dsl_scan_free_block_cb,
1422 1421                              scn, tx);
1423 1422                          VERIFY0(zio_wait(scn->scn_zio_root));
1424 1423  
1425 1424                          if (err == 0) {
1426      -                                zfeature_info_t *feat = &spa_feature_table
1427      -                                    [SPA_FEATURE_ASYNC_DESTROY];
1428 1425                                  /* finished; deactivate async destroy feature */
1429      -                                spa_feature_decr(spa, feat, tx);
1430      -                                ASSERT(!spa_feature_is_active(spa, feat));
     1426 +                                spa_feature_decr(spa, SPA_FEATURE_ASYNC_DESTROY,
     1427 +                                    tx);
     1428 +                                ASSERT(!spa_feature_is_active(spa,
     1429 +                                    SPA_FEATURE_ASYNC_DESTROY));
1431 1430                                  VERIFY0(zap_remove(dp->dp_meta_objset,
1432 1431                                      DMU_POOL_DIRECTORY_OBJECT,
1433 1432                                      DMU_POOL_BPTREE_OBJ, tx));
1434 1433                                  VERIFY0(bptree_free(dp->dp_meta_objset,
1435 1434                                      dp->dp_bptree_obj, tx));
1436 1435                                  dp->dp_bptree_obj = 0;
1437 1436                                  scn->scn_async_destroying = B_FALSE;
1438 1437                          }
1439 1438                  }
1440 1439                  if (scn->scn_visited_this_txg) {
↓ open down ↓ 291 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX