Remove old workaround for btrfs resizing on Linux < 3.2 (!26)
PATCHSET OVERVIEW The oldest supported distributions have these versions of the Linux kernel and btrfs-progs: Distro EOL kernel btrfs-progs - RHEL / CentOS 7 2024-Jun 3.10.0 4.9.1 - Ubuntu 14.04 LTS 2019-Apr 4.4.0 3.12 - Debian 8 2020-Jun 3.16.0 3.17 - SLES 12 2027-Oct 3.12.28 3.16 Making the oldest supported packages be kernel 3.10 and btrfs-progs 3.12 allows the btrfs support code to be simplified by removing backward compatibility. THIS CHANGE Remove old workaround for ignoring the error when resizing a btrfs to the same size on Linux kernel < 3.2. Also now that only exit status 0 is considered successful from btrfs resize, the EXEC_CHECK_STATUS flag to execute_command() can be used, rather than having to separately call set_status() afterwards. Relevant commit history: *11d044dba0
Don't ignore any errors resizing btrfs on Linux >= 3.2 (#669389) *a580abbc30
Use newer btrfs multi-tool control command first Closes !26 - Remove support for btrfs-progs < 3.12
This commit is contained in:
parent
2aae7b0688
commit
d7dbbe4979
30
src/btrfs.cc
30
src/btrfs.cc
|
@ -30,7 +30,6 @@ namespace GParted
|
|||
{
|
||||
|
||||
bool btrfs_found = false ;
|
||||
bool resize_to_same_size_fails = true ;
|
||||
|
||||
// Cache of required btrfs file system device information by device
|
||||
// E.g. For a single device btrfs on /dev/sda2 and a three device btrfs
|
||||
|
@ -136,10 +135,6 @@ FS btrfs::get_filesystem_support()
|
|||
|
||||
fs_limits.min_size = 256 * MEBIBYTE;
|
||||
|
||||
//Linux before version 3.2 fails when resizing btrfs file system
|
||||
// to the same size.
|
||||
resize_to_same_size_fails = ! Utils::kernel_version_at_least( 3, 2, 0 ) ;
|
||||
|
||||
return fs ;
|
||||
}
|
||||
|
||||
|
@ -347,30 +342,7 @@ bool btrfs::resize( const Partition & partition_new, OperationDetail & operation
|
|||
cmd = "btrfs filesystem resize " + devid_str + ":" + size + " " + Glib::shell_quote( mount_point );
|
||||
else
|
||||
cmd = "btrfsctl -r " + devid_str + ":" + size + " " + Glib::shell_quote( mount_point );
|
||||
exit_status = execute_command( cmd, operationdetail );
|
||||
bool resize_succeeded = ( exit_status == 0 ) ;
|
||||
if ( resize_to_same_size_fails )
|
||||
{
|
||||
//Linux before version 3.2 fails when resizing a
|
||||
// btrfs file system to the same size with ioctl()
|
||||
// returning -1 EINVAL (Invalid argument) from the
|
||||
// kernel btrfs code.
|
||||
// * Btrfs filesystem resize reports this as exit
|
||||
// status 30:
|
||||
// ERROR: Unable to resize '/MOUNTPOINT'
|
||||
// * Btrfsctl -r reports this as exit status 1:
|
||||
// ioctl:: Invalid argument
|
||||
// WARNING:
|
||||
// Ignoring these errors could mask real failures,
|
||||
// but not ignoring them will cause resizing to the
|
||||
// same size as part of check operation to fail.
|
||||
resize_succeeded = ( exit_status == 0
|
||||
|| ( btrfs_found && exit_status == 30 )
|
||||
|| ( ! btrfs_found && exit_status == 1 )
|
||||
) ;
|
||||
}
|
||||
set_status( operationdetail, resize_succeeded );
|
||||
success &= resize_succeeded ;
|
||||
success &= ! execute_command(cmd, operationdetail, EXEC_CHECK_STATUS);
|
||||
|
||||
if ( ! partition_new .busy )
|
||||
success &= ! execute_command( "umount -v " + Glib::shell_quote( mount_point ),
|
||||
|
|
Loading…
Reference in New Issue