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/dbuf.c
          +++ new/usr/src/uts/common/fs/zfs/dbuf.c
↓ open down ↓ 320 lines elided ↑ open up ↑
 321  321                      db->db_blkid == DMU_SPILL_BLKID ||
 322  322                      !list_is_empty(&dn->dn_dbufs));
 323  323          }
 324  324          if (db->db_blkid == DMU_BONUS_BLKID) {
 325  325                  ASSERT(dn != NULL);
 326  326                  ASSERT3U(db->db.db_size, >=, dn->dn_bonuslen);
 327  327                  ASSERT3U(db->db.db_offset, ==, DMU_BONUS_BLKID);
 328  328          } else if (db->db_blkid == DMU_SPILL_BLKID) {
 329  329                  ASSERT(dn != NULL);
 330  330                  ASSERT3U(db->db.db_size, >=, dn->dn_bonuslen);
 331      -                ASSERT3U(db->db.db_offset, ==, 0);
      331 +                ASSERT0(db->db.db_offset);
 332  332          } else {
 333  333                  ASSERT3U(db->db.db_offset, ==, db->db_blkid * db->db.db_size);
 334  334          }
 335  335  
 336  336          for (dr = db->db_data_pending; dr != NULL; dr = dr->dr_next)
 337  337                  ASSERT(dr->dr_dbuf == db);
 338  338  
 339  339          for (dr = db->db_last_dirty; dr != NULL; dr = dr->dr_next)
 340  340                  ASSERT(dr->dr_dbuf == db);
 341  341  
↓ open down ↓ 1959 lines elided ↑ open up ↑
2301 2301          /*
2302 2302           * If this is a bonus buffer, simply copy the bonus data into the
2303 2303           * dnode.  It will be written out when the dnode is synced (and it
2304 2304           * will be synced, since it must have been dirty for dbuf_sync to
2305 2305           * be called).
2306 2306           */
2307 2307          if (db->db_blkid == DMU_BONUS_BLKID) {
2308 2308                  dbuf_dirty_record_t **drp;
2309 2309  
2310 2310                  ASSERT(*datap != NULL);
2311      -                ASSERT3U(db->db_level, ==, 0);
     2311 +                ASSERT0(db->db_level);
2312 2312                  ASSERT3U(dn->dn_phys->dn_bonuslen, <=, DN_MAX_BONUSLEN);
2313 2313                  bcopy(*datap, DN_BONUS(dn->dn_phys), dn->dn_phys->dn_bonuslen);
2314 2314                  DB_DNODE_EXIT(db);
2315 2315  
2316 2316                  if (*datap != db->db.db_data) {
2317 2317                          zio_buf_free(*datap, DN_MAX_BONUSLEN);
2318 2318                          arc_space_return(DN_MAX_BONUSLEN, ARC_SPACE_OTHER);
2319 2319                  }
2320 2320                  db->db_data_pending = NULL;
2321 2321                  drp = &db->db_last_dirty;
↓ open down ↓ 178 lines elided ↑ open up ↑
2500 2500  /* ARGSUSED */
2501 2501  static void
2502 2502  dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb)
2503 2503  {
2504 2504          dmu_buf_impl_t *db = vdb;
2505 2505          blkptr_t *bp = zio->io_bp;
2506 2506          blkptr_t *bp_orig = &zio->io_bp_orig;
2507 2507          uint64_t txg = zio->io_txg;
2508 2508          dbuf_dirty_record_t **drp, *dr;
2509 2509  
2510      -        ASSERT3U(zio->io_error, ==, 0);
     2510 +        ASSERT0(zio->io_error);
2511 2511          ASSERT(db->db_blkptr == bp);
2512 2512  
2513 2513          if (zio->io_flags & ZIO_FLAG_IO_REWRITE) {
2514 2514                  ASSERT(BP_EQUAL(bp, bp_orig));
2515 2515          } else {
2516 2516                  objset_t *os;
2517 2517                  dsl_dataset_t *ds;
2518 2518                  dmu_tx_t *tx;
2519 2519  
2520 2520                  DB_GET_OBJSET(&os, db);
↓ open down ↓ 200 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX