vbox的更動 61852 路徑 trunk/src/VBox/Storage
- 時間撮記:
- 2016-6-23 下午01:01:12 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Storage/VMDK.cpp
r61844 r61852 3079 3079 /* HACK: extend the descriptor if it is unusually small and it fits in 3080 3080 * the unused space after the image header. Allows opening VMDK files 3081 * with extremely small descriptor in read/write mode. */ 3082 if ( !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 3083 && pExtent->cDescriptorSectors < 3 3081 * with extremely small descriptor in read/write mode. 3082 * 3083 * The previous version introduced a possible regression for VMDK stream 3084 * optimized images from VMware which tend to have only a single sector sized 3085 * descriptor. Increasing the descriptor size resulted in adding the various uuid 3086 * entries required to make it work with VBox but for stream optimized images 3087 * the updated binary header wasn't written to the disk creating a mismatch 3088 * between advertised and real descriptor size. 3089 * 3090 * The descriptor size will be increased even if opened readonly now if there 3091 * enough room but the new value will not be written back to the image. 3092 */ 3093 if ( pExtent->cDescriptorSectors < 3 3084 3094 && (int64_t)pExtent->uSectorGD - pExtent->uDescriptorSector >= 4 3085 3095 && (!pExtent->uSectorRGD || (int64_t)pExtent->uSectorRGD - pExtent->uDescriptorSector >= 4)) … … 3088 3098 3089 3099 pExtent->cDescriptorSectors = 4; 3090 /* 3091 * Update the on disk number now to make sure we don't introduce inconsistencies 3092 * in case of stream optimized images from VMware where the descriptor is just 3093 * one sector big (the binary header is not written to disk for complete 3094 * stream optimized images in vmdkFlushImage()). 3095 */ 3096 uint64_t u64DescSizeNew = RT_H2LE_U64(pExtent->cDescriptorSectors); 3097 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pFile->pStorage, RT_OFFSETOF(SparseExtentHeader, descriptorSize), 3098 &u64DescSizeNew, sizeof(u64DescSizeNew)); 3099 if (RT_FAILURE(rc)) 3100 if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)) 3100 3101 { 3101 LogFlowFunc(("Increasing the descriptor size failed with %Rrc\n", rc)); 3102 /* Restore the old size and carry on. */ 3103 pExtent->cDescriptorSectors = cDescriptorSectorsOld; 3102 /* 3103 * Update the on disk number now to make sure we don't introduce inconsistencies 3104 * in case of stream optimized images from VMware where the descriptor is just 3105 * one sector big (the binary header is not written to disk for complete 3106 * stream optimized images in vmdkFlushImage()). 3107 */ 3108 uint64_t u64DescSizeNew = RT_H2LE_U64(pExtent->cDescriptorSectors); 3109 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pFile->pStorage, RT_OFFSETOF(SparseExtentHeader, descriptorSize), 3110 &u64DescSizeNew, sizeof(u64DescSizeNew)); 3111 if (RT_FAILURE(rc)) 3112 { 3113 LogFlowFunc(("Increasing the descriptor size failed with %Rrc\n", rc)); 3114 /* Restore the old size and carry on. */ 3115 pExtent->cDescriptorSectors = cDescriptorSectorsOld; 3116 } 3104 3117 } 3105 3118 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器