[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 2/2] Align logical partitions' start sector up one logical block for metadata.



Hi,

Looks good, but what about non growable partitions, if I
understand the code correct growPartitions wont touch
those, but we still need to do this. Anyways fixing that
would be another patch, so ack for this one.

(I haven't looked too closely, so if this is taken care of,
 I'll believe you)

Regards,

Hans

On 11/03/2009 07:27 PM, David Lehman wrote:
---
  storage/partitioning.py |   22 ++++------------------
  1 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/storage/partitioning.py b/storage/partitioning.py
index 80a2c7f..34d9371 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -1023,7 +1023,6 @@ def allocatePartitions(disks, partitions, freespace):
          disklabel = _disk.format

          # create the extended partition if needed
-        # TODO: move to a function (disk, free)
          if part_type == parted.PARTITION_EXTENDED:
              log.debug("creating extended partition")
              addPartition(disklabel.partedDisk, free, part_type, None)
@@ -1354,15 +1353,7 @@ def growPartitions(disks, partitions, free):

              # recalculate partition geometries
              disklabel = disk.format
-
              start = chunk.geometry.start
-            #if start == 0 or start == getattr(extended_geometry, "start", 0):
-            #    start += 1
-
-            first_logical = False
-            if extended_geometry and chunk.contains(extended_geometry):
-                first_logical = True
-
              new_partitions = []
              for p in chunk.requests:
                  ptype = p.partition.partedPartition.type
@@ -1371,16 +1362,11 @@ def growPartitions(disks, partitions, free):
                  if ptype == parted.PARTITION_EXTENDED:
                      continue

-                #if ptype == parted.PARTITION_LOGICAL:
-                #    # As you wish, parted.
-                #    start += 1
-
-                # XXX if the start of the extended is aligned then we must
-                #     burn one logical block to align the first logical
-                #     partition
-                if ptype == parted.PARTITION_LOGICAL and first_logical:
+                # XXX since we need one metadata sector before each
+                #     logical partition we burn one logical block to
+                #     safely align the start of each logical partition
+                if ptype == parted.PARTITION_LOGICAL:
                      start += _a.grainSize
-                    first_logical = False

                  old_geometry = p.partition.partedPartition.geometry
                  new_length = p.base + p.growth


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]