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

Function vdev_ashift_optimize

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

* Maximize performance by inflating the configured ashift for top level * vdevs to be as close to the physical ashift as possible while maintaining * administrator defined limits and ensuring it doesn't go below the * logical ashift. */

Source from the content-addressed store, hash-verified

1743 * logical ashift.
1744 */
1745static void
1746vdev_ashift_optimize(vdev_t *vd)
1747{
1748 ASSERT(vd == vd->vdev_top);
1749
1750 if (vd->vdev_ashift < vd->vdev_physical_ashift) {
1751 vd->vdev_ashift = MIN(
1752 MAX(zfs_vdev_max_auto_ashift, vd->vdev_ashift),
1753 MAX(zfs_vdev_min_auto_ashift,
1754 vd->vdev_physical_ashift));
1755 } else {
1756 /*
1757 * If the logical and physical ashifts are the same, then
1758 * we ensure that the top-level vdev's ashift is not smaller
1759 * than our minimum ashift value. For the unusual case
1760 * where logical ashift > physical ashift, we can't cap
1761 * the calculated ashift based on max ashift as that
1762 * would cause failures.
1763 * We still check if we need to increase it to match
1764 * the min ashift.
1765 */
1766 vd->vdev_ashift = MAX(zfs_vdev_min_auto_ashift,
1767 vd->vdev_ashift);
1768 }
1769}
1770
1771/*
1772 * Prepare a virtual device for access.

Callers 1

vdev_openFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected