[ext2fs] improve formatting speed

* Fix use of EXT2_BLOCK_SIZE() instead of EXT2_INODE_SIZE() during inode
  initialization, that made us zero way many more blocks than was needed.
* Also disable sparse_super feature and improve block setup.
* Also explicitly use IS_POWER_OF_2 macro where required.
This commit is contained in:
Pete Batard 2020-02-11 19:22:22 +00:00
parent 35af4cbacb
commit 9edd7492db
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
4 changed files with 22 additions and 19 deletions

View file

@ -641,8 +641,7 @@ out:
static BOOL FormatPartition(DWORD DriveIndex, uint64_t PartitionOffset, DWORD UnitAllocationSize, USHORT FSType, LPCSTR Label, DWORD Flags)
{
if ((DriveIndex < 0x80) || (DriveIndex > 0x100) || (FSType >= FS_MAX) ||
// The following validates that UnitAllocationSize is a power of 2
((UnitAllocationSize != 0) && (UnitAllocationSize & (UnitAllocationSize - 1)))) {
((UnitAllocationSize != 0) && (!IS_POWER_OF_2(UnitAllocationSize)))) {
ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_INVALID_PARAMETER;
return FALSE;
}