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/cmd/zdb/zdb.c
          +++ new/usr/src/cmd/zdb/zdb.c
↓ open down ↓ 555 lines elided ↑ open up ↑
 556  556          }
 557  557          for (int c = 0; c < vd->vdev_children; c++)
 558  558                  refcount += get_metaslab_refcount(vd->vdev_child[c]);
 559  559  
 560  560          return (refcount);
 561  561  }
 562  562  
 563  563  static int
 564  564  verify_spacemap_refcounts(spa_t *spa)
 565  565  {
 566      -        int expected_refcount, actual_refcount;
      566 +        uint64_t expected_refcount = 0;
      567 +        uint64_t actual_refcount;
 567  568  
 568      -        expected_refcount = spa_feature_get_refcount(spa,
 569      -            &spa_feature_table[SPA_FEATURE_SPACEMAP_HISTOGRAM]);
      569 +        (void) feature_get_refcount(spa,
      570 +            &spa_feature_table[SPA_FEATURE_SPACEMAP_HISTOGRAM],
      571 +            &expected_refcount);
 570  572          actual_refcount = get_dtl_refcount(spa->spa_root_vdev);
 571  573          actual_refcount += get_metaslab_refcount(spa->spa_root_vdev);
 572  574  
 573  575          if (expected_refcount != actual_refcount) {
 574      -                (void) printf("space map refcount mismatch: expected %d != "
 575      -                    "actual %d\n", expected_refcount, actual_refcount);
      576 +                (void) printf("space map refcount mismatch: expected %lld != "
      577 +                    "actual %lld\n",
      578 +                    (longlong_t)expected_refcount,
      579 +                    (longlong_t)actual_refcount);
 576  580                  return (2);
 577  581          }
 578  582          return (0);
 579  583  }
 580  584  
 581  585  static void
 582  586  dump_spacemap(objset_t *os, space_map_t *sm)
 583  587  {
 584  588          uint64_t alloc, offset, entry;
 585  589          char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID",
↓ open down ↓ 81 lines elided ↑ open up ↑
 667  671                  if (!msp->ms_loaded) {
 668  672                          VERIFY0(metaslab_load(msp));
 669  673                          range_tree_stat_verify(msp->ms_tree);
 670  674                  }
 671  675                  dump_metaslab_stats(msp);
 672  676                  metaslab_unload(msp);
 673  677                  mutex_exit(&msp->ms_lock);
 674  678          }
 675  679  
 676  680          if (dump_opt['m'] > 1 && sm != NULL &&
 677      -            spa_feature_is_active(spa,
 678      -            &spa_feature_table[SPA_FEATURE_SPACEMAP_HISTOGRAM])) {
      681 +            spa_feature_is_active(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM)) {
 679  682                  /*
 680  683                   * The space map histogram represents free space in chunks
 681  684                   * of sm_shift (i.e. bucket 0 refers to 2^sm_shift).
 682  685                   */
 683  686                  (void) printf("\tOn-disk histogram:\n");
 684  687                  dump_histogram(sm->sm_phys->smp_histogram,
 685  688                      SPACE_MAP_HISTOGRAM_SIZE(sm), sm->sm_shift);
 686  689          }
 687  690  
 688  691          if (dump_opt['d'] > 5 || dump_opt['m'] > 3) {
↓ open down ↓ 1770 lines elided ↑ open up ↑
2459 2462  
2460 2463          /*
2461 2464           * If there's a deferred-free bplist, process that first.
2462 2465           */
2463 2466          (void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj,
2464 2467              count_block_cb, &zcb, NULL);
2465 2468          if (spa_version(spa) >= SPA_VERSION_DEADLISTS) {
2466 2469                  (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj,
2467 2470                      count_block_cb, &zcb, NULL);
2468 2471          }
2469      -        if (spa_feature_is_active(spa,
2470      -            &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
     2472 +        if (spa_feature_is_active(spa, SPA_FEATURE_ASYNC_DESTROY)) {
2471 2473                  VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset,
2472 2474                      spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb,
2473 2475                      &zcb, NULL));
2474 2476          }
2475 2477  
2476 2478          if (dump_opt['c'] > 1)
2477 2479                  flags |= TRAVERSE_PREFETCH_DATA;
2478 2480  
2479 2481          zcb.zcb_totalasize = metaslab_class_get_alloc(spa_normal_class(spa));
2480 2482          zcb.zcb_start = zcb.zcb_lastprint = gethrtime();
↓ open down ↓ 305 lines elided ↑ open up ↑
2786 2788                  dump_dir(dp->dp_meta_objset);
2787 2789                  if (dump_opt['d'] >= 3) {
2788 2790                          dump_bpobj(&spa->spa_deferred_bpobj,
2789 2791                              "Deferred frees", 0);
2790 2792                          if (spa_version(spa) >= SPA_VERSION_DEADLISTS) {
2791 2793                                  dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj,
2792 2794                                      "Pool snapshot frees", 0);
2793 2795                          }
2794 2796  
2795 2797                          if (spa_feature_is_active(spa,
2796      -                            &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
     2798 +                            SPA_FEATURE_ASYNC_DESTROY)) {
2797 2799                                  dump_bptree(spa->spa_meta_objset,
2798 2800                                      spa->spa_dsl_pool->dp_bptree_obj,
2799 2801                                      "Pool dataset frees");
2800 2802                          }
2801 2803                          dump_dtl(spa->spa_root_vdev, 0);
2802 2804                  }
2803 2805                  (void) dmu_objset_find(spa_name(spa), dump_one_dir,
2804 2806                      NULL, DS_FIND_SNAPSHOTS | DS_FIND_CHILDREN);
2805 2807          }
2806 2808          if (dump_opt['b'] || dump_opt['c'])
↓ open down ↓ 693 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX