MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ztest_dmu_object_alloc_free

Function ztest_dmu_object_alloc_free

freebsd/contrib/openzfs/cmd/ztest/ztest.c:4468–4496  ·  view source on GitHub ↗

* Verify that dmu_object_{alloc,free} work as expected. */

Source from the content-addressed store, hash-verified

4466 * Verify that dmu_object_{alloc,free} work as expected.
4467 */
4468void
4469ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
4470{
4471 ztest_od_t *od;
4472 int batchsize;
4473 int size;
4474 int b;
4475
4476 size = sizeof (ztest_od_t) * OD_ARRAY_SIZE;
4477 od = umem_alloc(size, UMEM_NOFAIL);
4478 batchsize = OD_ARRAY_SIZE;
4479
4480 for (b = 0; b < batchsize; b++)
4481 ztest_od_init(od + b, id, FTAG, b, DMU_OT_UINT64_OTHER,
4482 0, 0, 0);
4483
4484 /*
4485 * Destroy the previous batch of objects, create a new batch,
4486 * and do some I/O on the new objects.
4487 */
4488 if (ztest_object_init(zd, od, size, B_TRUE) != 0)
4489 return;
4490
4491 while (ztest_random(4 * batchsize) != 0)
4492 ztest_io(zd, od[ztest_random(batchsize)].od_object,
4493 ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT);
4494
4495 umem_free(od, size);
4496}
4497
4498/*
4499 * Rewind the global allocator to verify object allocation backfilling.

Callers 2

ztest_freezeFunction · 0.85

Calls 6

umem_allocFunction · 0.85
ztest_od_initFunction · 0.85
ztest_object_initFunction · 0.85
ztest_randomFunction · 0.85
ztest_ioFunction · 0.85
umem_freeFunction · 0.85

Tested by

no test coverage detected