- Timestamp:
- Nov 16, 2016 2:00:45 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/IOBufMgmt.cpp
r64674 r64682 189 189 /* Round to the next power of two and get the bin to try first. */ 190 190 uint32_t u32Order = ASMBitLastSetU32((uint32_t)cb) - 1; 191 if (cb Alloc & ~RT_BIT_32(u32Order))192 u32Order <<= 1;191 if (cb & (RT_BIT_32(u32Order) - 1)) 192 u32Order++; 193 193 194 194 u32Order = RT_CLAMP(u32Order, pThis->u32OrderMin, pThis->u32OrderMax); … … 374 374 unsigned iSeg = 0; 375 375 size_t cbLeft = cbIoBuf; 376 size_t cbIoBufAlloc = 0; 376 377 PRTSGSEG pSeg = &pIoBufDesc->Int.aSegs[0]; 377 378 … … 386 387 pSeg++; 387 388 cbLeft -= RT_MIN(cbAlloc, cbLeft); 389 cbIoBufAlloc += cbAlloc; 388 390 } 389 391 … … 395 397 pIoBufDesc->Int.cSegsUsed = iSeg; 396 398 pIoBufDesc->Int.pIoBufMgr = pThis; 397 *pcbIoBufAllocated = cbIoBuf - cbLeft;399 *pcbIoBufAllocated = cbIoBufAlloc; 398 400 Assert( (RT_SUCCESS(rc) && *pcbIoBufAllocated > 0) 399 401 || RT_FAILURE(rc)); 400 402 401 pThis->cbFree -= cbIoBuf - cbLeft;403 pThis->cbFree -= cbIoBufAlloc; 402 404 403 405 RTCritSectLeave(&pThis->CritSectAlloc); … … 429 431 pBin->papvFree[pBin->iFree] = pSeg->pvSeg; 430 432 pBin->iFree++; 431 pThis->cbFree += (size_t)RT_BIT_32(u32Order);433 pThis->cbFree += pSeg->cbSeg; 432 434 } 433 435
Note:
See TracChangeset
for help on using the changeset viewer.