From 1fb59b58ee9ec9215880dfa218d709fae02f6a53 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 26 Aug 2020 08:28:37 +0200 Subject: Linux: Reduce minimal size requirement for BTRFS support to 16 MiB by using mixed mode for volumes whose size is less than 109 MiB --- src/Main/Forms/VolumeCreationWizard.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/Main/Forms/VolumeCreationWizard.cpp') diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index 4df20301..5d814e89 100644 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -258,7 +258,10 @@ namespace VeraCrypt case Step::FormatOptions: { - VolumeFormatOptionsWizardPage *page = new VolumeFormatOptionsWizardPage (GetPageParent(), VolumeSize, SectorSize, + shared_ptr layout ((OuterVolume || SelectedVolumeType != VolumeType::Hidden)? (VolumeLayout*) new VolumeLayoutV2Normal() : (VolumeLayout*) new VolumeLayoutV2Hidden()); + uint64 filesystemSize = layout->GetMaxDataSize (VolumeSize); + + VolumeFormatOptionsWizardPage *page = new VolumeFormatOptionsWizardPage (GetPageParent(), filesystemSize, SectorSize, SelectedVolumePath.IsDevice() && (OuterVolume || SelectedVolumeType != VolumeType::Hidden), OuterVolume, LargeFilesSupport); page->SetPageTitle (_("Format Options")); @@ -484,6 +487,9 @@ namespace VeraCrypt shared_ptr volume = Core->MountVolume (mountOptions); finally_do_arg (shared_ptr , volume, { Core->DismountVolume (finally_arg, true); }); + + shared_ptr layout((volume->Type == VolumeType::Normal)? (VolumeLayout*) new VolumeLayoutV2Normal() : (VolumeLayout*) new VolumeLayoutV2Hidden()); + uint64 filesystemSize = layout->GetMaxDataSize (VolumeSize); Thread::Sleep (2000); // Try to prevent race conditions caused by OS @@ -527,7 +533,14 @@ namespace VeraCrypt args.push_back ("-f"); if (SelectedFilesystemType == VolumeCreationOptions::FilesystemType::Btrfs) + { args.push_back ("-f"); + if (filesystemSize < VC_MIN_LARGE_BTRFS_VOLUME_SIZE) + { + // use mixed mode for small BTRFS volumes + args.push_back ("-M"); + } + } args.push_back (string (virtualDevice)); -- cgit v1.2.3