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_scan.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_scan.c
↓ open down ↓ 834 lines elided ↑ open up ↑
 835  835                  } else {
 836  836                          SET_BOOKMARK(&scn->scn_phys.scn_bookmark,
 837  837                              ZB_DESTROYED_OBJSET, 0, 0, 0);
 838  838                          zfs_dbgmsg("destroying ds %llu; currently traversing; "
 839  839                              "reset bookmark to -1,0,0,0",
 840  840                              (u_longlong_t)ds->ds_object);
 841  841                  }
 842  842          } else if (zap_lookup_int_key(dp->dp_meta_objset,
 843  843              scn->scn_phys.scn_queue_obj, ds->ds_object, &mintxg) == 0) {
 844  844                  ASSERT3U(ds->ds_phys->ds_num_children, <=, 1);
 845      -                VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
      845 +                VERIFY0(zap_remove_int(dp->dp_meta_objset,
 846  846                      scn->scn_phys.scn_queue_obj, ds->ds_object, tx));
 847  847                  if (dsl_dataset_is_snapshot(ds)) {
 848  848                          /*
 849  849                           * We keep the same mintxg; it could be >
 850  850                           * ds_creation_txg if the previous snapshot was
 851  851                           * deleted too.
 852  852                           */
 853  853                          VERIFY(zap_add_int_key(dp->dp_meta_objset,
 854  854                              scn->scn_phys.scn_queue_obj,
 855  855                              ds->ds_phys->ds_next_snap_obj, mintxg, tx) == 0);
↓ open down ↓ 31 lines elided ↑ open up ↑
 887  887  
 888  888          if (scn->scn_phys.scn_bookmark.zb_objset == ds->ds_object) {
 889  889                  scn->scn_phys.scn_bookmark.zb_objset =
 890  890                      ds->ds_phys->ds_prev_snap_obj;
 891  891                  zfs_dbgmsg("snapshotting ds %llu; currently traversing; "
 892  892                      "reset zb_objset to %llu",
 893  893                      (u_longlong_t)ds->ds_object,
 894  894                      (u_longlong_t)ds->ds_phys->ds_prev_snap_obj);
 895  895          } else if (zap_lookup_int_key(dp->dp_meta_objset,
 896  896              scn->scn_phys.scn_queue_obj, ds->ds_object, &mintxg) == 0) {
 897      -                VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
      897 +                VERIFY0(zap_remove_int(dp->dp_meta_objset,
 898  898                      scn->scn_phys.scn_queue_obj, ds->ds_object, tx));
 899  899                  VERIFY(zap_add_int_key(dp->dp_meta_objset,
 900  900                      scn->scn_phys.scn_queue_obj,
 901  901                      ds->ds_phys->ds_prev_snap_obj, mintxg, tx) == 0);
 902  902                  zfs_dbgmsg("snapshotting ds %llu; in queue; "
 903  903                      "replacing with %llu",
 904  904                      (u_longlong_t)ds->ds_object,
 905  905                      (u_longlong_t)ds->ds_phys->ds_prev_snap_obj);
 906  906          }
 907  907          dsl_scan_sync_state(scn, tx);
↓ open down ↓ 22 lines elided ↑ open up ↑
 930  930                      (u_longlong_t)ds2->ds_object,
 931  931                      (u_longlong_t)ds1->ds_object);
 932  932          }
 933  933  
 934  934          if (zap_lookup_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj,
 935  935              ds1->ds_object, &mintxg) == 0) {
 936  936                  int err;
 937  937  
 938  938                  ASSERT3U(mintxg, ==, ds1->ds_phys->ds_prev_snap_txg);
 939  939                  ASSERT3U(mintxg, ==, ds2->ds_phys->ds_prev_snap_txg);
 940      -                VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
      940 +                VERIFY0(zap_remove_int(dp->dp_meta_objset,
 941  941                      scn->scn_phys.scn_queue_obj, ds1->ds_object, tx));
 942  942                  err = zap_add_int_key(dp->dp_meta_objset,
 943  943                      scn->scn_phys.scn_queue_obj, ds2->ds_object, mintxg, tx);
 944  944                  VERIFY(err == 0 || err == EEXIST);
 945  945                  if (err == EEXIST) {
 946  946                          /* Both were there to begin with */
 947  947                          VERIFY(0 == zap_add_int_key(dp->dp_meta_objset,
 948  948                              scn->scn_phys.scn_queue_obj,
 949  949                              ds1->ds_object, mintxg, tx));
 950  950                  }
 951  951                  zfs_dbgmsg("clone_swap ds %llu; in queue; "
 952  952                      "replacing with %llu",
 953  953                      (u_longlong_t)ds1->ds_object,
 954  954                      (u_longlong_t)ds2->ds_object);
 955  955          } else if (zap_lookup_int_key(dp->dp_meta_objset,
 956  956              scn->scn_phys.scn_queue_obj, ds2->ds_object, &mintxg) == 0) {
 957  957                  ASSERT3U(mintxg, ==, ds1->ds_phys->ds_prev_snap_txg);
 958  958                  ASSERT3U(mintxg, ==, ds2->ds_phys->ds_prev_snap_txg);
 959      -                VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
      959 +                VERIFY0(zap_remove_int(dp->dp_meta_objset,
 960  960                      scn->scn_phys.scn_queue_obj, ds2->ds_object, tx));
 961  961                  VERIFY(0 == zap_add_int_key(dp->dp_meta_objset,
 962  962                      scn->scn_phys.scn_queue_obj, ds1->ds_object, mintxg, tx));
 963  963                  zfs_dbgmsg("clone_swap ds %llu; in queue; "
 964  964                      "replacing with %llu",
 965  965                      (u_longlong_t)ds2->ds_object,
 966  966                      (u_longlong_t)ds1->ds_object);
 967  967          }
 968  968  
 969  969          dsl_scan_sync_state(scn, tx);
