Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero

@@ -135,36 +135,36 @@
 
         for (i = 0; i < TXG_SIZE; i++) {
                 ASSERT(!list_link_active(&dn->dn_dirty_link[i]));
                 avl_destroy(&dn->dn_ranges[i]);
                 list_destroy(&dn->dn_dirty_records[i]);
-                ASSERT3U(dn->dn_next_nblkptr[i], ==, 0);
-                ASSERT3U(dn->dn_next_nlevels[i], ==, 0);
-                ASSERT3U(dn->dn_next_indblkshift[i], ==, 0);
-                ASSERT3U(dn->dn_next_bonustype[i], ==, 0);
-                ASSERT3U(dn->dn_rm_spillblk[i], ==, 0);
-                ASSERT3U(dn->dn_next_bonuslen[i], ==, 0);
-                ASSERT3U(dn->dn_next_blksz[i], ==, 0);
+                ASSERT0(dn->dn_next_nblkptr[i]);
+                ASSERT0(dn->dn_next_nlevels[i]);
+                ASSERT0(dn->dn_next_indblkshift[i]);
+                ASSERT0(dn->dn_next_bonustype[i]);
+                ASSERT0(dn->dn_rm_spillblk[i]);
+                ASSERT0(dn->dn_next_bonuslen[i]);
+                ASSERT0(dn->dn_next_blksz[i]);
         }
 
-        ASSERT3U(dn->dn_allocated_txg, ==, 0);
-        ASSERT3U(dn->dn_free_txg, ==, 0);
-        ASSERT3U(dn->dn_assigned_txg, ==, 0);
-        ASSERT3U(dn->dn_dirtyctx, ==, 0);
+        ASSERT0(dn->dn_allocated_txg);
+        ASSERT0(dn->dn_free_txg);
+        ASSERT0(dn->dn_assigned_txg);
+        ASSERT0(dn->dn_dirtyctx);
         ASSERT3P(dn->dn_dirtyctx_firstset, ==, NULL);
         ASSERT3P(dn->dn_bonus, ==, NULL);
         ASSERT(!dn->dn_have_spill);
         ASSERT3P(dn->dn_zio, ==, NULL);
-        ASSERT3U(dn->dn_oldused, ==, 0);
-        ASSERT3U(dn->dn_oldflags, ==, 0);
-        ASSERT3U(dn->dn_olduid, ==, 0);
-        ASSERT3U(dn->dn_oldgid, ==, 0);
-        ASSERT3U(dn->dn_newuid, ==, 0);
-        ASSERT3U(dn->dn_newgid, ==, 0);
-        ASSERT3U(dn->dn_id_flags, ==, 0);
+        ASSERT0(dn->dn_oldused);
+        ASSERT0(dn->dn_oldflags);
+        ASSERT0(dn->dn_olduid);
+        ASSERT0(dn->dn_oldgid);
+        ASSERT0(dn->dn_newuid);
+        ASSERT0(dn->dn_newgid);
+        ASSERT0(dn->dn_id_flags);
 
-        ASSERT3U(dn->dn_dbufs_count, ==, 0);
+        ASSERT0(dn->dn_dbufs_count);
         list_destroy(&dn->dn_dbufs);
 }
 
 void
 dnode_init(void)

@@ -359,11 +359,11 @@
 }
 
 static void
 dnode_setdblksz(dnode_t *dn, int size)
 {
-        ASSERT3U(P2PHASE(size, SPA_MINBLOCKSIZE), ==, 0);
+        ASSERT0(P2PHASE(size, SPA_MINBLOCKSIZE));
         ASSERT3U(size, <=, SPA_MAXBLOCKSIZE);
         ASSERT3U(size, >=, SPA_MINBLOCKSIZE);
         ASSERT3U(size >> SPA_MINBLOCKSHIFT, <,
             1<<(sizeof (dn->dn_phys->dn_datablkszsec) * 8));
         dn->dn_datablksz = size;

@@ -504,28 +504,28 @@
             (bonustype == DMU_OT_SA && bonuslen == 0) ||
             (bonustype != DMU_OT_NONE && bonuslen != 0));
         ASSERT(DMU_OT_IS_VALID(bonustype));
         ASSERT3U(bonuslen, <=, DN_MAX_BONUSLEN);
         ASSERT(dn->dn_type == DMU_OT_NONE);
-        ASSERT3U(dn->dn_maxblkid, ==, 0);
-        ASSERT3U(dn->dn_allocated_txg, ==, 0);
-        ASSERT3U(dn->dn_assigned_txg, ==, 0);
+        ASSERT0(dn->dn_maxblkid);
+        ASSERT0(dn->dn_allocated_txg);
+        ASSERT0(dn->dn_assigned_txg);
         ASSERT(refcount_is_zero(&dn->dn_tx_holds));
         ASSERT3U(refcount_count(&dn->dn_holds), <=, 1);
         ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL);
 
         for (i = 0; i < TXG_SIZE; i++) {
-                ASSERT3U(dn->dn_next_nblkptr[i], ==, 0);
-                ASSERT3U(dn->dn_next_nlevels[i], ==, 0);
-                ASSERT3U(dn->dn_next_indblkshift[i], ==, 0);
-                ASSERT3U(dn->dn_next_bonuslen[i], ==, 0);
-                ASSERT3U(dn->dn_next_bonustype[i], ==, 0);
-                ASSERT3U(dn->dn_rm_spillblk[i], ==, 0);
-                ASSERT3U(dn->dn_next_blksz[i], ==, 0);
+                ASSERT0(dn->dn_next_nblkptr[i]);
+                ASSERT0(dn->dn_next_nlevels[i]);
+                ASSERT0(dn->dn_next_indblkshift[i]);
+                ASSERT0(dn->dn_next_bonuslen[i]);
+                ASSERT0(dn->dn_next_bonustype[i]);
+                ASSERT0(dn->dn_rm_spillblk[i]);
+                ASSERT0(dn->dn_next_blksz[i]);
                 ASSERT(!list_link_active(&dn->dn_dirty_link[i]));
                 ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL);
-                ASSERT3U(avl_numnodes(&dn->dn_ranges[i]), ==, 0);
+                ASSERT0(avl_numnodes(&dn->dn_ranges[i]));
         }
 
         dn->dn_type = ot;
         dnode_setdblksz(dn, blocksize);
         dn->dn_indblkshift = ibs;

@@ -563,11 +563,11 @@
 {
         int nblkptr;
 
         ASSERT3U(blocksize, >=, SPA_MINBLOCKSIZE);
         ASSERT3U(blocksize, <=, SPA_MAXBLOCKSIZE);
-        ASSERT3U(blocksize % SPA_MINBLOCKSIZE, ==, 0);
+        ASSERT0(blocksize % SPA_MINBLOCKSIZE);
         ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT || dmu_tx_private_ok(tx));
         ASSERT(tx->tx_txg != 0);
         ASSERT((bonustype == DMU_OT_NONE && bonuslen == 0) ||
             (bonustype != DMU_OT_NONE && bonuslen != 0) ||
             (bonustype == DMU_OT_SA && bonuslen == 0));

@@ -1233,13 +1233,13 @@
                 return;
         }
 
         ASSERT(!refcount_is_zero(&dn->dn_holds) || list_head(&dn->dn_dbufs));
         ASSERT(dn->dn_datablksz != 0);
-        ASSERT3U(dn->dn_next_bonuslen[txg&TXG_MASK], ==, 0);
-        ASSERT3U(dn->dn_next_blksz[txg&TXG_MASK], ==, 0);
-        ASSERT3U(dn->dn_next_bonustype[txg&TXG_MASK], ==, 0);
+        ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]);
+        ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]);
+        ASSERT0(dn->dn_next_bonustype[txg&TXG_MASK]);
 
         dprintf_ds(os->os_dsl_dataset, "obj=%llu txg=%llu\n",
             dn->dn_object, txg);
 
         if (dn->dn_free_txg > 0 && dn->dn_free_txg <= txg) {

@@ -1585,11 +1585,11 @@
         if (trunc)
                 tail = 0;
         else
                 tail = P2PHASE(len, blksz);
 
-        ASSERT3U(P2PHASE(off, blksz), ==, 0);
+        ASSERT0(P2PHASE(off, blksz));
         /* zero out any partial block data at the end of the range */
         if (tail) {
                 if (len < tail)
                         tail = len;
                 if (dbuf_hold_impl(dn, 0, dbuf_whichblock(dn, off+len),

@@ -1767,11 +1767,11 @@
                 ASSERT3U(space, >=, -delta); /* no underflow */
         }
         space += delta;
         if (spa_version(dn->dn_objset->os_spa) < SPA_VERSION_DNODE_BYTES) {
                 ASSERT((dn->dn_phys->dn_flags & DNODE_FLAG_USED_BYTES) == 0);
-                ASSERT3U(P2PHASE(space, 1<<DEV_BSHIFT), ==, 0);
+                ASSERT0(P2PHASE(space, 1<<DEV_BSHIFT));
                 dn->dn_phys->dn_used = space >> DEV_BSHIFT;
         } else {
                 dn->dn_phys->dn_used = space;
                 dn->dn_phys->dn_flags |= DNODE_FLAG_USED_BYTES;
         }