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_dir.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_dir.c
↓ open down ↓ 483 lines elided ↑ open up ↑
 484  484  
 485  485          ASSERT(RW_WRITE_HELD(&dd->dd_pool->dp_config_rwlock));
 486  486          ASSERT(dd->dd_phys->dd_head_dataset_obj == 0);
 487  487  
 488  488          /*
 489  489           * Remove our reservation. The impl() routine avoids setting the
 490  490           * actual property, which would require the (already destroyed) ds.
 491  491           */
 492  492          dsl_dir_set_reservation_sync_impl(dd, 0, tx);
 493  493  
 494      -        ASSERT3U(dd->dd_phys->dd_used_bytes, ==, 0);
 495      -        ASSERT3U(dd->dd_phys->dd_reserved, ==, 0);
      494 +        ASSERT0(dd->dd_phys->dd_used_bytes);
      495 +        ASSERT0(dd->dd_phys->dd_reserved);
 496  496          for (t = 0; t < DD_USED_NUM; t++)
 497      -                ASSERT3U(dd->dd_phys->dd_used_breakdown[t], ==, 0);
      497 +                ASSERT0(dd->dd_phys->dd_used_breakdown[t]);
 498  498  
 499  499          VERIFY(0 == zap_destroy(mos, dd->dd_phys->dd_child_dir_zapobj, tx));
 500  500          VERIFY(0 == zap_destroy(mos, dd->dd_phys->dd_props_zapobj, tx));
 501  501          VERIFY(0 == dsl_deleg_destroy(mos, dd->dd_phys->dd_deleg_zapobj, tx));
 502  502          VERIFY(0 == zap_remove(mos,
 503  503              dd->dd_parent->dd_phys->dd_child_dir_zapobj, dd->dd_myname, tx));
 504  504  
 505  505          obj = dd->dd_object;
 506  506          dsl_dir_close(dd, tag);
 507  507          VERIFY(0 == dmu_object_free(mos, obj, tx));
↓ open down ↓ 70 lines elided ↑ open up ↑
 578  578  }
 579  579  
 580  580  void
 581  581  dsl_dir_sync(dsl_dir_t *dd, dmu_tx_t *tx)
 582  582  {
 583  583          ASSERT(dmu_tx_is_syncing(tx));
 584  584  
 585  585          dmu_buf_will_dirty(dd->dd_dbuf, tx);
 586  586  
 587  587          mutex_enter(&dd->dd_lock);
 588      -        ASSERT3U(dd->dd_tempreserved[tx->tx_txg&TXG_MASK], ==, 0);
      588 +        ASSERT0(dd->dd_tempreserved[tx->tx_txg&TXG_MASK]);
 589  589          dprintf_dd(dd, "txg=%llu towrite=%lluK\n", tx->tx_txg,
 590  590              dd->dd_space_towrite[tx->tx_txg&TXG_MASK] / 1024);
 591  591          dd->dd_space_towrite[tx->tx_txg&TXG_MASK] = 0;
 592  592          mutex_exit(&dd->dd_lock);
 593  593  
 594  594          /* release the hold from dsl_dir_dirty */
 595  595          dmu_buf_rele(dd->dd_dbuf, dd);
 596  596  }
 597  597  
 598  598  static uint64_t
↓ open down ↓ 728 lines elided ↑ open up ↑
1327 1327                          dsl_dir_diduse_space(ra->newparent, DD_USED_CHILD_RSRV,
1328 1328                              unused_rsrv, 0, 0, tx);
1329 1329                  }
1330 1330          }
1331 1331  
1332 1332          dmu_buf_will_dirty(dd->dd_dbuf, tx);
1333 1333  
1334 1334          /* remove from old parent zapobj */
1335 1335          err = zap_remove(mos, dd->dd_parent->dd_phys->dd_child_dir_zapobj,
1336 1336              dd->dd_myname, tx);
1337      -        ASSERT3U(err, ==, 0);
     1337 +        ASSERT0(err);
1338 1338  
1339 1339          (void) strcpy(dd->dd_myname, ra->mynewname);
1340 1340          dsl_dir_close(dd->dd_parent, dd);
1341 1341          dd->dd_phys->dd_parent_obj = ra->newparent->dd_object;
1342 1342          VERIFY(0 == dsl_dir_open_obj(dd->dd_pool,
1343 1343              ra->newparent->dd_object, NULL, dd, &dd->dd_parent));
1344 1344  
1345 1345          /* add to new parent zapobj */
1346 1346          err = zap_add(mos, ra->newparent->dd_phys->dd_child_dir_zapobj,
1347 1347              dd->dd_myname, 8, 1, &dd->dd_object, tx);
1348      -        ASSERT3U(err, ==, 0);
     1348 +        ASSERT0(err);
1349 1349  
1350 1350  }
1351 1351  
1352 1352  int
1353 1353  dsl_dir_rename(dsl_dir_t *dd, const char *newname)
1354 1354  {
1355 1355          struct renamearg ra;
1356 1356          int err;
1357 1357  
1358 1358          /* new parent should exist */
↓ open down ↓ 62 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX