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

Function vdev_get_min_asize

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

* Get the minimum allocatable size. We define the allocatable size as * the vdev's asize rounded to the nearest metaslab. This allows us to * replace or attach devices which don't have the same physical size but * can still satisfy the same number of allocations. */

Source from the content-addressed store, hash-verified

282 * can still satisfy the same number of allocations.
283 */
284uint64_t
285vdev_get_min_asize(vdev_t *vd)
286{
287 vdev_t *pvd = vd->vdev_parent;
288
289 /*
290 * If our parent is NULL (inactive spare or cache) or is the root,
291 * just return our own asize.
292 */
293 if (pvd == NULL)
294 return (vd->vdev_asize);
295
296 /*
297 * The top-level vdev just returns the allocatable size rounded
298 * to the nearest metaslab.
299 */
300 if (vd == vd->vdev_top)
301 return (P2ALIGN(vd->vdev_asize, 1ULL << vd->vdev_ms_shift));
302
303 return (pvd->vdev_ops->vdev_op_min_asize(pvd));
304}
305
306void
307vdev_set_min_asize(vdev_t *vd)

Callers 7

vdev_trim_l2arc_threadFunction · 0.85
vdev_set_min_asizeFunction · 0.85
vdev_openFunction · 0.85
vdev_get_stats_exFunction · 0.85
l2arc_add_vdevFunction · 0.85
spa_vdev_attachFunction · 0.85
ztest_vdev_attach_detachFunction · 0.85

Calls

no outgoing calls

Tested by 1

ztest_vdev_attach_detachFunction · 0.68