mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Prefer VERIFY0P(n) over VERIFY3P(n, ==, NULL)
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 #17591
This commit is contained in:
committed by
Brian Behlendorf
parent
f7bdd84328
commit
82d6f7b047
@@ -160,7 +160,7 @@ kmem_cache_create(const char *name, size_t bufsize, size_t align,
|
||||
{
|
||||
kmem_cache_t *cache;
|
||||
|
||||
ASSERT3P(vmp, ==, NULL);
|
||||
ASSERT0P(vmp);
|
||||
|
||||
cache = kmem_alloc(sizeof (*cache), KM_SLEEP);
|
||||
strlcpy(cache->kc_name, name, sizeof (cache->kc_name));
|
||||
|
||||
@@ -256,7 +256,7 @@ sysevent_worker(void *arg __unused)
|
||||
* free `ze`, so just inline the free() here -- events have already
|
||||
* been drained.
|
||||
*/
|
||||
VERIFY3P(ze->ze_zevent, ==, NULL);
|
||||
VERIFY0P(ze->ze_zevent);
|
||||
kmem_free(ze, sizeof (zfs_zevent_t));
|
||||
|
||||
kthread_exit();
|
||||
|
||||
@@ -507,7 +507,7 @@ abd_iter_at_end(struct abd_iter *aiter)
|
||||
void
|
||||
abd_iter_advance(struct abd_iter *aiter, size_t amount)
|
||||
{
|
||||
ASSERT3P(aiter->iter_mapaddr, ==, NULL);
|
||||
ASSERT0P(aiter->iter_mapaddr);
|
||||
ASSERT0(aiter->iter_mapsize);
|
||||
|
||||
/* There's nothing left to advance to, so do nothing */
|
||||
@@ -526,7 +526,7 @@ abd_iter_map(struct abd_iter *aiter)
|
||||
{
|
||||
void *paddr;
|
||||
|
||||
ASSERT3P(aiter->iter_mapaddr, ==, NULL);
|
||||
ASSERT0P(aiter->iter_mapaddr);
|
||||
ASSERT0(aiter->iter_mapsize);
|
||||
|
||||
/* There's nothing left to iterate over, so do nothing */
|
||||
|
||||
@@ -1236,7 +1236,7 @@ vdev_geom_io_done(zio_t *zio)
|
||||
struct bio *bp = zio->io_bio;
|
||||
|
||||
if (zio->io_type != ZIO_TYPE_READ && zio->io_type != ZIO_TYPE_WRITE) {
|
||||
ASSERT3P(bp, ==, NULL);
|
||||
ASSERT0P(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1632,7 +1632,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr,
|
||||
if (zfsvfs->z_replay == B_FALSE)
|
||||
ASSERT_VOP_ELOCKED(ZTOV(dzp), __func__);
|
||||
} else
|
||||
ASSERT3P(dzp->z_vnode, ==, NULL);
|
||||
ASSERT0P(dzp->z_vnode);
|
||||
memset(acl_ids, 0, sizeof (zfs_acl_ids_t));
|
||||
acl_ids->z_mode = MAKEIMODE(vap->va_type, vap->va_mode);
|
||||
|
||||
@@ -2014,7 +2014,7 @@ top:
|
||||
|
||||
error = zfs_aclset_common(zp, aclp, cr, tx);
|
||||
ASSERT0(error);
|
||||
ASSERT3P(zp->z_acl_cached, ==, NULL);
|
||||
ASSERT0P(zp->z_acl_cached);
|
||||
zp->z_acl_cached = aclp;
|
||||
|
||||
if (fuid_dirtied)
|
||||
|
||||
@@ -357,7 +357,7 @@ zfsctl_create(zfsvfs_t *zfsvfs)
|
||||
vnode_t *rvp;
|
||||
uint64_t crtime[2];
|
||||
|
||||
ASSERT3P(zfsvfs->z_ctldir, ==, NULL);
|
||||
ASSERT0P(zfsvfs->z_ctldir);
|
||||
|
||||
snapdir = sfs_alloc_node(sizeof (*snapdir), "snapshot", ZFSCTL_INO_ROOT,
|
||||
ZFSCTL_INO_SNAPDIR);
|
||||
@@ -1367,7 +1367,7 @@ zfsctl_snapshot_unmount(const char *snapname, int flags __unused)
|
||||
|
||||
int err = getzfsvfs(snapname, &zfsvfs);
|
||||
if (err != 0) {
|
||||
ASSERT3P(zfsvfs, ==, NULL);
|
||||
ASSERT0P(zfsvfs);
|
||||
return (0);
|
||||
}
|
||||
vfsp = zfsvfs->z_vfs;
|
||||
|
||||
@@ -1091,7 +1091,7 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t mounting)
|
||||
if (mounting) {
|
||||
boolean_t readonly;
|
||||
|
||||
ASSERT3P(zfsvfs->z_kstat.dk_kstats, ==, NULL);
|
||||
ASSERT0P(zfsvfs->z_kstat.dk_kstats);
|
||||
error = dataset_kstats_create(&zfsvfs->z_kstat, zfsvfs->z_os);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@@ -1101,7 +1101,7 @@ zfs_create(znode_t *dzp, const char *name, vattr_t *vap, int excl, int mode,
|
||||
zfs_exit(zfsvfs, FTAG);
|
||||
return (error);
|
||||
}
|
||||
ASSERT3P(zp, ==, NULL);
|
||||
ASSERT0P(zp);
|
||||
|
||||
/*
|
||||
* Create a new file object and update the directory
|
||||
@@ -1482,7 +1482,7 @@ zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap, znode_t **zpp,
|
||||
zfs_exit(zfsvfs, FTAG);
|
||||
return (error);
|
||||
}
|
||||
ASSERT3P(zp, ==, NULL);
|
||||
ASSERT0P(zp);
|
||||
|
||||
if ((error = zfs_zaccess(dzp, ACE_ADD_SUBDIRECTORY, 0, B_FALSE, cr,
|
||||
mnt_ns))) {
|
||||
|
||||
@@ -161,15 +161,15 @@ zfs_znode_cache_destructor(void *buf, void *arg)
|
||||
znode_t *zp = buf;
|
||||
|
||||
ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs));
|
||||
ASSERT3P(zp->z_vnode, ==, NULL);
|
||||
ASSERT0P(zp->z_vnode);
|
||||
ASSERT(!list_link_active(&zp->z_link_node));
|
||||
mutex_destroy(&zp->z_lock);
|
||||
mutex_destroy(&zp->z_acl_lock);
|
||||
rw_destroy(&zp->z_xattr_lock);
|
||||
zfs_rangelock_fini(&zp->z_rangelock);
|
||||
|
||||
ASSERT3P(zp->z_acl_cached, ==, NULL);
|
||||
ASSERT3P(zp->z_xattr_cached, ==, NULL);
|
||||
ASSERT0P(zp->z_acl_cached);
|
||||
ASSERT0P(zp->z_xattr_cached);
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ zfs_znode_init(void)
|
||||
/*
|
||||
* Initialize zcache
|
||||
*/
|
||||
ASSERT3P(znode_uma_zone, ==, NULL);
|
||||
ASSERT0P(znode_uma_zone);
|
||||
znode_uma_zone = uma_zcreate("zfs_znode_cache",
|
||||
sizeof (znode_t), zfs_znode_cache_constructor_smr,
|
||||
zfs_znode_cache_destructor_smr, NULL, NULL, 0, 0);
|
||||
@@ -224,7 +224,7 @@ zfs_znode_init(void)
|
||||
/*
|
||||
* Initialize zcache
|
||||
*/
|
||||
ASSERT3P(znode_cache, ==, NULL);
|
||||
ASSERT0P(znode_cache);
|
||||
znode_cache = kmem_cache_create("zfs_znode_cache",
|
||||
sizeof (znode_t), 0, zfs_znode_cache_constructor,
|
||||
zfs_znode_cache_destructor, NULL, NULL, NULL, KMC_RECLAIMABLE);
|
||||
@@ -353,8 +353,8 @@ zfs_znode_sa_init(zfsvfs_t *zfsvfs, znode_t *zp,
|
||||
ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs) || (zfsvfs == zp->z_zfsvfs));
|
||||
ASSERT(MUTEX_HELD(ZFS_OBJ_MUTEX(zfsvfs, zp->z_id)));
|
||||
|
||||
ASSERT3P(zp->z_sa_hdl, ==, NULL);
|
||||
ASSERT3P(zp->z_acl_cached, ==, NULL);
|
||||
ASSERT0P(zp->z_sa_hdl);
|
||||
ASSERT0P(zp->z_acl_cached);
|
||||
if (sa_hdl == NULL) {
|
||||
VERIFY0(sa_handle_get_from_db(zfsvfs->z_os, db, zp,
|
||||
SA_HDL_SHARED, &zp->z_sa_hdl));
|
||||
@@ -1127,7 +1127,7 @@ zfs_rezget(znode_t *zp)
|
||||
}
|
||||
rw_exit(&zp->z_xattr_lock);
|
||||
|
||||
ASSERT3P(zp->z_sa_hdl, ==, NULL);
|
||||
ASSERT0P(zp->z_sa_hdl);
|
||||
err = sa_buf_hold(zfsvfs->z_os, obj_num, NULL, &db);
|
||||
if (err) {
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
|
||||
@@ -1298,7 +1298,7 @@ zfs_znode_free(znode_t *zp)
|
||||
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
|
||||
char *symlink;
|
||||
|
||||
ASSERT3P(zp->z_sa_hdl, ==, NULL);
|
||||
ASSERT0P(zp->z_sa_hdl);
|
||||
zp->z_vnode = NULL;
|
||||
mutex_enter(&zfsvfs->z_znodes_lock);
|
||||
POINTER_INVALIDATE(&zp->z_zfsvfs);
|
||||
|
||||
@@ -1415,7 +1415,7 @@ zvol_os_free(zvol_state_t *zv)
|
||||
struct zvol_state_geom *zsg = &zv->zv_zso->zso_geom;
|
||||
struct g_provider *pp __maybe_unused = zsg->zsg_provider;
|
||||
|
||||
ASSERT3P(pp->private, ==, NULL);
|
||||
ASSERT0P(pp->private);
|
||||
|
||||
g_topology_lock();
|
||||
zvol_geom_destroy(zv);
|
||||
@@ -1425,7 +1425,7 @@ zvol_os_free(zvol_state_t *zv)
|
||||
struct cdev *dev = zsd->zsd_cdev;
|
||||
|
||||
if (dev != NULL) {
|
||||
ASSERT3P(dev->si_drv2, ==, NULL);
|
||||
ASSERT0P(dev->si_drv2);
|
||||
destroy_dev(dev);
|
||||
knlist_clear(&zsd->zsd_selinfo.si_note, 0);
|
||||
knlist_destroy(&zsd->zsd_selinfo.si_note);
|
||||
@@ -1493,11 +1493,11 @@ zvol_os_create_minor(const char *name)
|
||||
|
||||
zv->zv_objset = os;
|
||||
|
||||
ASSERT3P(zv->zv_kstat.dk_kstats, ==, NULL);
|
||||
ASSERT0P(zv->zv_kstat.dk_kstats);
|
||||
error = dataset_kstats_create(&zv->zv_kstat, zv->zv_objset);
|
||||
if (error)
|
||||
goto out_dmu_objset_disown;
|
||||
ASSERT3P(zv->zv_zilog, ==, NULL);
|
||||
ASSERT0P(zv->zv_zilog);
|
||||
zv->zv_zilog = zil_open(os, zvol_get_data, &zv->zv_kstat.dk_zil_sums);
|
||||
if (spa_writeable(dmu_objset_spa(os))) {
|
||||
if (zil_replay_disable)
|
||||
|
||||
@@ -104,7 +104,7 @@ __cv_destroy(kcondvar_t *cvp)
|
||||
while (cv_destroy_wakeup(cvp) == 0)
|
||||
wait_event_timeout(cvp->cv_destroy, cv_destroy_wakeup(cvp), 1);
|
||||
|
||||
ASSERT3P(cvp->cv_mutex, ==, NULL);
|
||||
ASSERT0P(cvp->cv_mutex);
|
||||
ASSERT3S(atomic_read(&cvp->cv_refs), ==, 0);
|
||||
ASSERT3S(atomic_read(&cvp->cv_waiters), ==, 0);
|
||||
ASSERT3S(waitqueue_active(&cvp->cv_event), ==, 0);
|
||||
|
||||
@@ -709,7 +709,7 @@ zone_get_hostid(void *zone)
|
||||
{
|
||||
uint32_t hostid;
|
||||
|
||||
ASSERT3P(zone, ==, NULL);
|
||||
ASSERT0P(zone);
|
||||
|
||||
if (spl_hostid != 0)
|
||||
return ((uint32_t)(spl_hostid & HW_HOSTID_MASK));
|
||||
|
||||
@@ -161,7 +161,7 @@ tsd_hash_add(tsd_hash_table_t *table, uint_t key, pid_t pid, void *value)
|
||||
ulong_t hash;
|
||||
int rc = 0;
|
||||
|
||||
ASSERT3P(tsd_hash_search(table, key, pid), ==, NULL);
|
||||
ASSERT0P(tsd_hash_search(table, key, pid));
|
||||
|
||||
/* New entry allocate structure, set value, and add to hash */
|
||||
entry = kmem_alloc(sizeof (tsd_hash_entry_t), KM_PUSHPAGE);
|
||||
|
||||
@@ -863,9 +863,9 @@ abd_iter_advance(struct abd_iter *aiter, size_t amount)
|
||||
* Ensure that last chunk is not in use. abd_iterate_*() must clear
|
||||
* this state (directly or abd_iter_unmap()) before advancing.
|
||||
*/
|
||||
ASSERT3P(aiter->iter_mapaddr, ==, NULL);
|
||||
ASSERT0P(aiter->iter_mapaddr);
|
||||
ASSERT0(aiter->iter_mapsize);
|
||||
ASSERT3P(aiter->iter_page, ==, NULL);
|
||||
ASSERT0P(aiter->iter_page);
|
||||
ASSERT0(aiter->iter_page_doff);
|
||||
ASSERT0(aiter->iter_page_dsize);
|
||||
|
||||
@@ -897,7 +897,7 @@ abd_iter_map(struct abd_iter *aiter)
|
||||
void *paddr;
|
||||
size_t offset = 0;
|
||||
|
||||
ASSERT3P(aiter->iter_mapaddr, ==, NULL);
|
||||
ASSERT0P(aiter->iter_mapaddr);
|
||||
ASSERT0(aiter->iter_mapsize);
|
||||
|
||||
/* There's nothing left to iterate over, so do nothing */
|
||||
|
||||
@@ -552,7 +552,7 @@ vdev_bio_associate_blkg(struct bio *bio)
|
||||
#endif
|
||||
|
||||
ASSERT3P(q, !=, NULL);
|
||||
ASSERT3P(bio->bi_blkg, ==, NULL);
|
||||
ASSERT0P(bio->bi_blkg);
|
||||
|
||||
if (q->root_blkg && vdev_blkg_tryget(q->root_blkg))
|
||||
bio->bi_blkg = q->root_blkg;
|
||||
@@ -574,7 +574,7 @@ vdev_bio_set_dev(struct bio *bio, struct block_device *bdev)
|
||||
bio->bi_bdev = bdev;
|
||||
|
||||
ASSERT3P(q, !=, NULL);
|
||||
ASSERT3P(bio->bi_blkg, ==, NULL);
|
||||
ASSERT0P(bio->bi_blkg);
|
||||
|
||||
if (q->root_blkg && vdev_blkg_tryget(q->root_blkg))
|
||||
bio->bi_blkg = q->root_blkg;
|
||||
@@ -806,7 +806,7 @@ vbio_completion(struct bio *bio)
|
||||
* here; instead we stash vbio on the zio and take care of it in the
|
||||
* done callback.
|
||||
*/
|
||||
ASSERT3P(zio->io_bio, ==, NULL);
|
||||
ASSERT0P(zio->io_bio);
|
||||
zio->io_bio = vbio;
|
||||
|
||||
zio_delay_interrupt(zio);
|
||||
|
||||
@@ -494,9 +494,9 @@ zfsctl_inode_alloc(zfsvfs_t *zfsvfs, uint64_t id,
|
||||
if (!creation)
|
||||
now = current_time(ip);
|
||||
zp = ITOZ(ip);
|
||||
ASSERT3P(zp->z_dirlocks, ==, NULL);
|
||||
ASSERT3P(zp->z_acl_cached, ==, NULL);
|
||||
ASSERT3P(zp->z_xattr_cached, ==, NULL);
|
||||
ASSERT0P(zp->z_dirlocks);
|
||||
ASSERT0P(zp->z_acl_cached);
|
||||
ASSERT0P(zp->z_xattr_cached);
|
||||
zp->z_id = id;
|
||||
zp->z_unlinked = B_FALSE;
|
||||
zp->z_atime_dirty = B_FALSE;
|
||||
|
||||
@@ -883,7 +883,7 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t mounting)
|
||||
* operations out since we closed the ZIL.
|
||||
*/
|
||||
if (mounting) {
|
||||
ASSERT3P(zfsvfs->z_kstat.dk_kstats, ==, NULL);
|
||||
ASSERT0P(zfsvfs->z_kstat.dk_kstats);
|
||||
error = dataset_kstats_create(&zfsvfs->z_kstat, zfsvfs->z_os);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@@ -3157,7 +3157,7 @@ top:
|
||||
* zfs_link_create() to add back the same entry, but with a new
|
||||
* dnode (szp), should not fail.
|
||||
*/
|
||||
ASSERT3P(tzp, ==, NULL);
|
||||
ASSERT0P(tzp);
|
||||
goto commit_link_tzp;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,9 +144,9 @@ zfs_znode_cache_destructor(void *buf, void *arg)
|
||||
rw_destroy(&zp->z_xattr_lock);
|
||||
zfs_rangelock_fini(&zp->z_rangelock);
|
||||
|
||||
ASSERT3P(zp->z_dirlocks, ==, NULL);
|
||||
ASSERT3P(zp->z_acl_cached, ==, NULL);
|
||||
ASSERT3P(zp->z_xattr_cached, ==, NULL);
|
||||
ASSERT0P(zp->z_dirlocks);
|
||||
ASSERT0P(zp->z_acl_cached);
|
||||
ASSERT0P(zp->z_xattr_cached);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -531,8 +531,8 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
|
||||
|
||||
zp = ITOZ(ip);
|
||||
ASSERT0P(zp->z_dirlocks);
|
||||
ASSERT3P(zp->z_acl_cached, ==, NULL);
|
||||
ASSERT3P(zp->z_xattr_cached, ==, NULL);
|
||||
ASSERT0P(zp->z_acl_cached);
|
||||
ASSERT0P(zp->z_xattr_cached);
|
||||
zp->z_unlinked = B_FALSE;
|
||||
zp->z_atime_dirty = B_FALSE;
|
||||
zp->z_is_ctldir = B_FALSE;
|
||||
|
||||
@@ -1494,7 +1494,7 @@ zpl_posix_acl_free(void *arg)
|
||||
acl_rel_head = NULL;
|
||||
if (cmpxchg(&acl_rel_tail, &a->next,
|
||||
&acl_rel_head) == &a->next) {
|
||||
ASSERT3P(a->next, ==, NULL);
|
||||
ASSERT0P(a->next);
|
||||
a->next = freelist;
|
||||
freelist = a;
|
||||
break;
|
||||
@@ -1544,7 +1544,7 @@ zpl_posix_acl_release_impl(struct posix_acl *acl)
|
||||
a->time = ddi_get_lbolt();
|
||||
/* atomically points tail to us and get the previous tail */
|
||||
prev = xchg(&acl_rel_tail, &a->next);
|
||||
ASSERT3P(*prev, ==, NULL);
|
||||
ASSERT0P(*prev);
|
||||
*prev = a;
|
||||
/* if it was empty before, schedule the free task */
|
||||
if (prev == &acl_rel_head)
|
||||
|
||||
@@ -1426,7 +1426,7 @@ zvol_os_free(zvol_state_t *zv)
|
||||
ASSERT(!RW_LOCK_HELD(&zv->zv_suspend_lock));
|
||||
ASSERT(!MUTEX_HELD(&zv->zv_state_lock));
|
||||
ASSERT0(zv->zv_open_count);
|
||||
ASSERT3P(zv->zv_zso->zvo_disk->private_data, ==, NULL);
|
||||
ASSERT0P(zv->zv_zso->zvo_disk->private_data);
|
||||
|
||||
rw_destroy(&zv->zv_suspend_lock);
|
||||
zfs_rangelock_fini(&zv->zv_rangelock);
|
||||
@@ -1649,11 +1649,11 @@ zvol_os_create_minor(const char *name)
|
||||
blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, zv->zv_zso->zvo_queue);
|
||||
#endif
|
||||
|
||||
ASSERT3P(zv->zv_kstat.dk_kstats, ==, NULL);
|
||||
ASSERT0P(zv->zv_kstat.dk_kstats);
|
||||
error = dataset_kstats_create(&zv->zv_kstat, zv->zv_objset);
|
||||
if (error)
|
||||
goto out_dmu_objset_disown;
|
||||
ASSERT3P(zv->zv_zilog, ==, NULL);
|
||||
ASSERT0P(zv->zv_zilog);
|
||||
zv->zv_zilog = zil_open(os, zvol_get_data, &zv->zv_kstat.dk_zil_sums);
|
||||
if (spa_writeable(dmu_objset_spa(os))) {
|
||||
if (zil_replay_disable)
|
||||
|
||||
Reference in New Issue
Block a user