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/dnode_sync.c
          +++ new/usr/src/uts/common/fs/zfs/dnode_sync.c
↓ open down ↓ 266 lines elided ↑ open up ↑
 267  267                  ASSERT(all || blocks_freed == 0 || db->db_last_dirty);
 268  268                  DB_DNODE_EXIT(db);
 269  269                  return (all ? ALL : blocks_freed);
 270  270          }
 271  271  
 272  272          for (i = start; i <= end; i++, bp++) {
 273  273                  if (BP_IS_HOLE(bp))
 274  274                          continue;
 275  275                  rw_enter(&dn->dn_struct_rwlock, RW_READER);
 276  276                  err = dbuf_hold_impl(dn, db->db_level-1, i, TRUE, FTAG, &subdb);
 277      -                ASSERT3U(err, ==, 0);
      277 +                ASSERT0(err);
 278  278                  rw_exit(&dn->dn_struct_rwlock);
 279  279  
 280  280                  if (free_children(subdb, blkid, nblks, trunc, tx) == ALL) {
 281  281                          ASSERT3P(subdb->db_blkptr, ==, bp);
 282  282                          blocks_freed += free_blocks(dn, bp, 1, tx);
 283  283                  } else {
 284  284                          all = FALSE;
 285  285                  }
 286  286                  dbuf_rele(subdb, FTAG);
 287  287          }
 288  288          DB_DNODE_EXIT(db);
 289  289          arc_buf_freeze(db->db_buf);
 290  290  #ifdef ZFS_DEBUG
 291  291          bp -= (end-start)+1;
 292  292          for (i = start; i <= end; i++, bp++) {
 293  293                  if (i == start && blkid != 0)
 294  294                          continue;
 295  295                  else if (i == end && !trunc)
 296  296                          continue;
 297      -                ASSERT3U(bp->blk_birth, ==, 0);
      297 +                ASSERT0(bp->blk_birth);
 298  298          }
 299  299  #endif
 300  300          ASSERT(all || blocks_freed == 0 || db->db_last_dirty);
 301  301          return (all ? ALL : blocks_freed);
 302  302  }
 303  303  
 304  304  /*
 305  305   * free_range: Traverse the indicated range of the provided file
 306  306   * and "free" all the blocks contained there.
 307  307   */
↓ open down ↓ 35 lines elided ↑ open up ↑
 343  343          shift = (dnlevel - 1) * (dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT);
 344  344          start = blkid >> shift;
 345  345          ASSERT(start < dn->dn_phys->dn_nblkptr);
 346  346          end = (blkid + nblks - 1) >> shift;
 347  347          bp += start;
 348  348          for (i = start; i <= end; i++, bp++) {
 349  349                  if (BP_IS_HOLE(bp))
 350  350                          continue;
 351  351                  rw_enter(&dn->dn_struct_rwlock, RW_READER);
 352  352                  err = dbuf_hold_impl(dn, dnlevel-1, i, TRUE, FTAG, &db);
 353      -                ASSERT3U(err, ==, 0);
      353 +                ASSERT0(err);
 354  354                  rw_exit(&dn->dn_struct_rwlock);
 355  355  
 356  356                  if (free_children(db, blkid, nblks, trunc, tx) == ALL) {
 357  357                          ASSERT3P(db->db_blkptr, ==, bp);
 358  358                          (void) free_blocks(dn, bp, 1, tx);
 359  359                  }
 360  360                  dbuf_rele(db, FTAG);
 361  361          }
 362  362          if (trunc) {
 363  363                  uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
↓ open down ↓ 100 lines elided ↑ open up ↑
 464  464  dnode_sync_free(dnode_t *dn, dmu_tx_t *tx)
 465  465  {
 466  466          int txgoff = tx->tx_txg & TXG_MASK;
 467  467  
 468  468          ASSERT(dmu_tx_is_syncing(tx));
 469  469  
 470  470          /*
 471  471           * Our contents should have been freed in dnode_sync() by the
 472  472           * free range record inserted by the caller of dnode_free().
 473  473           */
 474      -        ASSERT3U(DN_USED_BYTES(dn->dn_phys), ==, 0);
      474 +        ASSERT0(DN_USED_BYTES(dn->dn_phys));
 475  475          ASSERT(BP_IS_HOLE(dn->dn_phys->dn_blkptr));
 476  476  
 477  477          dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]);
 478  478          dnode_evict_dbufs(dn);
 479  479          ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL);
 480  480  
 481  481          /*
 482  482           * XXX - It would be nice to assert this, but we may still
 483  483           * have residual holds from async evictions from the arc...
 484  484           *
↓ open down ↓ 211 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX