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

@@ -829,11 +829,11 @@
                 dsphys->ds_flags |= origin->ds_phys->ds_flags;
 
                 dmu_buf_will_dirty(origin->ds_dbuf, tx);
                 origin->ds_phys->ds_num_children++;
 
-                VERIFY3U(0, ==, dsl_dataset_hold_obj(dp,
+                VERIFY0(dsl_dataset_hold_obj(dp,
                     origin->ds_dir->dd_phys->dd_head_dataset_obj, FTAG, &ohds));
                 dsphys->ds_deadlist_obj = dsl_deadlist_clone(&ohds->ds_deadlist,
                     dsphys->ds_prev_snap_txg, dsphys->ds_prev_snap_obj, tx);
                 dsl_dataset_rele(ohds, FTAG);
 

@@ -855,11 +855,11 @@
                                 dmu_buf_will_dirty(origin->ds_dir->dd_dbuf, tx);
                                 origin->ds_dir->dd_phys->dd_clones =
                                     zap_create(mos,
                                     DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
                         }
-                        VERIFY3U(0, ==, zap_add_int(mos,
+                        VERIFY0(zap_add_int(mos,
                             origin->ds_dir->dd_phys->dd_clones, dsobj, tx));
                 }
         }
 
         if (spa_version(dp->dp_spa) >= SPA_VERSION_UNIQUE_ACCURATE)

@@ -898,12 +898,12 @@
          */
         if (origin != NULL) {
                 dsl_dataset_t *ds;
                 objset_t *os;
 
-                VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
-                VERIFY3U(0, ==, dmu_objset_from_ds(ds, &os));
+                VERIFY0(dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
+                VERIFY0(dmu_objset_from_ds(ds, &os));
                 bzero(&os->os_zil_header, sizeof (os->os_zil_header));
                 dsl_dataset_dirty(ds, tx);
                 dsl_dataset_rele(ds, FTAG);
         }
 

@@ -1502,14 +1502,13 @@
          * ENOENT.  However, at least we can check that we don't have
          * too many entries in the next_clones_obj even after failing to
          * remove this one.
          */
         if (err != ENOENT) {
-                VERIFY3U(err, ==, 0);
+                VERIFY0(err);
         }
-        ASSERT3U(0, ==, zap_count(mos, ds->ds_phys->ds_next_clones_obj,
-            &count));
+        ASSERT0(zap_count(mos, ds->ds_phys->ds_next_clones_obj, &count));
         ASSERT3U(count, <=, ds->ds_phys->ds_num_children - 2);
 }
 
 static void
 dsl_dataset_remove_clones_key(dsl_dataset_t *ds, uint64_t mintxg, dmu_tx_t *tx)

@@ -1529,11 +1528,11 @@
         for (zap_cursor_init(&zc, mos, ds->ds_dir->dd_phys->dd_clones);
             zap_cursor_retrieve(&zc, &za) == 0;
             zap_cursor_advance(&zc)) {
                 dsl_dataset_t *clone;
 
-                VERIFY3U(0, ==, dsl_dataset_hold_obj(ds->ds_dir->dd_pool,
+                VERIFY0(dsl_dataset_hold_obj(ds->ds_dir->dd_pool,
                     za.za_first_integer, FTAG, &clone));
                 if (clone->ds_dir->dd_origin_txg > mintxg) {
                         dsl_deadlist_remove_key(&clone->ds_deadlist,
                             mintxg, tx);
                         dsl_dataset_remove_clones_key(clone, mintxg, tx);

@@ -1587,13 +1586,13 @@
 
         poa.ds = ds;
         poa.ds_prev = ds_prev;
         poa.after_branch_point = after_branch_point;
         poa.pio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
-        VERIFY3U(0, ==, bpobj_iterate(&ds_next->ds_deadlist.dl_bpobj,
+        VERIFY0(bpobj_iterate(&ds_next->ds_deadlist.dl_bpobj,
             process_old_cb, &poa, tx));
-        VERIFY3U(zio_wait(poa.pio), ==, 0);
+        VERIFY0(zio_wait(poa.pio));
         ASSERT3U(poa.used, ==, ds->ds_phys->ds_unique_bytes);
 
         /* change snapused */
         dsl_dir_diduse_space(ds->ds_dir, DD_USED_SNAP,
             -poa.used, -poa.comp, -poa.uncomp, tx);

@@ -1624,11 +1623,11 @@
         ka.ds = ds;
         ka.tx = tx;
         err = traverse_dataset(ds,
             ds->ds_phys->ds_prev_snap_txg, TRAVERSE_POST,
             kill_blkptr, &ka);
-        ASSERT3U(err, ==, 0);
+        ASSERT0(err);
         ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) || ds->ds_phys->ds_unique_bytes == 0);
 
         return (err);
 }
 

@@ -1680,11 +1679,11 @@
                     (ZPROP_SRC_NONE | ZPROP_SRC_LOCAL | ZPROP_SRC_RECEIVED),
                     &value);
                 psa.psa_effective_value = 0;    /* predict default value */
 
                 dsl_dataset_set_reservation_sync(ds, &psa, tx);
-                ASSERT3U(ds->ds_reserved, ==, 0);
+                ASSERT0(ds->ds_reserved);
         }
 
         ASSERT(RW_WRITE_HELD(&dp->dp_config_rwlock));
 
         dsl_scan_ds_destroyed(ds, tx);

@@ -1817,11 +1816,11 @@
                         dsl_dataset_rele(ds_nextnext, FTAG);
                         ASSERT3P(ds_next->ds_prev, ==, NULL);
 
                         /* Collapse range in this head. */
                         dsl_dataset_t *hds;
-                        VERIFY3U(0, ==, dsl_dataset_hold_obj(dp,
+                        VERIFY0(dsl_dataset_hold_obj(dp,
                             ds->ds_dir->dd_phys->dd_head_dataset_obj,
                             FTAG, &hds));
                         dsl_deadlist_remove_key(&hds->ds_deadlist,
                             ds->ds_phys->ds_creation_txg, tx);
                         dsl_dataset_rele(hds, FTAG);

@@ -1906,11 +1905,11 @@
                             used, comp, uncomp, tx);
                 }
 
                 if (ds->ds_prev != NULL) {
                         if (spa_version(dp->dp_spa) >= SPA_VERSION_DIR_CLONES) {
-                                VERIFY3U(0, ==, zap_remove_int(mos,
+                                VERIFY0(zap_remove_int(mos,
                                     ds->ds_prev->ds_dir->dd_phys->dd_clones,
                                     ds->ds_object, tx));
                         }
                         dsl_dataset_rele(ds->ds_prev, ds);
                         ds->ds_prev = ds_prev = NULL;

@@ -1944,11 +1943,11 @@
                 {
                         uint64_t val;
 
                         err = dsl_dataset_snap_lookup(ds_head,
                             ds->ds_snapname, &val);
-                        ASSERT3U(err, ==, 0);
+                        ASSERT0(err);
                         ASSERT3U(val, ==, obj);
                 }
 #endif
                 err = dsl_dataset_snap_remove(ds_head, ds->ds_snapname, tx);
                 ASSERT(err == 0);

@@ -2111,11 +2110,11 @@
                             ds->ds_prev->ds_phys->ds_creation_txg);
                         ds->ds_prev->ds_phys->ds_next_snap_obj = dsobj;
                 } else if (next_clones_obj != 0) {
                         remove_from_next_clones(ds->ds_prev,
                             dsphys->ds_next_snap_obj, tx);
-                        VERIFY3U(0, ==, zap_add_int(mos,
+                        VERIFY0(zap_add_int(mos,
                             next_clones_obj, dsobj, tx));
                 }
         }
 
         /*

@@ -2201,11 +2200,11 @@
          * There may me missing entries in ds_next_clones_obj
          * due to a bug in a previous version of the code.
          * Only trust it if it has the right number of entries.
          */
         if (ds->ds_phys->ds_next_clones_obj != 0) {
-                ASSERT3U(0, ==, zap_count(mos, ds->ds_phys->ds_next_clones_obj,
+                ASSERT0(zap_count(mos, ds->ds_phys->ds_next_clones_obj,
                     &count));
         }
         if (count != ds->ds_phys->ds_num_children - 1) {
                 goto fail;
         }

@@ -2440,17 +2439,17 @@
         VERIFY(0 == dsl_dataset_hold_obj(dd->dd_pool,
             dd->dd_phys->dd_head_dataset_obj, FTAG, &hds));
 
         VERIFY(0 == dsl_dataset_get_snapname(ds));
         err = dsl_dataset_snap_remove(hds, ds->ds_snapname, tx);
-        ASSERT3U(err, ==, 0);
+        ASSERT0(err);
         mutex_enter(&ds->ds_lock);
         (void) strcpy(ds->ds_snapname, newsnapname);
         mutex_exit(&ds->ds_lock);
         err = zap_add(mos, hds->ds_phys->ds_snapnames_zapobj,
             ds->ds_snapname, 8, 1, &ds->ds_object, tx);
-        ASSERT3U(err, ==, 0);
+        ASSERT0(err);
 
         spa_history_log_internal_ds(ds, "rename", tx,
             "-> @%s", newsnapname);
         dsl_dataset_rele(hds, FTAG);
 }

@@ -2804,11 +2803,11 @@
         origin_ds->ds_phys->ds_next_snap_obj = snap->ds->ds_object;
 
         /* change the origin's next clone */
         if (origin_ds->ds_phys->ds_next_clones_obj) {
                 remove_from_next_clones(origin_ds, snap->ds->ds_object, tx);
-                VERIFY3U(0, ==, zap_add_int(dp->dp_meta_objset,
+                VERIFY0(zap_add_int(dp->dp_meta_objset,
                     origin_ds->ds_phys->ds_next_clones_obj,
                     oldnext_obj, tx));
         }
 
         /* change origin */

@@ -2821,24 +2820,24 @@
         origin_head->ds_dir->dd_origin_txg =
             origin_ds->ds_phys->ds_creation_txg;
 
         /* change dd_clone entries */
         if (spa_version(dp->dp_spa) >= SPA_VERSION_DIR_CLONES) {
-                VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
+                VERIFY0(zap_remove_int(dp->dp_meta_objset,
                     odd->dd_phys->dd_clones, hds->ds_object, tx));
-                VERIFY3U(0, ==, zap_add_int(dp->dp_meta_objset,
+                VERIFY0(zap_add_int(dp->dp_meta_objset,
                     pa->origin_origin->ds_dir->dd_phys->dd_clones,
                     hds->ds_object, tx));
 
-                VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
+                VERIFY0(zap_remove_int(dp->dp_meta_objset,
                     pa->origin_origin->ds_dir->dd_phys->dd_clones,
                     origin_head->ds_object, tx));
                 if (dd->dd_phys->dd_clones == 0) {
                         dd->dd_phys->dd_clones = zap_create(dp->dp_meta_objset,
                             DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
                 }
-                VERIFY3U(0, ==, zap_add_int(dp->dp_meta_objset,
+                VERIFY0(zap_add_int(dp->dp_meta_objset,
                     dd->dd_phys->dd_clones, origin_head->ds_object, tx));
 
         }
 
         /* move snapshots to this dir */

@@ -2887,11 +2886,11 @@
                                          * origin's reference.
                                          */
                                         continue;
                                 }
 
-                                VERIFY3U(0, ==, dsl_dataset_hold_obj(dp,
+                                VERIFY0(dsl_dataset_hold_obj(dp,
                                     za.za_first_integer, FTAG, &cnds));
                                 o = cnds->ds_dir->dd_phys->dd_head_dataset_obj;
 
                                 VERIFY3U(zap_remove_int(dp->dp_meta_objset,
                                     odd->dd_phys->dd_clones, o, tx), ==, 0);

@@ -2900,11 +2899,11 @@
                                 dsl_dataset_rele(cnds, FTAG);
                         }
                         zap_cursor_fini(&zc);
                 }
 
-                ASSERT3U(dsl_prop_numcb(ds), ==, 0);
+                ASSERT0(dsl_prop_numcb(ds));
         }
 
         /*
          * Change space accounting.
          * Note, pa->*usedsnap and dd_used_breakdown[SNAP] will either

@@ -3605,11 +3604,11 @@
 
         ca = kmem_alloc(sizeof (zfs_hold_cleanup_arg_t), KM_SLEEP);
         ca->dp = ds->ds_dir->dd_pool;
         ca->dsobj = ds->ds_object;
         (void) strlcpy(ca->htag, htag, sizeof (ca->htag));
-        VERIFY3U(0, ==, zfs_onexit_add_cb(minor,
+        VERIFY0(zfs_onexit_add_cb(minor,
             dsl_dataset_user_release_onexit, ca, NULL));
 }
 
 /*
  * If you add new checks here, you may need to add