Skip to content

Commit f222841

Browse files
robnspauka
authored andcommitted
Prefer VERIFY0(n) over VERIFY3U(n, ==, 0)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Signed-off-by: Rob Norris <robn@despairlabs.com> Sponsored-by: https://despairlabs.com/sponsor/ Closes openzfs#17591
1 parent 1a01a9a commit f222841

17 files changed

Lines changed: 33 additions & 33 deletions

File tree

cmd/zdb/zdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ get_obsolete_refcount(vdev_t *vd)
14561456
}
14571457
} else {
14581458
ASSERT3P(vd->vdev_obsolete_sm, ==, NULL);
1459-
ASSERT3U(obsolete_sm_object, ==, 0);
1459+
ASSERT0(obsolete_sm_object);
14601460
}
14611461
for (unsigned c = 0; c < vd->vdev_children; c++) {
14621462
refcount += get_obsolete_refcount(vd->vdev_child[c]);

cmd/ztest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4006,7 +4006,7 @@ raidz_scratch_verify(void)
40064006
* requested by user, but scratch object was not created.
40074007
*/
40084008
case RRSS_SCRATCH_NOT_IN_USE:
4009-
ASSERT3U(offset, ==, 0);
4009+
ASSERT0(offset);
40104010
break;
40114011

40124012
/*

module/os/freebsd/zfs/dmu_os.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
156156
if (dbp[0]->db_offset != 0 || numbufs > 1) {
157157
for (i = 0; i < numbufs; i++) {
158158
ASSERT(ISP2(dbp[i]->db_size));
159-
ASSERT3U((dbp[i]->db_offset % dbp[i]->db_size), ==, 0);
159+
ASSERT0((dbp[i]->db_offset % dbp[i]->db_size));
160160
ASSERT3U(dbp[i]->db_size, ==, dbp[0]->db_size);
161161
}
162162
}
@@ -175,7 +175,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
175175
vm_page_sunbusy(m);
176176
break;
177177
}
178-
ASSERT3U(m->dirty, ==, 0);
178+
ASSERT0(m->dirty);
179179
ASSERT(!pmap_page_is_write_mapped(m));
180180

181181
ASSERT3U(db->db_size, >, PAGE_SIZE);
@@ -201,7 +201,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
201201
if (m != bogus_page) {
202202
vm_page_assert_xbusied(m);
203203
ASSERT(vm_page_none_valid(m));
204-
ASSERT3U(m->dirty, ==, 0);
204+
ASSERT0(m->dirty);
205205
ASSERT(!pmap_page_is_write_mapped(m));
206206
va = zfs_map_page(m, &sf);
207207
}
@@ -295,7 +295,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
295295
vm_page_sunbusy(m);
296296
break;
297297
}
298-
ASSERT3U(m->dirty, ==, 0);
298+
ASSERT0(m->dirty);
299299
ASSERT(!pmap_page_is_write_mapped(m));
300300

301301
ASSERT3U(db->db_size, >, PAGE_SIZE);

module/os/freebsd/zfs/zfs_dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ zfs_unlinked_add(znode_t *zp, dmu_tx_t *tx)
273273
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
274274

275275
ASSERT(zp->z_unlinked);
276-
ASSERT3U(zp->z_links, ==, 0);
276+
ASSERT0(zp->z_links);
277277

278278
VERIFY0(zap_add_int(zfsvfs->z_os, zfsvfs->z_unlinkedobj, zp->z_id, tx));
279279

@@ -437,7 +437,7 @@ zfs_rmnode(znode_t *zp)
437437
uint64_t count;
438438
int error;
439439

440-
ASSERT3U(zp->z_links, ==, 0);
440+
ASSERT0(zp->z_links);
441441
if (zfsvfs->z_replay == B_FALSE)
442442
ASSERT_VOP_ELOCKED(ZTOV(zp), __func__);
443443

module/os/linux/spl/spl-kmem-cache.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,11 +863,11 @@ spl_kmem_cache_destroy(spl_kmem_cache_t *skc)
863863
* Validate there are no objects in use and free all the
864864
* spl_kmem_slab_t, spl_kmem_obj_t, and object buffers.
865865
*/
866-
ASSERT3U(skc->skc_slab_alloc, ==, 0);
867-
ASSERT3U(skc->skc_obj_alloc, ==, 0);
868-
ASSERT3U(skc->skc_slab_total, ==, 0);
869-
ASSERT3U(skc->skc_obj_total, ==, 0);
870-
ASSERT3U(skc->skc_obj_emergency, ==, 0);
866+
ASSERT0(skc->skc_slab_alloc);
867+
ASSERT0(skc->skc_obj_alloc);
868+
ASSERT0(skc->skc_slab_total);
869+
ASSERT0(skc->skc_obj_total);
870+
ASSERT0(skc->skc_obj_emergency);
871871
ASSERT(list_empty(&skc->skc_complete_list));
872872

873873
ASSERT3U(percpu_counter_sum(&skc->skc_linux_alloc), ==, 0);

module/os/linux/zfs/zfs_dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ zfs_drop_nlink_locked(znode_t *zp, dmu_tx_t *tx, boolean_t *unlinkedp)
986986
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zfsvfs),
987987
NULL, &links, sizeof (links));
988988
error = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx);
989-
ASSERT3U(error, ==, 0);
989+
ASSERT0(error);
990990

