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

Function vdev_metaslab_group_create

freebsd/contrib/openzfs/module/zfs/vdev.c:1286–1337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1284}
1285
1286static void
1287vdev_metaslab_group_create(vdev_t *vd)
1288{
1289 spa_t *spa = vd->vdev_spa;
1290
1291 /*
1292 * metaslab_group_create was delayed until allocation bias was available
1293 */
1294 if (vd->vdev_mg == NULL) {
1295 metaslab_class_t *mc;
1296
1297 if (vd->vdev_islog && vd->vdev_alloc_bias == VDEV_BIAS_NONE)
1298 vd->vdev_alloc_bias = VDEV_BIAS_LOG;
1299
1300 ASSERT3U(vd->vdev_islog, ==,
1301 (vd->vdev_alloc_bias == VDEV_BIAS_LOG));
1302
1303 switch (vd->vdev_alloc_bias) {
1304 case VDEV_BIAS_LOG:
1305 mc = spa_log_class(spa);
1306 break;
1307 case VDEV_BIAS_SPECIAL:
1308 mc = spa_special_class(spa);
1309 break;
1310 case VDEV_BIAS_DEDUP:
1311 mc = spa_dedup_class(spa);
1312 break;
1313 default:
1314 mc = spa_normal_class(spa);
1315 }
1316
1317 vd->vdev_mg = metaslab_group_create(mc, vd,
1318 spa->spa_alloc_count);
1319
1320 /*
1321 * The spa ashift min/max only apply for the normal metaslab
1322 * class. Class destination is late binding so ashift boundry
1323 * setting had to wait until now.
1324 */
1325 if (vd->vdev_top == vd && vd->vdev_ashift != 0 &&
1326 mc == spa_normal_class(spa) && vd->vdev_aux == NULL) {
1327 if (vd->vdev_ashift > spa->spa_max_ashift)
1328 spa->spa_max_ashift = vd->vdev_ashift;
1329 if (vd->vdev_ashift < spa->spa_min_ashift)
1330 spa->spa_min_ashift = vd->vdev_ashift;
1331
1332 uint64_t min_alloc = vdev_get_min_alloc(vd);
1333 if (min_alloc < spa->spa_min_alloc)
1334 spa->spa_min_alloc = min_alloc;
1335 }
1336 }
1337}
1338
1339int
1340vdev_metaslab_init(vdev_t *vd, uint64_t txg)

Callers 3

vdev_metaslab_initFunction · 0.85
vdev_loadFunction · 0.85
vdev_expandFunction · 0.85

Calls 6

spa_log_classFunction · 0.85
spa_special_classFunction · 0.85
spa_dedup_classFunction · 0.85
spa_normal_classFunction · 0.85
metaslab_group_createFunction · 0.85
vdev_get_min_allocFunction · 0.85

Tested by

no test coverage detected