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/zap.c
          +++ new/usr/src/uts/common/fs/zfs/zap.c
↓ open down ↓ 154 lines elided ↑ open up ↑
 155  155  
 156  156          ASSERT(RW_WRITE_HELD(&zap->zap_rwlock));
 157  157          ASSERT(tbl->zt_blk != 0);
 158  158          ASSERT(tbl->zt_numblks > 0);
 159  159  
 160  160          if (tbl->zt_nextblk != 0) {
 161  161                  newblk = tbl->zt_nextblk;
 162  162          } else {
 163  163                  newblk = zap_allocate_blocks(zap, tbl->zt_numblks * 2);
 164  164                  tbl->zt_nextblk = newblk;
 165      -                ASSERT3U(tbl->zt_blks_copied, ==, 0);
      165 +                ASSERT0(tbl->zt_blks_copied);
 166  166                  dmu_prefetch(zap->zap_objset, zap->zap_object,
 167  167                      tbl->zt_blk << bs, tbl->zt_numblks << bs);
 168  168          }
 169  169  
 170  170          /*
 171  171           * Copy the ptrtbl from the old to new location.
 172  172           */
 173  173  
 174  174          b = tbl->zt_blks_copied;
 175  175          err = dmu_buf_hold(zap->zap_objset, zap->zap_object,
↓ open down ↓ 156 lines elided ↑ open up ↑
 332  332                   * We are outgrowing the "embedded" ptrtbl (the one
 333  333                   * stored in the header block).  Give it its own entire
 334  334                   * block, which will double the size of the ptrtbl.
 335  335                   */
 336  336                  uint64_t newblk;
 337  337                  dmu_buf_t *db_new;
 338  338                  int err;
 339  339  
 340  340                  ASSERT3U(zap->zap_f.zap_phys->zap_ptrtbl.zt_shift, ==,
 341  341                      ZAP_EMBEDDED_PTRTBL_SHIFT(zap));
 342      -                ASSERT3U(zap->zap_f.zap_phys->zap_ptrtbl.zt_blk, ==, 0);
      342 +                ASSERT0(zap->zap_f.zap_phys->zap_ptrtbl.zt_blk);
 343  343  
 344  344                  newblk = zap_allocate_blocks(zap, 1);
 345  345                  err = dmu_buf_hold(zap->zap_objset, zap->zap_object,
 346  346                      newblk << FZAP_BLOCK_SHIFT(zap), FTAG, &db_new,
 347  347                      DMU_READ_NO_PREFETCH);
 348  348                  if (err)
 349  349                          return (err);
 350  350                  dmu_buf_will_dirty(db_new, tx);
 351  351                  zap_ptrtbl_transfer(&ZAP_EMBEDDED_PTRTBL_ENT(zap, 0),
 352  352                      db_new->db_data, 1 << ZAP_EMBEDDED_PTRTBL_SHIFT(zap));
↓ open down ↓ 115 lines elided ↑ open up ↑
 468  468                  /* someone else set it first */
 469  469                  zap_leaf_pageout(NULL, l);
 470  470                  l = winner;
 471  471          }
 472  472  
 473  473          /*
 474  474           * lhr_pad was previously used for the next leaf in the leaf
 475  475           * chain.  There should be no chained leafs (as we have removed
 476  476           * support for them).
 477  477           */
 478      -        ASSERT3U(l->l_phys->l_hdr.lh_pad1, ==, 0);
      478 +        ASSERT0(l->l_phys->l_hdr.lh_pad1);
 479  479  
 480  480          /*
 481  481           * There should be more hash entries than there can be
 482  482           * chunks to put in the hash table
 483  483           */
 484  484          ASSERT3U(ZAP_LEAF_HASH_NUMENTRIES(l), >, ZAP_LEAF_NUMCHUNKS(l) / 3);
 485  485  
 486  486          /* The chunks should begin at the end of the hash table */
 487  487          ASSERT3P(&ZAP_LEAF_CHUNK(l, 0), ==,
 488  488              &l->l_phys->l_hash[ZAP_LEAF_HASH_NUMENTRIES(l)]);
↓ open down ↓ 162 lines elided ↑ open up ↑
 651  651                  err = zap_idx_to_blk(zap, sibling+i, &blk);
 652  652                  if (err)
 653  653                          return (err);
 654  654                  ASSERT3U(blk, ==, l->l_blkid);
 655  655          }
 656  656  
 657  657          nl = zap_create_leaf(zap, tx);
 658  658          zap_leaf_split(l, nl, zap->zap_normflags != 0);
 659  659  
 660  660          /* set sibling pointers */
 661      -        for (i = 0; i < (1ULL<<prefix_diff); i++) {
      661 +        for (i = 0; i < (1ULL << prefix_diff); i++) {
 662  662                  err = zap_set_idx_to_blk(zap, sibling+i, nl->l_blkid, tx);
 663      -                ASSERT3U(err, ==, 0); /* we checked for i/o errors above */
      663 +                ASSERT0(err); /* we checked for i/o errors above */
 664  664          }
 665  665  
 666  666          if (hash & (1ULL << (64 - l->l_phys->l_hdr.lh_prefix_len))) {
 667  667                  /* we want the sibling */
 668  668                  zap_put_leaf(l);
 669  669                  *lp = nl;
 670  670          } else {
 671  671                  zap_put_leaf(nl);
 672  672                  *lp = l;
 673  673          }
↓ open down ↓ 695 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX