Fix regression - linux-swap resize broken (#706604)

Unfortunately a regression was introduced with GParted 0.14.1 wherein
linux-swap grow and shrink operations were broken.  This regression was
a direct result of the following commit:

    Prevent file system grow when partition grow fails (#686668)
    fd96328920

The regression did not result in an error in the GUI, but rather the
linux-swap file system was not "resized" to the correct partition size.

The logic error introduced with the above commit listed has now been
fixed.

BACKGROUND INFORMATION ON LINUX-SWAP RESIZING

Currently no command line tools are available for resizing linux-swap.
However, since linux-swap does not contain data in the usual sense, we
simulate resizing linux-swap by re-creating (maximizing to fill
partition) the linux-swap file system with the same UUID and volume
label.  To work correctly, the linux-swap file system must be re-created
after the final partition resize action has occurred.

Closes Bug #706604 - Failure to properly grow or shrink linux-swap when
                     resizing
This commit is contained in:
Curtis Gedak 2013-08-22 12:46:09 -06:00 committed by Mike Fleetwood
parent 73a80db912
commit 51845b7799

View file

@ -2273,9 +2273,9 @@ bool GParted_Core::resize( const Partition & partition_old,
//expand file system to fit exactly in partition
if ( succes
&& ( //Maximize file system if FS not linux-swap and new size > old
partition_new .filesystem != FS_LINUX_SWAP //linux-swap is recreated, not resized
&& partition_new .get_sector_length() > partition_old .get_sector_length()
&& ( //Maximize file system if linux-swap or new size > old
partition_new .filesystem == FS_LINUX_SWAP //linux-swap is recreated, not resized
|| partition_new .get_sector_length() > partition_old .get_sector_length()
)
)
succes = check_repair_filesystem( partition_new, operationdetail )