* 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. */
| 282 | * can still satisfy the same number of allocations. |
| 283 | */ |
| 284 | uint64_t |
| 285 | vdev_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 | |
| 306 | void |
| 307 | vdev_set_min_asize(vdev_t *vd) |
no outgoing calls