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

Function ztest_zap_parallel

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

ARGSUSED */

Source from the content-addressed store, hash-verified

5310
5311/* ARGSUSED */
5312void
5313ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
5314{
5315 objset_t *os = zd->zd_os;
5316 ztest_od_t *od;
5317 uint64_t txg, object, count, wsize, wc, zl_wsize, zl_wc;
5318 dmu_tx_t *tx;
5319 int i, namelen, error;
5320 int micro = ztest_random(2);
5321 char name[20], string_value[20];
5322 void *data;
5323
5324 od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
5325 ztest_od_init(od, ID_PARALLEL, FTAG, micro, DMU_OT_ZAP_OTHER, 0, 0, 0);
5326
5327 if (ztest_object_init(zd, od, sizeof (ztest_od_t), B_FALSE) != 0) {
5328 umem_free(od, sizeof (ztest_od_t));
5329 return;
5330 }
5331
5332 object = od->od_object;
5333
5334 /*
5335 * Generate a random name of the form 'xxx.....' where each
5336 * x is a random printable character and the dots are dots.
5337 * There are 94 such characters, and the name length goes from
5338 * 6 to 20, so there are 94^3 * 15 = 12,458,760 possible names.
5339 */
5340 namelen = ztest_random(sizeof (name) - 5) + 5 + 1;
5341
5342 for (i = 0; i < 3; i++)
5343 name[i] = '!' + ztest_random('~' - '!' + 1);
5344 for (; i < namelen - 1; i++)
5345 name[i] = '.';
5346 name[i] = '\0';
5347
5348 if ((namelen & 1) || micro) {
5349 wsize = sizeof (txg);
5350 wc = 1;
5351 data = &txg;
5352 } else {
5353 wsize = 1;
5354 wc = namelen;
5355 data = string_value;
5356 }
5357
5358 count = -1ULL;
5359 VERIFY0(zap_count(os, object, &count));
5360 ASSERT(count != -1ULL);
5361
5362 /*
5363 * Select an operation: length, lookup, add, update, remove.
5364 */
5365 i = ztest_random(5);
5366
5367 if (i >= 2) {
5368 tx = dmu_tx_create(os);
5369 dmu_tx_hold_zap(tx, object, B_TRUE, NULL);

Callers

nothing calls this directly

Calls 15

ztest_randomFunction · 0.85
umem_allocFunction · 0.85
ztest_od_initFunction · 0.85
ztest_object_initFunction · 0.85
umem_freeFunction · 0.85
zap_countFunction · 0.85
dmu_tx_createFunction · 0.85
dmu_tx_hold_zapFunction · 0.85
ztest_tx_assignFunction · 0.85
bzeroFunction · 0.85
zap_lengthFunction · 0.85
zap_lookupFunction · 0.85

Tested by

no test coverage detected