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

Function ztest_create

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

Source from the content-addressed store, hash-verified

2426}
2427
2428static int
2429ztest_create(ztest_ds_t *zd, ztest_od_t *od, int count)
2430{
2431 int missing = 0;
2432 int i;
2433
2434 ASSERT(MUTEX_HELD(&zd->zd_dirobj_lock));
2435
2436 for (i = 0; i < count; i++, od++) {
2437 if (missing) {
2438 od->od_object = 0;
2439 missing++;
2440 continue;
2441 }
2442
2443 lr_create_t *lr = ztest_lr_alloc(sizeof (*lr), od->od_name);
2444
2445 lr->lr_doid = od->od_dir;
2446 lr->lr_foid = 0; /* 0 to allocate, > 0 to claim */
2447 lr->lrz_type = od->od_crtype;
2448 lr->lrz_blocksize = od->od_crblocksize;
2449 lr->lrz_ibshift = ztest_random_ibshift();
2450 lr->lrz_bonustype = DMU_OT_UINT64_OTHER;
2451 lr->lrz_dnodesize = od->od_crdnodesize;
2452 lr->lr_gen = od->od_crgen;
2453 lr->lr_crtime[0] = time(NULL);
2454
2455 if (ztest_replay_create(zd, lr, B_FALSE) != 0) {
2456 ASSERT(missing == 0);
2457 od->od_object = 0;
2458 missing++;
2459 } else {
2460 od->od_object = lr->lr_foid;
2461 od->od_type = od->od_crtype;
2462 od->od_blocksize = od->od_crblocksize;
2463 od->od_gen = od->od_crgen;
2464 ASSERT(od->od_object != 0);
2465 }
2466
2467 ztest_lr_free(lr, sizeof (*lr), od->od_name);
2468 }
2469
2470 return (missing);
2471}
2472
2473static int
2474ztest_remove(ztest_ds_t *zd, ztest_od_t *od, int count)

Callers 1

ztest_object_initFunction · 0.85

Calls 4

ztest_lr_allocFunction · 0.85
ztest_random_ibshiftFunction · 0.85
ztest_replay_createFunction · 0.85
ztest_lr_freeFunction · 0.85

Tested by

no test coverage detected