diff --git a/balloc/balloc.c b/balloc/balloc.c index 7ecaa43188f..95cf1a56a54 100644 --- a/balloc/balloc.c +++ b/balloc/balloc.c @@ -1711,6 +1711,7 @@ static int balloc_alloc_db_update(struct m0_balloc *motr, struct m0_be_tx *tx, key = (struct m0_buf)M0_BUF_INIT_PTR(&cur->e_end); rc = btree_delete_sync(db, tx, &key); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); @@ -1721,6 +1722,7 @@ static int balloc_alloc_db_update(struct m0_balloc *motr, struct m0_be_tx *tx, /* +------+-------+--------------------+ */ cur->e_end = tgt->e_start; rc = balloc_ext_insert(db, tx, *cur); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); maxchunk = max_check(maxchunk, m0_ext_length(cur)); @@ -1742,6 +1744,7 @@ static int balloc_alloc_db_update(struct m0_balloc *motr, struct m0_be_tx *tx, /* +------------+----------------------+ */ cur->e_start = tgt->e_end; rc = balloc_ext_update(db, tx, *cur); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); @@ -1754,9 +1757,11 @@ static int balloc_alloc_db_update(struct m0_balloc *motr, struct m0_be_tx *tx, /* +-------+---------+-----------------+ */ new.e_end = tgt->e_start; le = lext_create(&new); + M0_ASSERT(le != NULL); if (le == NULL) return M0_RC(-ENOMEM); rc = balloc_ext_insert(db, tx, new); + M0_ASSERT(rc == 0); if (rc != 0) { m0_free(le); return M0_RC(rc); @@ -1854,9 +1859,11 @@ static int balloc_free_db_update(struct m0_balloc *motr, /* | | tgt free | | */ /* +-------+------------------+--------+ */ le = lext_create(tgt); + M0_ASSERT(le != NULL); if (le == NULL) return M0_RC(-ENOMEM); rc = balloc_ext_insert(db, tx, *tgt); + M0_ASSERT(rc == 0); if (rc != 0) { m0_free(le); return M0_RC(rc); @@ -1873,9 +1880,11 @@ static int balloc_free_db_update(struct m0_balloc *motr, /* | | | tgt free | */ /* +-----------+--+--------------------+ */ le = lext_create(tgt); + M0_ASSERT(le != NULL); if (le == NULL) return M0_RC(-ENOMEM); rc = balloc_ext_insert(db, tx, *tgt); + M0_ASSERT(rc == 0); if (rc != 0) { m0_free(le); return M0_RC(rc); @@ -1891,10 +1900,12 @@ static int balloc_free_db_update(struct m0_balloc *motr, M0_ASSERT(cur->e_end == tgt->e_start); key = (struct m0_buf)M0_BUF_INIT_PTR(&cur->e_end); rc = btree_delete_sync(db, tx, &key); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); cur->e_end = tgt->e_end; rc = balloc_ext_insert(db, tx, *cur); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); maxchunk = max_check(maxchunk, m0_ext_length(cur)); @@ -1909,9 +1920,11 @@ static int balloc_free_db_update(struct m0_balloc *motr, /* | | tgt | | | */ /* +-+---------+---+-------------------+ */ le = lext_create(tgt); + M0_ASSERT(le != NULL); if (le == NULL) return M0_RC(-ENOMEM); rc = balloc_ext_insert(db, tx, *tgt); + M0_ASSERT(rc == 0); if (rc != 0) { m0_free(le); return M0_RC(rc); @@ -1928,6 +1941,7 @@ static int balloc_free_db_update(struct m0_balloc *motr, M0_ASSERT(tgt->e_end == cur->e_start); cur->e_start = tgt->e_start; rc = balloc_ext_update(db, tx, *cur); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); maxchunk = max_check(maxchunk, m0_ext_length(cur)); @@ -1943,10 +1957,12 @@ static int balloc_free_db_update(struct m0_balloc *motr, /* +-------+-------+-------------------+ */ key = (struct m0_buf)M0_BUF_INIT_PTR(&pre->e_end); rc = btree_delete_sync(db, tx, &key); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); cur->e_start = pre->e_start; rc = balloc_ext_update(db, tx, *cur); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); le = container_of(pre, struct m0_lext, le_ext); @@ -1961,10 +1977,12 @@ static int balloc_free_db_update(struct m0_balloc *motr, /* +-------+-------+-------------------+ */ key = (struct m0_buf)M0_BUF_INIT_PTR(&pre->e_end); rc = btree_delete_sync(db, tx, &key); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); pre->e_end = tgt->e_end; rc = balloc_ext_insert(db, tx, *pre); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); maxchunk = max_check(maxchunk, m0_ext_length(pre)); @@ -1976,6 +1994,7 @@ static int balloc_free_db_update(struct m0_balloc *motr, /* +----------+-------+----------------+ */ cur->e_start = tgt->e_start; rc = balloc_ext_update(db, tx, *cur); + M0_ASSERT(rc == 0); if (rc != 0) return M0_RC(rc); maxchunk = max_check(maxchunk, m0_ext_length(cur)); @@ -1986,9 +2005,11 @@ static int balloc_free_db_update(struct m0_balloc *motr, /* | | tgt | | */ /* +----------+-------+----------------+ */ le = lext_create(tgt); + M0_ASSERT(le != NULL); if (le == NULL) return M0_RC(-ENOMEM); rc = balloc_ext_insert(db, tx, *tgt); + M0_ASSERT(rc == 0); if (rc != 0) { m0_free(le); return M0_RC(rc); @@ -2078,6 +2099,7 @@ static int balloc_find_by_goal(struct m0_balloc_allocation_context *bac) ret = balloc_alloc_db_update(bac->bac_ctxt, tx, grp, &bac->bac_final); + M0_ASSERT(ret == 0); } m0_balloc_release_extents(grp); @@ -2445,6 +2467,7 @@ static int balloc_try_best_found(struct balloc_allocation_context *bac, &cur)); rc = balloc_alloc_db_update(bac->bac_ctxt, bac->bac_tx, grp, &bac->bac_final, alloc_flag, cur); + M0_ASSERT(rc == 0); } out: m0_balloc_unlock_group(grp); @@ -2646,6 +2669,7 @@ static int allocate_blocks(int cr, struct balloc_allocation_context *bac, &cur)); rc = balloc_alloc_db_update(bac->bac_ctxt, bac->bac_tx, grp, &bac->bac_final, alloc_type, cur); + M0_ASSERT(rc == 0); } return rc; } @@ -2790,6 +2814,7 @@ static int balloc_free_internal(struct m0_balloc *ctx, fex.e_end = grp->bgi_spare.bzp_range.e_start; rc = balloc_free_db_update(ctx, tx, grp, &fex, M0_BALLOC_NORMAL_ZONE); + M0_ASSERT(rc == 0); if (rc != 0) break; fex.e_start = zone_start_get(grp, @@ -2797,9 +2822,11 @@ static int balloc_free_internal(struct m0_balloc *ctx, fex.e_end = start + step; alloc_flag = M0_BALLOC_SPARE_ZONE; } - if (rc == 0) + if (rc == 0) { rc = balloc_free_db_update(ctx, tx, grp, &fex, alloc_flag); + M0_ASSERT(rc == 0); + } m0_balloc_unlock_group(grp); start += step; len -= step; @@ -2936,6 +2963,7 @@ static int balloc_reserve_extent(struct m0_ad_balloc *ballroom, } rc = balloc_alloc_db_update(ctx, tx, grp, ext, alloc_zone, cur); + M0_ASSERT(rc == 0); out_unlock: m0_balloc_unlock_group(grp);