Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: iXsystems, Inc.
Closes #15887
ddt_object_name(ddt, type, class, name);
ddt_object_name(ddt, type, class, name);
- ASSERT(*objectp == 0);
- VERIFY(ddt_ops[type]->ddt_op_create(os, objectp, tx, prehash) == 0);
- ASSERT(*objectp != 0);
+ ASSERT3U(*objectp, ==, 0);
+ VERIFY0(ddt_ops[type]->ddt_op_create(os, objectp, tx, prehash));
+ ASSERT3U(*objectp, !=, 0);
- VERIFY(zap_add(os, DMU_POOL_DIRECTORY_OBJECT, name,
- sizeof (uint64_t), 1, objectp, tx) == 0);
+ VERIFY0(zap_add(os, DMU_POOL_DIRECTORY_OBJECT, name,
+ sizeof (uint64_t), 1, objectp, tx));
- VERIFY(zap_add(os, spa->spa_ddt_stat_object, name,
+ VERIFY0(zap_add(os, spa->spa_ddt_stat_object, name,
sizeof (uint64_t), sizeof (ddt_histogram_t) / sizeof (uint64_t),
sizeof (uint64_t), sizeof (ddt_histogram_t) / sizeof (uint64_t),
- &ddt->ddt_histogram[type][class], tx) == 0);
+ &ddt->ddt_histogram[type][class], tx));
ddt_object_name(ddt, type, class, name);
ddt_object_name(ddt, type, class, name);
+ ASSERT3U(*objectp, !=, 0);
ASSERT(ddt_histogram_empty(&ddt->ddt_histogram[type][class]));
ASSERT(ddt_histogram_empty(&ddt->ddt_histogram[type][class]));
- VERIFY(ddt_object_count(ddt, type, class, &count) == 0 && count == 0);
- VERIFY(zap_remove(os, DMU_POOL_DIRECTORY_OBJECT, name, tx) == 0);
- VERIFY(zap_remove(os, spa->spa_ddt_stat_object, name, tx) == 0);
- VERIFY(ddt_ops[type]->ddt_op_destroy(os, *objectp, tx) == 0);
+ VERIFY0(ddt_object_count(ddt, type, class, &count));
+ VERIFY0(count);
+ VERIFY0(zap_remove(os, DMU_POOL_DIRECTORY_OBJECT, name, tx));
+ VERIFY0(zap_remove(os, spa->spa_ddt_stat_object, name, tx));
+ VERIFY0(ddt_ops[type]->ddt_op_destroy(os, *objectp, tx));
memset(&ddt->ddt_object_stats[type][class], 0, sizeof (ddt_object_t));
*objectp = 0;
memset(&ddt->ddt_object_stats[type][class], 0, sizeof (ddt_object_t));
*objectp = 0;
ddt_object_name(ddt, type, class, name);
ddt_object_name(ddt, type, class, name);
- VERIFY(zap_update(ddt->ddt_os, ddt->ddt_spa->spa_ddt_stat_object, name,
+ VERIFY0(zap_update(ddt->ddt_os, ddt->ddt_spa->spa_ddt_stat_object, name,
sizeof (uint64_t), sizeof (ddt_histogram_t) / sizeof (uint64_t),
sizeof (uint64_t), sizeof (ddt_histogram_t) / sizeof (uint64_t),
- &ddt->ddt_histogram[type][class], tx) == 0);
+ &ddt->ddt_histogram[type][class], tx));
/*
* Cache DDT statistics; this is the only time they'll change.
*/
/*
* Cache DDT statistics; this is the only time they'll change.
*/
- VERIFY(ddt_object_info(ddt, type, class, &doi) == 0);
- VERIFY(ddt_object_count(ddt, type, class, &count) == 0);
+ VERIFY0(ddt_object_info(ddt, type, class, &doi));
+ VERIFY0(ddt_object_count(ddt, type, class, &count));
ddo->ddo_count = count;
ddo->ddo_dspace = doi.doi_physical_blocks_512 << 9;
ddo->ddo_count = count;
ddo->ddo_dspace = doi.doi_physical_blocks_512 << 9;
void
ddt_bp_fill(const ddt_phys_t *ddp, blkptr_t *bp, uint64_t txg)
{
void
ddt_bp_fill(const ddt_phys_t *ddp, blkptr_t *bp, uint64_t txg)
{
for (int d = 0; d < SPA_DVAS_PER_BP; d++)
bp->blk_dva[d] = ddp->ddp_dva[d];
for (int d = 0; d < SPA_DVAS_PER_BP; d++)
bp->blk_dva[d] = ddp->ddp_dva[d];
void
ddt_phys_fill(ddt_phys_t *ddp, const blkptr_t *bp)
{
void
ddt_phys_fill(ddt_phys_t *ddp, const blkptr_t *bp)
{
- ASSERT(ddp->ddp_phys_birth == 0);
+ ASSERT0(ddp->ddp_phys_birth);
for (int d = 0; d < SPA_DVAS_PER_BP; d++)
ddp->ddp_dva[d] = bp->blk_dva[d];
for (int d = 0; d < SPA_DVAS_PER_BP; d++)
ddp->ddp_dva[d] = bp->blk_dva[d];
ddt_phys_decref(ddt_phys_t *ddp)
{
if (ddp) {
ddt_phys_decref(ddt_phys_t *ddp)
{
if (ddp) {
- ASSERT(ddp->ddp_refcnt > 0);
+ ASSERT3U(ddp->ddp_refcnt, >, 0);
ddt_stat_generate(ddt, dde, &dds);
bucket = highbit64(dds.dds_ref_blocks) - 1;
ddt_stat_generate(ddt, dde, &dds);
bucket = highbit64(dds.dds_ref_blocks) - 1;
+ ASSERT3U(bucket, >=, 0);
ddh = &ddt->ddt_histogram[dde->dde_type][dde->dde_class];
ddh = &ddt->ddt_histogram[dde->dde_type][dde->dde_class];
zio_compress_info_t *ci = &zio_compress_table[cpfunc];
size_t c_len;
zio_compress_info_t *ci = &zio_compress_table[cpfunc];
size_t c_len;
- ASSERT(d_len >= s_len + 1); /* no compression plus version byte */
+ ASSERT3U(d_len, >=, s_len + 1); /* no compression plus version byte */
c_len = ci->ci_compress(src, dst, s_len, d_len - 1, ci->ci_level);
c_len = ci->ci_compress(src, dst, s_len, d_len - 1, ci->ci_level);
ASSERT(!dde->dde_loading);
for (int p = 0; p < DDT_PHYS_TYPES; p++)
ASSERT(!dde->dde_loading);
for (int p = 0; p < DDT_PHYS_TYPES; p++)
- ASSERT(dde->dde_lead_zio[p] == NULL);
+ ASSERT3P(dde->dde_lead_zio[p], ==, NULL);
if (dde->dde_repair_abd != NULL)
abd_free(dde->dde_repair_abd);
if (dde->dde_repair_abd != NULL)
abd_free(dde->dde_repair_abd);
- ASSERT(dde->dde_loaded == B_FALSE);
- ASSERT(dde->dde_loading == B_TRUE);
+ ASSERT(!dde->dde_loaded);
+ ASSERT(dde->dde_loading);
dde->dde_type = type; /* will be DDT_TYPES if no entry found */
dde->dde_class = class; /* will be DDT_CLASSES if no entry found */
dde->dde_type = type; /* will be DDT_TYPES if no entry found */
dde->dde_class = class; /* will be DDT_CLASSES if no entry found */
static void
ddt_table_free(ddt_t *ddt)
{
static void
ddt_table_free(ddt_t *ddt)
{
- ASSERT(avl_numnodes(&ddt->ddt_tree) == 0);
- ASSERT(avl_numnodes(&ddt->ddt_repair_tree) == 0);
+ ASSERT0(avl_numnodes(&ddt->ddt_tree));
+ ASSERT0(avl_numnodes(&ddt->ddt_repair_tree));
avl_destroy(&ddt->ddt_tree);
avl_destroy(&ddt->ddt_repair_tree);
mutex_destroy(&ddt->ddt_lock);
avl_destroy(&ddt->ddt_tree);
avl_destroy(&ddt->ddt_repair_tree);
mutex_destroy(&ddt->ddt_lock);
ASSERT(!dde->dde_loading);
for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
ASSERT(!dde->dde_loading);
for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
- ASSERT(dde->dde_lead_zio[p] == NULL);
+ ASSERT3P(dde->dde_lead_zio[p], ==, NULL);
if (ddp->ddp_phys_birth == 0) {
if (ddp->ddp_phys_birth == 0) {
- ASSERT(ddp->ddp_refcnt == 0);
+ ASSERT0(ddp->ddp_refcnt);
continue;
}
if (p == DDT_PHYS_DITTO) {
continue;
}
if (p == DDT_PHYS_DITTO) {
if (otype != DDT_TYPES &&
(otype != ntype || oclass != nclass || total_refcnt == 0)) {
if (otype != DDT_TYPES &&
(otype != ntype || oclass != nclass || total_refcnt == 0)) {
- VERIFY(ddt_object_remove(ddt, otype, oclass, dde, tx) == 0);
- ASSERT(ddt_object_lookup(ddt, otype, oclass, dde) == ENOENT);
+ VERIFY0(ddt_object_remove(ddt, otype, oclass, dde, tx));
+ ASSERT3U(
+ ddt_object_lookup(ddt, otype, oclass, dde), ==, ENOENT);
}
if (total_refcnt != 0) {
}
if (total_refcnt != 0) {
ddt_stat_update(ddt, dde, 0);
if (!ddt_object_exists(ddt, ntype, nclass))
ddt_object_create(ddt, ntype, nclass, tx);
ddt_stat_update(ddt, dde, 0);
if (!ddt_object_exists(ddt, ntype, nclass))
ddt_object_create(ddt, ntype, nclass, tx);
- VERIFY(ddt_object_update(ddt, ntype, nclass, dde, tx) == 0);
+ VERIFY0(ddt_object_update(ddt, ntype, nclass, dde, tx));
/*
* If the class changes, the order that we scan this bp
/*
* If the class changes, the order that we scan this bp
if (avl_numnodes(&ddt->ddt_tree) == 0)
return;
if (avl_numnodes(&ddt->ddt_tree) == 0)
return;
- ASSERT(spa->spa_uberblock.ub_version >= SPA_VERSION_DEDUP);
+ ASSERT3U(spa->spa_uberblock.ub_version, >=, SPA_VERSION_DEDUP);
if (spa->spa_ddt_stat_object == 0) {
spa->spa_ddt_stat_object = zap_create_link(ddt->ddt_os,
if (spa->spa_ddt_stat_object == 0) {
spa->spa_ddt_stat_object = zap_create_link(ddt->ddt_os,
for (enum ddt_class class = 0; class < DDT_CLASSES; class++) {
if (ddt_object_exists(ddt, type, class)) {
ddt_object_sync(ddt, type, class, tx);
for (enum ddt_class class = 0; class < DDT_CLASSES; class++) {
if (ddt_object_exists(ddt, type, class)) {
ddt_object_sync(ddt, type, class, tx);
- VERIFY(ddt_object_count(ddt, type, class,
- &add) == 0);
+ VERIFY0(ddt_object_count(ddt, type, class,
+ &add));
dmu_tx_t *tx;
zio_t *rio;
dmu_tx_t *tx;
zio_t *rio;
- ASSERT(spa_syncing_txg(spa) == txg);
+ ASSERT3U(spa_syncing_txg(spa), ==, txg);
tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg);
tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg);
ddt_enter(ddt);
dde = ddt_lookup(ddt, bp, B_TRUE);
ddt_enter(ddt);
dde = ddt_lookup(ddt, bp, B_TRUE);
+ ASSERT3P(dde, !=, NULL);
if (dde->dde_type < DDT_TYPES) {
ddt_phys_t *ddp;
if (dde->dde_type < DDT_TYPES) {
ddt_phys_t *ddp;
- ASSERT(one == 1);
- ASSERT(csize <= (sizeof (dde->dde_phys) + 1));
+ ASSERT3U(one, ==, 1);
+ ASSERT3U(csize, <=, (sizeof (dde->dde_phys) + 1));
error = zap_lookup_uint64(os, object, (uint64_t *)&dde->dde_key,
DDT_KEY_WORDS, 1, csize, cbuf);
error = zap_lookup_uint64(os, object, (uint64_t *)&dde->dde_key,
DDT_KEY_WORDS, 1, csize, cbuf);
if ((error = zap_cursor_retrieve(&zc, &za)) == 0) {
uchar_t cbuf[sizeof (dde->dde_phys) + 1];
uint64_t csize = za.za_num_integers;
if ((error = zap_cursor_retrieve(&zc, &za)) == 0) {
uchar_t cbuf[sizeof (dde->dde_phys) + 1];
uint64_t csize = za.za_num_integers;
- ASSERT(za.za_integer_length == 1);
+ ASSERT3U(za.za_integer_length, ==, 1);
error = zap_lookup_uint64(os, object, (uint64_t *)za.za_name,
DDT_KEY_WORDS, 1, csize, cbuf);
error = zap_lookup_uint64(os, object, (uint64_t *)za.za_name,
DDT_KEY_WORDS, 1, csize, cbuf);
if (error == 0) {
ddt_decompress(cbuf, dde->dde_phys, csize,
sizeof (dde->dde_phys));
if (error == 0) {
ddt_decompress(cbuf, dde->dde_phys, csize,
sizeof (dde->dde_phys));