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

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