* Lookup a bunch of objects. Returns the number of objects not found. */
| 2384 | * Lookup a bunch of objects. Returns the number of objects not found. |
| 2385 | */ |
| 2386 | static int |
| 2387 | ztest_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 | |
| 2428 | static int |
| 2429 | ztest_create(ztest_ds_t *zd, ztest_od_t *od, int count) |
no test coverage detected