[gparted] Fix partitions moved or copied using MiB alignment are 1 MiB larger



commit d330f9a5186913d4008f5bdf56f1cc60c7866045
Author: Curtis Gedak <gedakc gmail com>
Date:   Mon Oct 18 17:08:23 2010 -0600

    Fix partitions moved or copied using MiB alignment are 1 MiB larger
    
    Correct problem introduced in version 0.6.3 whereby move or copy
    operations using MiB alignment resulted in the destination
    partition being 1 MiB larger.
    
    Closes bug #632478

 src/Dialog_Base_Partition.cc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc
index 01dac76..7ed9885 100644
--- a/src/Dialog_Base_Partition.cc
+++ b/src/Dialog_Base_Partition.cc
@@ -173,9 +173,10 @@ Partition Dialog_Base_Partition::Get_New_Partition( Byte_Value sector_size )
 		case  0 :  selected_partition .alignment = ALIGN_CYLINDER;  break;
 		case  1 :  selected_partition .alignment = 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 / selected_partition .sector_size ) - ( selected_partition .sector_end + 1 ) % ( MEBIBYTE / selected_partition .sector_size ) ;
 		               if (   diff
+		                   && ( selected_partition .sector_start % (MEBIBYTE / selected_partition .sector_size ) ) > 0
 		                   && ( ( selected_partition .sector_end - START +1 + diff ) < total_length )
 		                  )
 		                   selected_partition .sector_end += diff ;



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