Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/spa.c
          +++ new/usr/src/uts/common/fs/zfs/spa.c
↓ open down ↓ 2948 lines elided ↑ open up ↑
2949 2949          ASSERT(spa_config_held(spa, SCL_CONFIG, RW_READER));
2950 2950          VERIFY(nvlist_alloc(&features, NV_UNIQUE_NAME, KM_SLEEP) == 0);
2951 2951  
2952 2952          if (spa->spa_feat_for_read_obj != 0) {
2953 2953                  for (zap_cursor_init(&zc, spa->spa_meta_objset,
2954 2954                      spa->spa_feat_for_read_obj);
2955 2955                      zap_cursor_retrieve(&zc, &za) == 0;
2956 2956                      zap_cursor_advance(&zc)) {
2957 2957                          ASSERT(za.za_integer_length == sizeof (uint64_t) &&
2958 2958                              za.za_num_integers == 1);
2959      -                        VERIFY3U(0, ==, nvlist_add_uint64(features, za.za_name,
     2959 +                        VERIFY0(nvlist_add_uint64(features, za.za_name,
2960 2960                              za.za_first_integer));
2961 2961                  }
2962 2962                  zap_cursor_fini(&zc);
2963 2963          }
2964 2964  
2965 2965          if (spa->spa_feat_for_write_obj != 0) {
2966 2966                  for (zap_cursor_init(&zc, spa->spa_meta_objset,
2967 2967                      spa->spa_feat_for_write_obj);
2968 2968                      zap_cursor_retrieve(&zc, &za) == 0;
2969 2969                      zap_cursor_advance(&zc)) {
2970 2970                          ASSERT(za.za_integer_length == sizeof (uint64_t) &&
2971 2971                              za.za_num_integers == 1);
2972      -                        VERIFY3U(0, ==, nvlist_add_uint64(features, za.za_name,
     2972 +                        VERIFY0(nvlist_add_uint64(features, za.za_name,
2973 2973                              za.za_first_integer));
2974 2974                  }
2975 2975                  zap_cursor_fini(&zc);
2976 2976          }
2977 2977  
2978 2978          VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS,
2979 2979              features) == 0);
2980 2980          nvlist_free(features);
2981 2981  }
2982 2982  
↓ open down ↓ 420 lines elided ↑ open up ↑
3403 3403           * keeps changing.
3404 3404           */
3405 3405          obj = bpobj_alloc(spa->spa_meta_objset, 1 << 14, tx);
3406 3406          dmu_object_set_compress(spa->spa_meta_objset, obj,
3407 3407              ZIO_COMPRESS_OFF, tx);
3408 3408          if (zap_add(spa->spa_meta_objset,
3409 3409              DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_SYNC_BPOBJ,
3410 3410              sizeof (uint64_t), 1, &obj, tx) != 0) {
3411 3411                  cmn_err(CE_PANIC, "failed to add bpobj");
3412 3412          }
3413      -        VERIFY3U(0, ==, bpobj_open(&spa->spa_deferred_bpobj,
     3413 +        VERIFY0(bpobj_open(&spa->spa_deferred_bpobj,
3414 3414              spa->spa_meta_objset, obj));
3415 3415  
3416 3416          /*
3417 3417           * Create the pool's history object.
3418 3418           */
3419 3419          if (version >= SPA_VERSION_ZPOOL_HISTORY)
3420 3420                  spa_history_create_obj(spa, tx);
3421 3421  
3422 3422          /*
3423 3423           * Set pool properties.
↓ open down ↓ 1554 lines elided ↑ open up ↑
4978 4978                  error = ENOTSUP;
4979 4979          }
4980 4980  
4981 4981          if (error)
4982 4982                  return (error);
4983 4983  
4984 4984          /*
4985 4985           * The evacuation succeeded.  Remove any remaining MOS metadata
4986 4986           * associated with this vdev, and wait for these changes to sync.
4987 4987           */
4988      -        ASSERT3U(vd->vdev_stat.vs_alloc, ==, 0);
     4988 +        ASSERT0(vd->vdev_stat.vs_alloc);
4989 4989          txg = spa_vdev_config_enter(spa);
4990 4990          vd->vdev_removing = B_TRUE;
4991 4991          vdev_dirty(vd, 0, NULL, txg);
4992 4992          vdev_config_dirty(vd);
4993 4993          spa_vdev_config_exit(spa, NULL, txg, 0, FTAG);
4994 4994  
4995 4995          return (0);
4996 4996  }
4997 4997  
4998 4998  /*
↓ open down ↓ 726 lines elided ↑ open up ↑
5725 5725                  zfeature_info_t *feature;
5726 5726  
5727 5727                  switch (prop = zpool_name_to_prop(nvpair_name(elem))) {
5728 5728                  case ZPROP_INVAL:
5729 5729                          /*
5730 5730                           * We checked this earlier in spa_prop_validate().
5731 5731                           */
5732 5732                          ASSERT(zpool_prop_feature(nvpair_name(elem)));
5733 5733  
5734 5734                          fname = strchr(nvpair_name(elem), '@') + 1;
5735      -                        VERIFY3U(0, ==, zfeature_lookup_name(fname, &feature));
     5735 +                        VERIFY0(zfeature_lookup_name(fname, &feature));
5736 5736  
5737 5737                          spa_feature_enable(spa, feature, tx);
5738 5738                          spa_history_log_internal(spa, "set", tx,
5739 5739                              "%s=enabled", nvpair_name(elem));
5740 5740                          break;
5741 5741  
5742 5742                  case ZPOOL_PROP_VERSION:
5743 5743                          VERIFY(nvpair_value_uint64(elem, &intval) == 0);
5744 5744                          /*
5745 5745                           * The version is synced seperatly before other
↓ open down ↓ 224 lines elided ↑ open up ↑
5970 5970           * system.
5971 5971           */
5972 5972          if (!txg_list_empty(&dp->dp_dirty_datasets, txg) ||
5973 5973              !txg_list_empty(&dp->dp_dirty_dirs, txg) ||
5974 5974              !txg_list_empty(&dp->dp_sync_tasks, txg) ||
5975 5975              ((dsl_scan_active(dp->dp_scan) ||
5976 5976              txg_sync_waiting(dp)) && !spa_shutting_down(spa))) {
5977 5977                  zio_t *zio = zio_root(spa, NULL, NULL, 0);
5978 5978                  VERIFY3U(bpobj_iterate(defer_bpo,
5979 5979                      spa_free_sync_cb, zio, tx), ==, 0);
5980      -                VERIFY3U(zio_wait(zio), ==, 0);
     5980 +                VERIFY0(zio_wait(zio));
5981 5981          }
5982 5982  
5983 5983          /*
5984 5984           * Iterate to convergence.
5985 5985           */
5986 5986          do {
5987 5987                  int pass = ++spa->spa_sync_pass;
5988 5988  
5989 5989                  spa_sync_config_object(spa, tx);
5990 5990                  spa_sync_aux_dev(spa, &spa->spa_spares, tx,
↓ open down ↓ 336 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX