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/dsl_pool.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_pool.c
↓ open down ↓ 162 lines elided ↑ open up ↑
 163  163          if (spa_version(dp->dp_spa) >= SPA_VERSION_DEADLISTS) {
 164  164                  err = dsl_pool_open_special_dir(dp, FREE_DIR_NAME,
 165  165                      &dp->dp_free_dir);
 166  166                  if (err)
 167  167                          goto out;
 168  168  
 169  169                  err = zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
 170  170                      DMU_POOL_FREE_BPOBJ, sizeof (uint64_t), 1, &obj);
 171  171                  if (err)
 172  172                          goto out;
 173      -                VERIFY3U(0, ==, bpobj_open(&dp->dp_free_bpobj,
      173 +                VERIFY0(bpobj_open(&dp->dp_free_bpobj,
 174  174                      dp->dp_meta_objset, obj));
 175  175          }
 176  176  
 177  177          if (spa_feature_is_active(dp->dp_spa,
 178  178              &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
 179  179                  err = zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
 180  180                      DMU_POOL_BPTREE_OBJ, sizeof (uint64_t), 1,
 181  181                      &dp->dp_bptree_obj);
 182  182                  if (err != 0)
 183  183                          goto out;
↓ open down ↓ 65 lines elided ↑ open up ↑
 249  249          dsl_dataset_t *ds;
 250  250          uint64_t obj;
 251  251  
 252  252          /* create and open the MOS (meta-objset) */
 253  253          dp->dp_meta_objset = dmu_objset_create_impl(spa,
 254  254              NULL, &dp->dp_meta_rootbp, DMU_OST_META, tx);
 255  255  
 256  256          /* create the pool directory */
 257  257          err = zap_create_claim(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
 258  258              DMU_OT_OBJECT_DIRECTORY, DMU_OT_NONE, 0, tx);
 259      -        ASSERT3U(err, ==, 0);
      259 +        ASSERT0(err);
 260  260  
 261  261          /* Initialize scan structures */
 262      -        VERIFY3U(0, ==, dsl_scan_init(dp, txg));
      262 +        VERIFY0(dsl_scan_init(dp, txg));
 263  263  
 264  264          /* create and open the root dir */
 265  265          dp->dp_root_dir_obj = dsl_dir_create_sync(dp, NULL, NULL, tx);
 266  266          VERIFY(0 == dsl_dir_open_obj(dp, dp->dp_root_dir_obj,
 267  267              NULL, dp, &dp->dp_root_dir));
 268  268  
 269  269          /* create and open the meta-objset dir */
 270  270          (void) dsl_dir_create_sync(dp, dp->dp_root_dir, MOS_DIR_NAME, tx);
 271  271          VERIFY(0 == dsl_pool_open_special_dir(dp,
 272  272              MOS_DIR_NAME, &dp->dp_mos_dir));
↓ open down ↓ 2 lines elided ↑ open up ↑
 275  275                  /* create and open the free dir */
 276  276                  (void) dsl_dir_create_sync(dp, dp->dp_root_dir,
 277  277                      FREE_DIR_NAME, tx);
 278  278                  VERIFY(0 == dsl_pool_open_special_dir(dp,
 279  279                      FREE_DIR_NAME, &dp->dp_free_dir));
 280  280  
 281  281                  /* create and open the free_bplist */
 282  282                  obj = bpobj_alloc(dp->dp_meta_objset, SPA_MAXBLOCKSIZE, tx);
 283  283                  VERIFY(zap_add(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
 284  284                      DMU_POOL_FREE_BPOBJ, sizeof (uint64_t), 1, &obj, tx) == 0);
 285      -                VERIFY3U(0, ==, bpobj_open(&dp->dp_free_bpobj,
      285 +                VERIFY0(bpobj_open(&dp->dp_free_bpobj,
 286  286                      dp->dp_meta_objset, obj));
 287  287          }
 288  288  
 289  289          if (spa_version(spa) >= SPA_VERSION_DSL_SCRUB)
 290  290                  dsl_pool_create_origin(dp, tx);
 291  291  
 292  292          /* create the root dataset */
 293  293          obj = dsl_dataset_create_sync_dd(dp->dp_root_dir, NULL, 0, tx);
 294  294  
 295  295          /* create the root objset */
↓ open down ↓ 371 lines elided ↑ open up ↑
 667  667                  dsl_dataset_rele(prev, FTAG);
 668  668          return (0);
 669  669  }
 670  670  
 671  671  void
 672  672  dsl_pool_upgrade_clones(dsl_pool_t *dp, dmu_tx_t *tx)
 673  673  {
 674  674          ASSERT(dmu_tx_is_syncing(tx));
 675  675          ASSERT(dp->dp_origin_snap != NULL);
 676  676  
 677      -        VERIFY3U(0, ==, dmu_objset_find_spa(dp->dp_spa, NULL, upgrade_clones_cb,
      677 +        VERIFY0(dmu_objset_find_spa(dp->dp_spa, NULL, upgrade_clones_cb,
 678  678              tx, DS_FIND_CHILDREN));
 679  679  }
 680  680  
 681  681  /* ARGSUSED */
 682  682  static int
 683  683  upgrade_dir_clones_cb(spa_t *spa, uint64_t dsobj, const char *dsname, void *arg)
 684  684  {
 685  685          dmu_tx_t *tx = arg;
 686  686          dsl_dataset_t *ds;
 687  687          dsl_pool_t *dp = spa_get_dsl(spa);
 688  688          objset_t *mos = dp->dp_meta_objset;
 689  689  
 690      -        VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
      690 +        VERIFY0(dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
 691  691  
 692  692          if (ds->ds_dir->dd_phys->dd_origin_obj) {
 693  693                  dsl_dataset_t *origin;
 694  694  
 695      -                VERIFY3U(0, ==, dsl_dataset_hold_obj(dp,
      695 +                VERIFY0(dsl_dataset_hold_obj(dp,
 696  696                      ds->ds_dir->dd_phys->dd_origin_obj, FTAG, &origin));
 697  697  
 698  698                  if (origin->ds_dir->dd_phys->dd_clones == 0) {
 699  699                          dmu_buf_will_dirty(origin->ds_dir->dd_dbuf, tx);
 700  700                          origin->ds_dir->dd_phys->dd_clones = zap_create(mos,
 701  701                              DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
 702  702                  }
 703  703  
 704      -                VERIFY3U(0, ==, zap_add_int(dp->dp_meta_objset,
      704 +                VERIFY0(zap_add_int(dp->dp_meta_objset,
 705  705                      origin->ds_dir->dd_phys->dd_clones, dsobj, tx));
 706  706  
 707  707                  dsl_dataset_rele(origin, FTAG);
 708  708          }
 709  709  
 710  710          dsl_dataset_rele(ds, FTAG);
 711  711          return (0);
 712  712  }
 713  713  
 714  714  void
↓ open down ↓ 6 lines elided ↑ open up ↑
 721  721          VERIFY(0 == dsl_pool_open_special_dir(dp,
 722  722              FREE_DIR_NAME, &dp->dp_free_dir));
 723  723  
 724  724          /*
 725  725           * We can't use bpobj_alloc(), because spa_version() still
 726  726           * returns the old version, and we need a new-version bpobj with
 727  727           * subobj support.  So call dmu_object_alloc() directly.
 728  728           */
 729  729          obj = dmu_object_alloc(dp->dp_meta_objset, DMU_OT_BPOBJ,
 730  730              SPA_MAXBLOCKSIZE, DMU_OT_BPOBJ_HDR, sizeof (bpobj_phys_t), tx);
 731      -        VERIFY3U(0, ==, zap_add(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
      731 +        VERIFY0(zap_add(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
 732  732              DMU_POOL_FREE_BPOBJ, sizeof (uint64_t), 1, &obj, tx));
 733      -        VERIFY3U(0, ==, bpobj_open(&dp->dp_free_bpobj,
      733 +        VERIFY0(bpobj_open(&dp->dp_free_bpobj,
 734  734              dp->dp_meta_objset, obj));
 735  735  
 736      -        VERIFY3U(0, ==, dmu_objset_find_spa(dp->dp_spa, NULL,
      736 +        VERIFY0(dmu_objset_find_spa(dp->dp_spa, NULL,
 737  737              upgrade_dir_clones_cb, tx, DS_FIND_CHILDREN));
 738  738  }
 739  739  
 740  740  void
 741  741  dsl_pool_create_origin(dsl_pool_t *dp, dmu_tx_t *tx)
 742  742  {
 743  743          uint64_t dsobj;
 744  744          dsl_dataset_t *ds;
 745  745  
 746  746          ASSERT(dmu_tx_is_syncing(tx));
↓ open down ↓ 121 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX