svn commit: r234693 - stable/9/sys/boot/common

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


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

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/9/sys/boot/common/gpt.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)

Modified: stable/9/sys/boot/common/gpt.c
==============================================================================
--- stable/9/sys/boot/common/gpt.c	Thu Apr 26 02:03:16 2012	(r234692)
+++ stable/9/sys/boot/common/gpt.c	Thu Apr 26 05:17:25 2012	(r234693)
@@ -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-9 mailing list