- Timestamp:
- Dec 16, 2013 11:50:41 PM (11 years ago)
- Location:
- trunk/src/VBox/Storage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VD.cpp
r49880 r49944 2491 2491 } 2492 2492 2493 static int vdWriteHelperStandardReadImageAsync(PVDIOCTX pIoCtx) 2494 { 2495 int rc = VINF_SUCCESS; 2496 2497 LogFlowFunc(("pIoCtx=%#p\n", pIoCtx)); 2498 2499 pIoCtx->fFlags |= VDIOCTX_FLAGS_ZERO_FREE_BLOCKS; 2500 2501 if ( pIoCtx->Req.Io.cbTransferLeft 2502 && !pIoCtx->cDataTransfersPending) 2503 rc = vdReadHelperAsync(pIoCtx); 2504 2505 if ( RT_SUCCESS(rc) 2506 && ( pIoCtx->Req.Io.cbTransferLeft 2507 || pIoCtx->cMetaTransfersPending)) 2508 rc = VERR_VD_ASYNC_IO_IN_PROGRESS; 2509 else 2510 { 2511 size_t cbFill = pIoCtx->Type.Child.Write.Optimized.cbFill; 2512 2513 /* Zero out the remainder of this block. Will never be visible, as this 2514 * is beyond the limit of the image. */ 2515 if (cbFill) 2516 vdIoCtxSet(pIoCtx, '\0', cbFill); 2517 2518 /* Write the full block to the virtual disk. */ 2519 RTSgBufReset(&pIoCtx->Req.Io.SgBuf); 2520 2521 vdIoCtxChildReset(pIoCtx); 2522 pIoCtx->pfnIoCtxTransferNext = vdWriteHelperCommitAsync; 2523 } 2524 2525 return rc; 2526 } 2527 2493 2528 static int vdWriteHelperStandardAssemble(PVDIOCTX pIoCtx) 2494 2529 { … … 2520 2555 } 2521 2556 2522 /* Zero out the remainder of this block. Will never be visible, as this2523 * is beyond the limit of the image. */2524 if (cbFill)2525 {2526 RTSgBufAdvance(&pIoCtx->Req.Io.SgBuf, cbReadImage);2527 vdIoCtxSet(pIoCtx, '\0', cbFill);2528 }2529 2530 2557 if (cbReadImage) 2531 2558 { 2532 2559 /* Read remaining data. */ 2560 pIoCtx->pfnIoCtxTransferNext = vdWriteHelperStandardReadImageAsync; 2561 2562 /* Read the data that goes before the write to fill the block. */ 2563 pIoCtx->Req.Io.cbTransferLeft = (uint32_t)cbReadImage; Assert(cbReadImage == (uint32_t)cbReadImage); 2564 pIoCtx->Req.Io.cbTransfer = pIoCtx->Req.Io.cbTransferLeft; 2565 pIoCtx->Req.Io.uOffset += cbWriteCopy; 2533 2566 } 2534 2567 else 2535 2568 { 2569 /* Zero out the remainder of this block. Will never be visible, as this 2570 * is beyond the limit of the image. */ 2571 if (cbFill) 2572 vdIoCtxSet(pIoCtx, '\0', cbFill); 2573 2536 2574 /* Write the full block to the virtual disk. */ 2537 2575 RTSgBufReset(&pIoCtx->Req.Io.SgBuf); 2576 vdIoCtxChildReset(pIoCtx); 2538 2577 pIoCtx->pfnIoCtxTransferNext = vdWriteHelperCommitAsync; 2539 2578 } … … 2543 2582 /* Write the full block to the virtual disk. */ 2544 2583 RTSgBufReset(&pIoCtx->Req.Io.SgBuf); 2584 vdIoCtxChildReset(pIoCtx); 2545 2585 pIoCtx->pfnIoCtxTransferNext = vdWriteHelperCommitAsync; 2546 2586 } … … 2557 2597 pIoCtx->fFlags |= VDIOCTX_FLAGS_ZERO_FREE_BLOCKS; 2558 2598 2559 if (pIoCtx->Req.Io.cbTransferLeft) 2599 if ( pIoCtx->Req.Io.cbTransferLeft 2600 && !pIoCtx->cDataTransfersPending) 2560 2601 rc = vdReadHelperAsync(pIoCtx); 2561 2602 … … 2592 2633 /* If we have data to be written, use that instead of reading 2593 2634 * data from the image. */ 2594 cbWriteCopy;2595 2635 if (cbWrite > cbThisWrite) 2596 2636 cbWriteCopy = RT_MIN(cbWrite - cbThisWrite, cbPostRead); 2637 else 2638 cbWriteCopy = 0; 2597 2639 2598 2640 /* Figure out how much we cannot read from the image, because -
trunk/src/VBox/Storage/VHD.cpp
r48851 r49944 1636 1636 { 1637 1637 /* Check if the block allocation should be suppressed. */ 1638 if (fWrite & VD_WRITE_NO_ALLOC) 1638 if ( (fWrite & VD_WRITE_NO_ALLOC) 1639 || (cbWrite != pImage->cbDataBlock)) 1639 1640 { 1640 1641 *pcbPreRead = cBATEntryIndex * VHD_SECTOR_SIZE;
Note:
See TracChangeset
for help on using the changeset viewer.