[gparted] Fix partitions created using MiB alignment are 1 MiB larger (#631026)



commit adc55bec504921b4eea8e6747bc0130b22bae6df
Author: Curtis Gedak <gedakc gmail com>
Date:   Thu Sep 30 11:31:25 2010 -0600

    Fix partitions created using MiB alignment are 1 MiB larger (#631026)
    
    Closes bug #631026 - Partitions created using MiB alignment are
                         1 MiB larger than specified

 src/Dialog_Partition_New.cc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index 41c19a2..962dde0 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -229,9 +229,10 @@ Partition Dialog_Partition_New::Get_New_Partition( Byte_Value sector_size )
 		case  0 :  part_temp .alignment = GParted::ALIGN_CYLINDER;  break;
 		case  1 :  part_temp .alignment = GParted::ALIGN_MEBIBYTE;
 		           {
-		               //if free space available, grow partition so sector_end on mebibyte boundary
+		               //if start sector not MiB aligned and free space available then add ~1 MiB to partition so requested size is kept
 		               Sector diff = ( MEBIBYTE / part_temp .sector_size ) - ( part_temp .sector_end + 1 ) % ( MEBIBYTE / part_temp .sector_size ) ;
 		               if (   diff
+		                   && ( part_temp .sector_start % (MEBIBYTE / part_temp .sector_size ) ) > 0
 		                   && ( ( part_temp .sector_end - START +1 + diff ) < total_length )
 		                  )
 		                   part_temp .sector_end += diff ;



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