Blame SOURCES/0041-libparted-dasd-correct-the-offset-where-the-first-pa.patch

003ee8
From 40270928ff4ac2a87825f47e53c680ffb18b5bc4 Mon Sep 17 00:00:00 2001
003ee8
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
003ee8
Date: Tue, 14 Jun 2016 12:19:40 +0200
003ee8
Subject: [PATCH 41/53] libparted/dasd: correct the offset where the first
003ee8
 partition begins
003ee8
003ee8
The start point of first partition must start at least from the third
003ee8
track of DASD, due to the existence of metadata in the first two track.
003ee8
The previous constraint just sets all the device to be partitioned.
003ee8
So when the start point of the first partition start before the third
003ee8
track, (For example if it starts from.0) parted will exit abruptly.
003ee8
And this kind of job must be done with constraint explicitly.
003ee8
003ee8
Then the constraint is modified to exclude the first two tracks and
003ee8
to make the first partition start from the third track by default.
003ee8
003ee8
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
003ee8
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
003ee8
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
003ee8
Signed-off-by: Brian C. Lane <bcl@redhat.com>
003ee8
(cherry picked from commit 4126d0292c75cf7d50a2f4e9d485a52b5beafccc)
003ee8
---
003ee8
 libparted/labels/dasd.c | 8 +++++++-
003ee8
 1 file changed, 7 insertions(+), 1 deletion(-)
003ee8
003ee8
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
003ee8
index f79a867..4e68512 100644
003ee8
--- a/libparted/labels/dasd.c
003ee8
+++ b/libparted/labels/dasd.c
003ee8
@@ -829,6 +829,7 @@ _primary_constraint (PedDisk* disk)
003ee8
 	PedSector sector_size;
003ee8
 	LinuxSpecific* arch_specific;
003ee8
 	DasdDiskSpecific* disk_specific;
003ee8
+	PedSector start;
003ee8
 
003ee8
 	PDEBUG;
003ee8
 
003ee8
@@ -842,7 +843,12 @@ _primary_constraint (PedDisk* disk)
003ee8
 	if (!ped_alignment_init (&end_align, -1,
003ee8
 						     disk->dev->hw_geom.sectors * sector_size))
003ee8
 		return NULL;
003ee8
-	if (!ped_geometry_init (&max_geom, disk->dev, 0, disk->dev->length))
003ee8
+
003ee8
+	start = (FIRST_USABLE_TRK * (long long) disk->dev->hw_geom.sectors
003ee8
+			    * (long long) arch_specific->real_sector_size
003ee8
+			    / (long long) disk->dev->sector_size);
003ee8
+
003ee8
+	if (!ped_geometry_init (&max_geom, disk->dev, start, disk->dev->length))
003ee8
 		return NULL;
003ee8
 
003ee8
 	return ped_constraint_new(&start_align, &end_align, &max_geom,
003ee8
-- 
003ee8
2.7.4
003ee8