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

Function ztest_random_dnodesize

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

Source from the content-addressed store, hash-verified

1291}
1292
1293static int
1294ztest_random_dnodesize(void)
1295{
1296 int slots;
1297 int max_slots = spa_maxdnodesize(ztest_spa) >> DNODE_SHIFT;
1298
1299 if (max_slots == DNODE_MIN_SLOTS)
1300 return (DNODE_MIN_SIZE);
1301
1302 /*
1303 * Weight the random distribution more heavily toward smaller
1304 * dnode sizes since that is more likely to reflect real-world
1305 * usage.
1306 */
1307 ASSERT3U(max_slots, >, 4);
1308 switch (ztest_random(10)) {
1309 case 0:
1310 slots = 5 + ztest_random(max_slots - 4);
1311 break;
1312 case 1 ... 4:
1313 slots = 2 + ztest_random(3);
1314 break;
1315 default:
1316 slots = 1;
1317 break;
1318 }
1319
1320 return (slots << DNODE_SHIFT);
1321}
1322
1323static int
1324ztest_random_ibshift(void)

Callers 1

ztest_od_initFunction · 0.85

Calls 2

spa_maxdnodesizeFunction · 0.85
ztest_randomFunction · 0.85

Tested by

no test coverage detected