↓ open down ↓ 37 lines elided ↑ open up ↑
1007 1007          return (0);
1008 1008  }
1009 1009  
1010 1010  static void
1011 1011  dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_tx_t *tx)
1012 1012  {
1013 1013          dsl_pool_t *dp = scn->scn_dp;
1014 1014          dsl_dataset_t *ds;
1015 1015          objset_t *os;
1016 1016  
1017      -        VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
     1017 +        VERIFY0(dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
1018 1018  
1019 1019          if (dmu_objset_from_ds(ds, &os))
1020 1020                  goto out;
1021 1021  
1022 1022          /*
1023 1023           * Only the ZIL in the head (non-snapshot) is valid.  Even though
1024 1024           * snapshots can have ZIL block pointers (which may be the same
1025 1025           * BP as in the head), they must be ignored.  So we traverse the
1026 1026           * ZIL here, rather than in scan_recurse(), because the regular
1027 1027           * snapshot block-sharing rules don't apply to it.
↓ open down ↓ 273 lines elided ↑ open up ↑
1301 1301          bzero(&scn->scn_phys.scn_bookmark, sizeof (zbookmark_t));
1302 1302  
1303 1303          /* keep pulling things out of the zap-object-as-queue */
1304 1304          while (zap_cursor_init(&zc, dp->dp_meta_objset,
1305 1305              scn->scn_phys.scn_queue_obj),
1306 1306              zap_cursor_retrieve(&zc, &za) == 0) {
1307 1307                  dsl_dataset_t *ds;
1308 1308                  uint64_t dsobj;
1309 1309  
1310 1310                  dsobj = strtonum(za.za_name, NULL);
1311      -                VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
     1311 +                VERIFY0(zap_remove_int(dp->dp_meta_objset,
1312 1312                      scn->scn_phys.scn_queue_obj, dsobj, tx));
1313 1313  
1314 1314                  /* Set up min/max txg */
1315      -                VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
     1315 +                VERIFY0(dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
1316 1316                  if (za.za_first_integer != 0) {
1317 1317                          scn->scn_phys.scn_cur_min_txg =
1318 1318                              MAX(scn->scn_phys.scn_min_txg,
1319 1319                              za.za_first_integer);
1320 1320                  } else {
1321 1321                          scn->scn_phys.scn_cur_min_txg =
1322 1322                              MAX(scn->scn_phys.scn_min_txg,
1323 1323                              ds->ds_phys->ds_prev_snap_txg);
1324 1324                  }
1325 1325                  scn->scn_phys.scn_cur_max_txg = dsl_scan_ds_maxtxg(ds);
↓ open down ↓ 101 lines elided ↑ open up ↑
1427 1427           * any scanning.  This ensures that there is no free list when
1428 1428           * we are scanning, so the scan code doesn't have to worry about
1429 1429           * traversing it.
1430 1430           */
1431 1431          if (spa_version(dp->dp_spa) >= SPA_VERSION_DEADLISTS) {
1432 1432                  scn->scn_is_bptree = B_FALSE;
1433 1433                  scn->scn_zio_root = zio_root(dp->dp_spa, NULL,
1434 1434                      NULL, ZIO_FLAG_MUSTSUCCEED);
1435 1435                  err = bpobj_iterate(&dp->dp_free_bpobj,
1436 1436                      dsl_scan_free_block_cb, scn, tx);
1437      -                VERIFY3U(0, ==, zio_wait(scn->scn_zio_root));
     1437 +                VERIFY0(zio_wait(scn->scn_zio_root));
1438 1438  
1439 1439                  if (err == 0 && spa_feature_is_active(spa,
1440 1440                      &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
1441 1441                          scn->scn_is_bptree = B_TRUE;
1442 1442                          scn->scn_zio_root = zio_root(dp->dp_spa, NULL,
1443 1443                              NULL, ZIO_FLAG_MUSTSUCCEED);
1444 1444                          err = bptree_iterate(dp->dp_meta_objset,
1445 1445                              dp->dp_bptree_obj, B_TRUE, dsl_scan_free_block_cb,
1446 1446                              scn, tx);
1447      -                        VERIFY3U(0, ==, zio_wait(scn->scn_zio_root));
     1447 +                        VERIFY0(zio_wait(scn->scn_zio_root));
1448 1448                          if (err != 0)
1449 1449                                  return;
1450 1450  
1451 1451                          /* disable async destroy feature */
1452 1452                          spa_feature_decr(spa,
1453 1453                              &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY], tx);
1454 1454                          ASSERT(!spa_feature_is_active(spa,
1455 1455                              &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY]));
1456      -                        VERIFY3U(0, ==, zap_remove(dp->dp_meta_objset,
     1456 +                        VERIFY0(zap_remove(dp->dp_meta_objset,
1457 1457                              DMU_POOL_DIRECTORY_OBJECT,
1458 1458                              DMU_POOL_BPTREE_OBJ, tx));
1459      -                        VERIFY3U(0, ==, bptree_free(dp->dp_meta_objset,
     1459 +                        VERIFY0(bptree_free(dp->dp_meta_objset,
1460 1460                              dp->dp_bptree_obj, tx));
1461 1461                          dp->dp_bptree_obj = 0;
1462 1462                  }
1463 1463                  if (scn->scn_visited_this_txg) {
1464 1464                          zfs_dbgmsg("freed %llu blocks in %llums from "
1465 1465                              "free_bpobj/bptree txg %llu",
1466 1466                              (longlong_t)scn->scn_visited_this_txg,
1467 1467                              (longlong_t)
1468 1468                              (gethrtime() - scn->scn_sync_start_time) / MICROSEC,
1469 1469                              (longlong_t)tx->tx_txg);
↓ open down ↓ 275 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX