Skip to content

Commit

Permalink
On the first vdev open ignore impossible ashift hints
Browse files Browse the repository at this point in the history
If on the first open device's logical ashift is bigger than set
by pool's ashift property, ignore the last as unusable instead of
creating vdev that will fail most of I/Os due to misalignment.

Reviewed-by: Rob Norris <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ameer Hamza <[email protected]>
Signed-off-by:  Alexander Motin <[email protected]>
Sponsored by:   iXsystems, Inc.
Closes #16690
  • Loading branch information
amotin authored Oct 29, 2024
1 parent 2bf1520 commit 6187b19
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2205,10 +2205,11 @@ vdev_open(vdev_t *vd)
vd->vdev_max_asize = max_asize;

/*
* If the vdev_ashift was not overridden at creation time,
* If the vdev_ashift was not overridden at creation time
* (0) or the override value is impossible for the device,
* then set it the logical ashift and optimize the ashift.
*/
if (vd->vdev_ashift == 0) {
if (vd->vdev_ashift < vd->vdev_logical_ashift) {
vd->vdev_ashift = vd->vdev_logical_ashift;

if (vd->vdev_logical_ashift > ASHIFT_MAX) {
Expand Down

0 comments on commit 6187b19

Please sign in to comment.