[core] ReFS improvements

* Allow 4K/64K cluster size selection
* Only enable ReFS on relevant platforms
* Also recognize a few more Windows editions
This commit is contained in:
Pete Batard 2021-10-21 02:02:17 +01:00
parent 32b083e535
commit 05382d8c7d
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
5 changed files with 62 additions and 18 deletions

View file

@ -394,6 +394,41 @@ static BOOL SetClusterSizes(int FSType)
return TRUE;
}
static BOOL IsRefsAvailable(MEDIA_TYPE MediaType)
{
// The creation of ReFS drives was added in Windows 8.1... but then removed by
// Microsoft in Windows 10 1709, except for the Enterprise and Pro Workstation
// versions. Oh and VdsService::QueryFileSystemTypes() is *USELESS* to detect
// if ReFS is available on the system. Oh, and it only applies to fixed media.
if (MediaType != FixedMedia)
return FALSE;
if (nWindowsVersion < WINDOWS_8_1 || nWindowsBuildNumber <= 0)
return FALSE;
if (nWindowsBuildNumber < 16000)
return TRUE;
switch (nWindowsEdition) {
case 0x0000000A: // Enterprise Server
case 0x0000001B: // Enterprise N
case 0x00000046: // Enterprise E
case 0x00000048: // Enterprise Eval
case 0x00000054: // Enterprise N Eval
case 0x0000007D: // Enterprise S
case 0x0000007E: // Enterprise S N
case 0x00000081: // Enterprise S Eval
case 0x00000082: // Enterprise S N Eval
case 0x0000008C: // Enterprise Subscription
case 0x0000008D: // Enterprise Subscription N
case 0x000000A1: // Pro Workstation
case 0x000000A2: // Pro Workstation N
case 0x000000AB: // Enterprise G
case 0x000000AC: // Enterprise G N
return TRUE;
default:
return FALSE;
}
}
// Populate the File System and Cluster Size dropdowns
static BOOL SetFileSystemAndClusterSize(char* fs_name)
{
@ -513,12 +548,14 @@ static BOOL SetFileSystemAndClusterSize(char* fs_name)
SelectedDrive.ClusterSize[FS_EXT3].Default = 1;
}
// ReFS (only supported for Windows 8.1 and later and for fixed disks)
// TODO: Check later versions of Windows 10 for disabled ReFS (IVdsService::QueryFileSystemTypes?)
if (SelectedDrive.DiskSize >= 512*MB) {
if ((nWindowsVersion >= WINDOWS_8_1) && (SelectedDrive.MediaType == FixedMedia)) {
SelectedDrive.ClusterSize[FS_REFS].Allowed = SINGLE_CLUSTERSIZE_DEFAULT;
SelectedDrive.ClusterSize[FS_REFS].Default = 1;
// ReFS (only applicable for a select number of Windows platforms and editions)
if ((SelectedDrive.DiskSize >= 512 * MB) && (IsRefsAvailable(SelectedDrive.MediaType))) {
if (SelectedDrive.DiskSize < 16 * TB) { // < 16 TB
SelectedDrive.ClusterSize[FS_REFS].Allowed = 64 * KB + 4 * KB;
SelectedDrive.ClusterSize[FS_REFS].Default = 4 * KB;
} else {
SelectedDrive.ClusterSize[FS_REFS].Allowed = 64 * KB;
SelectedDrive.ClusterSize[FS_REFS].Default = 64 * KB;
}
}
}