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

Function ztest_lookup

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

* Lookup a bunch of objects. Returns the number of objects not found. */

Source from the content-addressed store, hash-verified

2384 * Lookup a bunch of objects. Returns the number of objects not found.
2385 */
2386static int
2387ztest_lookup(ztest_ds_t *zd, ztest_od_t *od, int count)
2388{
2389 int missing = 0;
2390 int error;
2391 int i;
2392
2393 ASSERT(MUTEX_HELD(&zd->zd_dirobj_lock));
2394
2395 for (i = 0; i < count; i++, od++) {
2396 od->od_object = 0;
2397 error = zap_lookup(zd->zd_os, od->od_dir, od->od_name,
2398 sizeof (uint64_t), 1, &od->od_object);
2399 if (error) {
2400 ASSERT(error == ENOENT);
2401 ASSERT(od->od_object == 0);
2402 missing++;
2403 } else {
2404 dmu_buf_t *db;
2405 ztest_block_tag_t *bbt;
2406 dmu_object_info_t doi;
2407
2408 ASSERT(od->od_object != 0);
2409 ASSERT(missing == 0); /* there should be no gaps */
2410
2411 ztest_object_lock(zd, od->od_object, RL_READER);
2412 VERIFY3U(0, ==, dmu_bonus_hold(zd->zd_os,
2413 od->od_object, FTAG, &db));
2414 dmu_object_info_from_db(db, &doi);
2415 bbt = ztest_bt_bonus(db);
2416 ASSERT3U(bbt->bt_magic, ==, BT_MAGIC);
2417 od->od_type = doi.doi_type;
2418 od->od_blocksize = doi.doi_data_block_size;
2419 od->od_gen = bbt->bt_gen;
2420 dmu_buf_rele(db, FTAG);
2421 ztest_object_unlock(zd, od->od_object);
2422 }
2423 }
2424
2425 return (missing);
2426}
2427
2428static int
2429ztest_create(ztest_ds_t *zd, ztest_od_t *od, int count)

Callers 1

ztest_object_initFunction · 0.85

Calls 7

zap_lookupFunction · 0.85
ztest_object_lockFunction · 0.85
dmu_bonus_holdFunction · 0.85
dmu_object_info_from_dbFunction · 0.85
ztest_bt_bonusFunction · 0.85
dmu_buf_releFunction · 0.85
ztest_object_unlockFunction · 0.85

Tested by

no test coverage detected