svn commit: r234694 - stable/8/sys/boot/common

Andrey V. Elsukov ae at FreeBSD.org
Thu Apr 26 05:17:48 UTC 2012


Author: ae
Date: Thu Apr 26 05:17:48 2012
New Revision: 234694
URL: http://svn.freebsd.org/changeset/base/234694

Log:
  MFC r234692:
    Read backup GPT header from the last LBA only when primary GPT header and
    table aren't valid. If they are ok, use hdr_lba_alt value to read backup
    header. This will make gptboot happy when GPT used atop of some GEOM
    provider, e.g. GEOM_MIRROR.

Modified:
  stable/8/sys/boot/common/gpt.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/boot/   (props changed)

Modified: stable/8/sys/boot/common/gpt.c
==============================================================================
--- stable/8/sys/boot/common/gpt.c	Thu Apr 26 05:17:25 2012	(r234693)
+++ stable/8/sys/boot/common/gpt.c	Thu Apr 26 05:17:48 2012	(r234694)
@@ -337,16 +337,16 @@ gptread(const uuid_t *uuid, struct dsk *
 		gpttable = table_primary;
 	}
 
-	altlba = drvsize(dskp);
-	if (altlba > 0)
-		altlba--;
-	else if (hdr_primary_lba > 0) {
+	if (hdr_primary_lba > 0) {
 		/*
-		 * If we cannot obtain disk size, but primary header
-		 * is valid, we can get backup header location from
-		 * there.
+		 * If primary header is valid, we can get backup
+		 * header location from there.
 		 */
 		altlba = hdr_primary.hdr_lba_alt;
+	} else {
+		altlba = drvsize(dskp);
+		if (altlba > 0)
+			altlba--;
 	}
 	if (altlba == 0)
 		printf("%s: unable to locate backup GPT header\n", BOOTPROG);


More information about the svn-src-stable-8 mailing list