1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-10 12:31:51 +00:00

Faster backups

- Add file pre-allocations to greatly reduce overhead of FatFS.
This was missing before, because it takes 1.5KB payload size.

Speed bumps (no verify) are between 7 to 30% for exFAT and ~50% for FAT32, depending on the workload.
This commit is contained in:
Kostas Missos 2018-08-22 03:42:25 +03:00
parent da5a1a9641
commit 0540128709

View file

@ -1023,6 +1023,12 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
return 0; return 0;
} }
u64 totalSize = (u64)((u64)totalSectors << 9);
if (!isSmallSdCard && sd_fs.fs_type == FS_EXFAT)
f_lseek(&fp, totalSize);
else
f_lseek(&fp, MIN(totalSize, multipartSplitSize));
f_lseek(&fp, 0);
u32 numSectorsPerIter = 0; u32 numSectorsPerIter = 0;
if (totalSectors > 0x200000) if (totalSectors > 0x200000)
@ -1122,6 +1128,10 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
return 0; return 0;
} }
bytesWritten = 0; bytesWritten = 0;
totalSize = (u64)((u64)totalSectors << 9);
f_lseek(&fp, MIN(totalSize, multipartSplitSize));
f_lseek(&fp, 0);
} }
retryCount = 0; retryCount = 0;
@ -1141,6 +1151,8 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
free(buf); free(buf);
f_close(&fp); f_close(&fp);
f_unlink(outFilename);
return 0; return 0;
} }
} }
@ -1153,6 +1165,8 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
free(buf); free(buf);
f_close(&fp); f_close(&fp);
f_unlink(outFilename);
return 0; return 0;
} }
pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(part->lba_end - part->lba_start); pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(part->lba_end - part->lba_start);