فهرست منبع

ImageBackingStore: contiguous optimizations were sometimes skipped

There was an off-by-one error where contiguous image file optimizations
were not applied if the allocated FAT/exFAT extent was exactly the same
size as the image file.

The log message used different logic so it would still report the image
as contiguous (which it is), even though the optimizations were not active.

Actual performance impact is quite small.
Petteri Aimonen 7 ماه پیش
والد
کامیت
0ba8367637
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      src/ImageBackingStore.cpp
  2. 1 1
      src/ZuluSCSI_disk.cpp

+ 1 - 1
src/ImageBackingStore.cpp

@@ -136,7 +136,7 @@ bool ImageBackingStore::_internal_open(const char *filename)
 
     uint32_t sectorcount = m_fsfile.size() / SD_SECTOR_SIZE;
     uint32_t begin = 0, end = 0;
-    if (m_fsfile.contiguousRange(&begin, &end) && end >= begin + sectorcount)
+    if (m_fsfile.contiguousRange(&begin, &end) && end >= begin + sectorcount - 1)
     {
         // Convert to raw mapping, this avoids some unnecessary
         // access overhead in SdFat library.

+ 1 - 1
src/ZuluSCSI_disk.cpp

@@ -417,7 +417,7 @@ bool scsiDiskOpenHDDImage(int target_idx, const char *filename, int scsi_lun, in
         {
             // ROM is always contiguous, no need to log
         }
-        else if (img.file.contiguousRange(&sector_begin, &sector_end))
+        else if (img.file.isContiguous() && img.file.contiguousRange(&sector_begin, &sector_end))
         {
 #ifdef ZULUSCSI_HARDWARE_CONFIG
             if (g_hw_config.is_active())