changeset 18777:5189c3090f9b

8748 loader: ptblread() is broken with >512B sectors
author Toomas Soome <tsoome@me.com>
date Tue, 31 Oct 2017 14:34:33 +0200
parents b9a3c4f7ebf2
children aec9a653382a
files usr/src/boot/sys/boot/common/disk.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/boot/sys/boot/common/disk.c	Tue Jul 25 21:18:13 2017 +0300
+++ b/usr/src/boot/sys/boot/common/disk.c	Tue Oct 31 14:34:33 2017 +0200
@@ -87,6 +87,12 @@
 	od = (struct open_disk *)dev->d_opendata;
 
 	/*
+	 * The strategy function assumes the offset is in units of 512 byte
+	 * sectors. For larger sector sizes, we need to adjust the offset to
+	 * match the actual sector size.
+	 */
+	offset *= (od->sectorsize / 512);
+	/*
 	 * As the GPT backup partition is located at the end of the disk,
 	 * to avoid reading past disk end, flag bcache not to use RA.
 	 */