[gnome-continuous-yocto/gnomeostree-3.28-rocko: 5198/8267] wic/partionedfs: Avoid reserving space for non-existing ext. partition
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 5198/8267] wic/partionedfs: Avoid reserving space for non-existing ext. partition
- Date: Sun, 17 Dec 2017 03:06:11 +0000 (UTC)
commit 76d182c757d6df47f315164163676e276f7379b1
Author: Kristian Amlie <kristian amlie mender io>
Date: Fri Mar 10 14:16:27 2017 +0100
wic/partionedfs: Avoid reserving space for non-existing ext. partition
We don't need the gap that the extended partition occupies if we
already know that we have less than five partitions. Saves up to one
full alignment of space.
(From OE-Core rev: 485315dc170e29962a8848db38db73abafd0586e)
Signed-off-by: Kristian Amlie <kristian amlie mender io>
Signed-off-by: Ross Burton <ross burton intel com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
scripts/lib/wic/plugins/imager/direct.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 235eb24..7d38ab3 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -344,6 +344,10 @@ class PartitionedImage():
logger.debug("Assigning %s partitions to disks", self.ptable_format)
+ # The number of primary and logical partitions. Extended partition and
+ # partitions not listed in the table are not included.
+ num_real_partitions = len([p for p in self.partitions if not p.no_table])
+
# Go through partitions in the order they are added in .ks file
for num in range(len(self.partitions)):
part = self.partitions[num]
@@ -369,7 +373,7 @@ class PartitionedImage():
# Skip one sector required for the partitioning scheme overhead
self.offset += overhead
- if self.realpart > 3:
+ if self.realpart > 3 and num_real_partitions > 4:
# Reserve a sector for EBR for every logical partition
# before alignment is performed.
if self.ptable_format == "msdos":
@@ -408,7 +412,7 @@ class PartitionedImage():
if self.ptable_format == "msdos":
# only count the partitions that are in partition table
- if len([p for p in self.partitions if not p.no_table]) > 4:
+ if num_real_partitions > 4:
if self.realpart > 3:
part.type = 'logical'
part.num = self.realpart + 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]