* Verify that dmu_object_{alloc,free} work as expected. */
| 4466 | * Verify that dmu_object_{alloc,free} work as expected. |
| 4467 | */ |
| 4468 | void |
| 4469 | ztest_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. |
no test coverage detected