* 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. */
| 1743 | * logical ashift. |
| 1744 | */ |
| 1745 | static void |
| 1746 | vdev_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. |