2
0
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-31 14:06:08 +02:00

[iso] speed up scanning of ISOs with lots of deep directory entries

* ISOs with tons of Rock Ridge deep directory entries (such as OPNsense)
  can be very slow to scan due to the nature of deep directory parsing,
  which requires processing the whole ISO9660 fs, for each deep directory
  file, in order to find the relevant LSN entry.
* Since we don't expect much of the content we care about to reside in a
  deep directory entry, we amend the code to cut short the scan of any
  directory that contains such elements.
* Note that this only applies for ISO scan and it does nothing to speed
  up the ISO extraction process.
* Related to issue #1575
This commit is contained in:
Pete Batard 2020-07-06 17:30:20 +01:00
parent 500172a7a3
commit c35a92cd0c
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
2 changed files with 24 additions and 10 deletions

View file

@ -631,7 +631,7 @@ static void update_md5sum(void)
free(md5_data);
}
// Returns 0 on success, nonzero on error
// Returns 0 on success, >0 on error, <0 to ignore current dir
static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
{
HANDLE file_handle = NULL;
@ -668,9 +668,20 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
_CDIO_LIST_FOREACH(p_entnode, p_entlist) {
if (FormatStatus) goto out;
p_statbuf = (iso9660_stat_t*) _cdio_list_node_data(p_entnode);
if ((p_statbuf->rr.b3_rock == yep) && enable_rockridge) {
if (p_statbuf->rr.u_su_fields & ISO_ROCK_SUF_PL)
if (scan_only && (p_statbuf->rr.b3_rock == yep) && enable_rockridge) {
if (p_statbuf->rr.u_su_fields & ISO_ROCK_SUF_PL) {
img_report.has_deep_directories = TRUE;
// Due to the nature of the parsing of Rock Ridge deep directories
// which requires performing a *very costly* search of the whole
// ISO9660 file system to find the matching LSN, ISOs with loads of
// deep directory entries (e.g. OPNsense) are very slow to parse...
// To speed up the scan process, and since we expect deep directory
// entries to appear below anything we care for, we cut things
// short by telling the parent not to bother any further once we
// find that we are dealing with a deep directory.
r = -1;
goto out;
}
}
// Eliminate . and .. entries
if ( (strcmp(p_statbuf->filename, ".") == 0)
@ -702,15 +713,18 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
}
safe_free(psz_sanpath);
}
if (iso_extract_files(p_iso, psz_iso_name))
r = iso_extract_files(p_iso, psz_iso_name);
if (r > 0)
goto out;
if (r < 0) // Stop processing current dir
break;
} else {
file_length = p_statbuf->total_size;
if (check_iso_props(psz_path, file_length, psz_basename, psz_fullpath, &props)) {
continue;
}
print_extracted_file(psz_fullpath, file_length);
for (i=0; i<NB_OLD_C32; i++) {
for (i = 0; i < NB_OLD_C32; i++) {
if (props.is_old_c32[i] && use_own_c32[i]) {
static_sprintf(tmp, "%s/syslinux-%s/%s", FILES_DIR, embedded_sl_version_str[0], old_c32_name[i]);
if (CopyFileU(tmp, psz_fullpath, FALSE)) {

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.12.1687"
CAPTION "Rufus 3.12.1688"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -397,8 +397,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,12,1687,0
PRODUCTVERSION 3,12,1687,0
FILEVERSION 3,12,1688,0
PRODUCTVERSION 3,12,1688,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -416,13 +416,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.12.1687"
VALUE "FileVersion", "3.12.1688"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.12.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.12.1687"
VALUE "ProductVersion", "3.12.1688"
END
END
BLOCK "VarFileInfo"