Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero
        
*** 70,80 ****
  
          /*
           * Bonus buffer contents are already initialized to 0, but for
           * readability we make it explicit.
           */
!         VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db));
          dmu_buf_will_dirty(db, tx);
          bt = db->db_data;
          bt->bt_begin = 0;
          bt->bt_end = 0;
          bt->bt_bytes = 0;
--- 70,80 ----
  
          /*
           * Bonus buffer contents are already initialized to 0, but for
           * readability we make it explicit.
           */
!         VERIFY0(dmu_bonus_hold(os, obj, FTAG, &db));
          dmu_buf_will_dirty(db, tx);
          bt = db->db_data;
          bt->bt_begin = 0;
          bt->bt_end = 0;
          bt->bt_bytes = 0;
*** 89,104 ****
  bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx)
  {
          dmu_buf_t *db;
          bptree_phys_t *bt;
  
!         VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db));
          bt = db->db_data;
          ASSERT3U(bt->bt_begin, ==, bt->bt_end);
!         ASSERT3U(bt->bt_bytes, ==, 0);
!         ASSERT3U(bt->bt_comp, ==, 0);
!         ASSERT3U(bt->bt_uncomp, ==, 0);
          dmu_buf_rele(db, FTAG);
  
          return (dmu_object_free(os, obj, tx));
  }
  
--- 89,104 ----
  bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx)
  {
          dmu_buf_t *db;
          bptree_phys_t *bt;
  
!         VERIFY0(dmu_bonus_hold(os, obj, FTAG, &db));
          bt = db->db_data;
          ASSERT3U(bt->bt_begin, ==, bt->bt_end);
!         ASSERT0(bt->bt_bytes);
!         ASSERT0(bt->bt_comp);
!         ASSERT0(bt->bt_uncomp);
          dmu_buf_rele(db, FTAG);
  
          return (dmu_object_free(os, obj, tx));
  }
  
*** 115,125 ****
           * modified in syncing context. Furthermore, this is only modified
           * by the sync thread, so no locking is necessary.
           */
          ASSERT(dmu_tx_is_syncing(tx));
  
!         VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db));
          bt = db->db_data;
  
          bte.be_birth_txg = birth_txg;
          bte.be_bp = *bp;
          bzero(&bte.be_zb, sizeof (bte.be_zb));
--- 115,125 ----
           * modified in syncing context. Furthermore, this is only modified
           * by the sync thread, so no locking is necessary.
           */
          ASSERT(dmu_tx_is_syncing(tx));
  
!         VERIFY0(dmu_bonus_hold(os, obj, FTAG, &db));
          bt = db->db_data;
  
          bte.be_birth_txg = birth_txg;
          bte.be_bp = *bp;
          bzero(&bte.be_zb, sizeof (bte.be_zb));
*** 195,205 ****
                          ASSERT(err == 0 || err == ERESTART);
                          if (err != 0) {
                                  /* save bookmark for future resume */
                                  ASSERT3U(bte.be_zb.zb_objset, ==,
                                      ZB_DESTROYED_OBJSET);
!                                 ASSERT3U(bte.be_zb.zb_level, ==, 0);
                                  dmu_write(os, obj, i * sizeof (bte),
                                      sizeof (bte), &bte, tx);
                                  break;
                          } else {
                                  ba.ba_phys->bt_begin++;
--- 195,205 ----
                          ASSERT(err == 0 || err == ERESTART);
                          if (err != 0) {
                                  /* save bookmark for future resume */
                                  ASSERT3U(bte.be_zb.zb_objset, ==,
                                      ZB_DESTROYED_OBJSET);
!                                 ASSERT0(bte.be_zb.zb_level);
                                  dmu_write(os, obj, i * sizeof (bte),
                                      sizeof (bte), &bte, tx);
                                  break;
                          } else {
                                  ba.ba_phys->bt_begin++;
*** 211,223 ****
  
          ASSERT(!free || err != 0 || ba.ba_phys->bt_begin == ba.ba_phys->bt_end);
  
          /* if all blocks are free there should be no used space */
          if (ba.ba_phys->bt_begin == ba.ba_phys->bt_end) {
!                 ASSERT3U(ba.ba_phys->bt_bytes, ==, 0);
!                 ASSERT3U(ba.ba_phys->bt_comp, ==, 0);
!                 ASSERT3U(ba.ba_phys->bt_uncomp, ==, 0);
          }
  
          dmu_buf_rele(db, FTAG);
  
          return (err);
--- 211,223 ----
  
          ASSERT(!free || err != 0 || ba.ba_phys->bt_begin == ba.ba_phys->bt_end);
  
          /* if all blocks are free there should be no used space */
          if (ba.ba_phys->bt_begin == ba.ba_phys->bt_end) {
!                 ASSERT0(ba.ba_phys->bt_bytes);
!                 ASSERT0(ba.ba_phys->bt_comp);
!                 ASSERT0(ba.ba_phys->bt_uncomp);
          }
  
          dmu_buf_rele(db, FTAG);
  
          return (err);