Use GEOM stripesize field when calculating ashift. This will enable correct

alignment on drives with large sector sizes (e.g. 4 KiB) but the
implementation might need to be revisited if devices with large stripesizes
appear (e.g. if RAID controllers or flash drives start using the field),
probably by introducing a physsectorsize field in GEOM providers.

Discussed with: mav, mostly silence on freebsd-geom@ and freebsd-fs@
This commit is contained in:
Ivan Voras 2010-12-06 12:18:02 +00:00
parent 20016815e5
commit 8b08562112
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216230

View File

@ -496,7 +496,10 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
/*
* Determine the device's minimum transfer size.
*/
*ashift = highbit(MAX(pp->sectorsize, SPA_MINBLOCKSIZE)) - 1;
if (pp->stripesize > pp->sectorsize)
*ashift = highbit(MIN(pp->stripesize, SPA_MAXBLOCKSIZE)) - 1;
else
*ashift = highbit(MAX(pp->sectorsize, SPA_MINBLOCKSIZE)) - 1;
/*
* Clear the nowritecache bit, so that on a vdev_reopen() we will