Changeset 6472 in vbox
- Timestamp:
- Jan 24, 2008 8:47:39 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 27468
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VDICore.cpp
r6363 r6472 473 473 goto l_create_failed; 474 474 475 if ( (enmType == VDI_IMAGE_TYPE_FIXED) 476 && (fFlags & VDI_IMAGE_FLAGS_ZERO_EXPAND)) 477 { 478 /* Fill image with zeroes. */ 475 if (enmType == VDI_IMAGE_TYPE_FIXED) 476 { 477 /* Fill image with zeroes. We do this for every fixed-size image since on some systems 478 * (for example Windows Vista), it takes ages to write a block near the end of a sparse 479 * file and the guest could complain about an ATA timeout. */ 479 480 480 481 /** @todo Starting with Linux 2.6.23, there is an fallocate() system call. … … 485 486 goto l_create_failed; 486 487 487 /* alloc tmp zero-filled buffer */ 488 void *pvBuf = RTMemTmpAllocZ(VDIDISK_DEFAULT_BUFFER_SIZE); 488 /* Allocate a temporary zero-filled buffer. Use a bigger block size to optimize writing */ 489 const size_t cbBuf = 128 * _1K; 490 void *pvBuf = RTMemTmpAllocZ(cbBuf); 489 491 if (pvBuf) 490 492 { … … 495 497 while (cbFill > 0) 496 498 { 497 unsigned to_fill = (unsigned)RT_MIN(cbFill, VDIDISK_DEFAULT_BUFFER_SIZE);499 unsigned to_fill = (unsigned)RT_MIN(cbFill, cbBuf); 498 500 499 501 rc = RTFileWrite(pImage->File, pvBuf, to_fill, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.