991991
if (unlinkedp != NULL)
992992
*unlinkedp = unlinked;
@@ -1058,7 +1058,7 @@ zfs_link_destroy(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag,
10581058

10591059
/* The only error is !zfs_dirempty() and we checked earlier. */
10601060
error = zfs_drop_nlink_locked(zp, tx, &unlinked);
1061-
ASSERT3U(error, ==, 0);
1061+
ASSERT0(error);
10621062
mutex_exit(&zp->z_lock);
10631063
} else {
10641064
error = zfs_dropname(dl, zp, dzp, tx, flag);

module/zfs/abd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ abd_get_offset_impl(abd_t *abd, abd_t *sabd, size_t off, size_t size)
563563
left -= csize;
564564
off = 0;
565565
}
566-
ASSERT3U(left, ==, 0);
566+
ASSERT0(left);
567567
} else {
568568
abd = abd_get_offset_scatter(abd, sabd, off, size);
569569
}

module/zfs/arc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5554,7 +5554,7 @@ static void
55545554
arc_hdr_verify(arc_buf_hdr_t *hdr, blkptr_t *bp)
55555555
{
55565556
if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) {
5557-
ASSERT3U(HDR_GET_PSIZE(hdr), ==, 0);
5557+
ASSERT0(HDR_GET_PSIZE(hdr));
55585558
ASSERT3U(arc_hdr_get_compress(hdr), ==, ZIO_COMPRESS_OFF);
55595559
} else {
55605560
if (HDR_COMPRESSION_ENABLED(hdr)) {
@@ -6973,7 +6973,7 @@ arc_write_done(zio_t *zio)
69736973
arc_buf_hdr_t *exists;
69746974
kmutex_t *hash_lock;
69756975

6976-
ASSERT3U(zio->io_error, ==, 0);
6976+
ASSERT0(zio->io_error);
69776977

69786978
arc_cksum_verify(buf);
69796979

module/zfs/dbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4477,7 +4477,7 @@ dbuf_prepare_encrypted_dnode_leaf(dbuf_dirty_record_t *dr)
44774477

44784478
ASSERT(MUTEX_HELD(&db->db_mtx));
44794479
ASSERT3U(db->db.db_object, ==, DMU_META_DNODE_OBJECT);
4480-
ASSERT3U(db->db_level, ==, 0);
4480+
ASSERT0(db->db_level);
44814481

44824482
if (!db->db_objset->os_raw_receive && arc_is_encrypted(db->db_buf)) {
44834483
zbookmark_phys_t zb;

module/zfs/ddt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ ddt_object_create(ddt_t *ddt, ddt_type_t type, ddt_class_t class,
397397

398398
ddt_object_name(ddt, type, class, name);
399399

400-
ASSERT3U(*objectp, ==, 0);
400+
ASSERT0(*objectp);
401401
VERIFY0(ddt_ops[type]->ddt_op_create(os, objectp, tx, prehash));
402402
ASSERT3U(*objectp, !=, 0);
403403

@@ -1421,7 +1421,7 @@ ddt_key_compare(const void *x1, const void *x2)
14211421
static void
14221422
ddt_create_dir(ddt_t *ddt, dmu_tx_t *tx)
14231423
{
1424-
ASSERT3U(ddt->ddt_dir_object, ==, 0);
1424+
ASSERT0(ddt->ddt_dir_object);
14251425
ASSERT3U(ddt->ddt_version, ==, DDT_VERSION_FDT);
14261426

14271427
char name[DDT_NAMELEN];

0 commit comments

Comments
 (0)