[gparted] Remove cylinder size adjustments in the copy dialog (#749867)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Remove cylinder size adjustments in the copy dialog (#749867)
- Date: Thu, 28 May 2015 19:07:41 +0000 (UTC)
commit 8bbb77f1f8c5d15ee2be9db6b69371452f7483d5
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Mon May 25 20:09:46 2015 +0100
Remove cylinder size adjustments in the copy dialog (#749867)
BUF in the copy dialog class, Dialog_Partition_Copy, is use to adjust
limits in 2 cases:
1) Minimum size when copying an XFS file system
Minimum size was set to the used space + 2 * cylinder size (typically
plus ~16 MiB). This commit from 2004-12-20 added it:
a54b52ea33abb1f5a44b52bcad5858ba41cd135d
xfs copy now uses xfsdump and xfsrestore. icw some hacks in the other 2
Issues:
* This is increasing the minimum XFS file system size when copying it,
which doesn't happen in the resize case for other file systems.
* It allows an XFS file system to be created which is smaller than the
minimum size allowed by GParted. Copying an empty XFS file system can
create a new file system as small as 26 MiB. This is smaller than the
minimum GParted allows of 32 MiB because that is the minimum
xfs_repair can handle.
Remove this addition when copying an XFS file system and enforce minimum
file system size.
2) Maximum size when copying a file system into empty space larger than
it's maximum size
Maximum size was set to maximum file system size - cylinder size
(typically minus ~8 MiB). Only applied to FAT16 which has a maximum
file system size set in and can be grown. Added by this commit from
2004-12-15:
10e8f3338d76e74c5fba22ff6c86888a67b99ae9
:get_fs now returns a const reference. in copy and resizedialog
...
* in copy and resizedialog filesystems with MAX set now have a max size of MAX - one cylinder .
Issue:
* This is applying a lower maximum resize when copying the file system
compared to that when creating the file system.
NOTE:
GParted currently allows all file systems to be resize to any size,
regardless of the maximum file system size. This is probably an
oversight, but it does allow libparted to convert FAT16 to FAT32 file
system when resizing.
Remove this lower maximum file system size when copying and resizing,
compared to creating.
Bug 749867 - Some limits are adjusted by arcane cylinder size amount
when copying and resizing in a single operation
include/Dialog_Partition_Copy.h | 3 +--
src/Dialog_Partition_Copy.cc | 13 +++++--------
src/Win_GParted.cc | 4 ++--
3 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/include/Dialog_Partition_Copy.h b/include/Dialog_Partition_Copy.h
index 0245b11..877459e 100644
--- a/include/Dialog_Partition_Copy.h
+++ b/include/Dialog_Partition_Copy.h
@@ -26,13 +26,12 @@ namespace GParted
class Dialog_Partition_Copy : public Dialog_Base_Partition
{
public:
- Dialog_Partition_Copy( const FS & fs, Sector cylinder_size ) ;
+ Dialog_Partition_Copy( const FS & fs );
void Set_Data( const Partition & selected_partition, const Partition & copied_partition );
Partition Get_New_Partition( Byte_Value sector_size ) ;
private:
- short BUF; // Used in copy (safety reasons)
};
}//GParted
diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc
index 2c3a952..e3d4f53 100644
--- a/src/Dialog_Partition_Copy.cc
+++ b/src/Dialog_Partition_Copy.cc
@@ -21,12 +21,10 @@
namespace GParted
{
-Dialog_Partition_Copy::Dialog_Partition_Copy( const FS & fs, Sector cylinder_size )
+Dialog_Partition_Copy::Dialog_Partition_Copy( const FS & fs )
{
this ->fs = fs ;
-
- BUF = cylinder_size ;
-
+
Set_Resizer( false ) ;
Set_Confirm_Button( PASTE ) ;
}
@@ -63,16 +61,15 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
//Only allow pasting into a new larger partition if growing the file
// system is implemented and resizing it is currently allowed.
if ( fs .grow && ! GParted_Core::filesystem_resize_disallowed( copied_partition ) )
+ {
if ( ! fs .MAX || fs .MAX > ((TOTAL_MB - MIN_SPACE_BEFORE_MB) * MEBIBYTE) )
fs .MAX = ((TOTAL_MB - MIN_SPACE_BEFORE_MB) * MEBIBYTE) ;
- else
- fs .MAX = fs .MAX - (BUF * selected_partition .sector_size) ;
+ }
else
fs .MAX = copied_partition .get_byte_length() ;
- //TODO: Since BUF is the cylinder size of the current device, the cylinder size of the copied device
could differ for small disks
if ( fs .filesystem == GParted::FS_XFS ) //bit hackisch, but most effective, since it's a unique
situation
- fs .MIN = ( min_resize + (BUF * 2) ) * copied_partition .sector_size;
+ fs.MIN = std::max( fs.MIN, min_resize * copied_partition.sector_size );
else
fs .MIN = COPIED_LENGTH_MB * MEBIBYTE ;
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 1143df1..93ced74 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1728,8 +1728,8 @@ void Win_GParted::activate_paste()
{
if ( ! max_amount_prim_reached() )
{
- Dialog_Partition_Copy dialog( gparted_core .get_fs( copied_partition .filesystem ),
- devices[ current_device ] .cylsize ) ;
+ Dialog_Partition_Copy dialog( gparted_core.get_fs( copied_partition.filesystem ) );
+
// We don't want the messages, mount points or name of the source
// partition for the new partition being created.
copied_partition .messages .clear() ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]