Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Oct 2017 20:29:31 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325248 - head/sys/boot/common
Message-ID:  <201710312029.v9VKTV7P097822@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Tue Oct 31 20:29:31 2017
New Revision: 325248
URL: https://svnweb.freebsd.org/changeset/base/325248

Log:
  loader ptblread() is broken with >512B sectors
  
  The loader strategy() function is assuming 512B blocks, so we need to adjust
  ptblread() for other sector sizes.
  
  Reviewed by:	imp
  Differential Revision:	https://reviews.freebsd.org/D12847

Modified:
  head/sys/boot/common/disk.c

Modified: head/sys/boot/common/disk.c
==============================================================================
--- head/sys/boot/common/disk.c	Tue Oct 31 19:52:30 2017	(r325247)
+++ head/sys/boot/common/disk.c	Tue Oct 31 20:29:31 2017	(r325248)
@@ -89,6 +89,12 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t o
 	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.
 	 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710312029.v9VKTV7P097822>