Lines Matching defs:cBlocks
183 uint64_t cBlocks;
220 uint64_t cBlocks;
231 uint64_t cBlocks;
443 * @param cBlocks The number of blocks the bitmap can manage.
448 static int vciBlkMapCreate(uint64_t cBlocks, PVCIBLKMAP *ppBlkMap, uint32_t *pcBlkMap)
451 uint32_t cbBlkMap = RT_ALIGN_Z(cBlocks / sizeof(VciBlkMapEnt) / 8, VCI_BLOCK_SIZE);
455 LogFlowFunc(("cBlocks=%u ppBlkMap=%#p pcBlkMap=%#p\n", cBlocks, ppBlkMap, pcBlkMap));
459 pBlkMap->cBlocks = cBlocks;
462 pBlkMap->cBlocksFree = cBlocks;
467 pFree->cBlocks = cBlocks;
547 BlkMap.cBlocks = RT_LE2H_U32(BlkMap.cBlocks);
554 && BlkMap.cBlocks == BlkMap.cBlocksFree + BlkMap.cBlocksAllocMeta + BlkMap.cBlocksAllocData
555 && VCI_BYTE2BLOCK(BlkMap.cBlocks / 8) == cBlkMap)
560 pBlkMap->cBlocks = BlkMap.cBlocks;
574 uint64_t cBlocksLeft = VCI_BYTE2BLOCK(pBlkMap->cBlocks / 8);
585 pRangeCur->cBlocks = 0;
615 pRangeCur->cBlocks += cBits;
621 pRangeCur->cBlocks += iBit;
632 pRangeNew->offAddrStart = pRangeCur->offAddrStart + pRangeCur->cBlocks;
633 pRangeNew->cBlocks = 0;
703 if (VCI_BYTE2BLOCK(pBlkMap->cBlocks / 8) + VCI_BYTE2BLOCK(sizeof(VciBlkMap)) == cBlkMap)
710 BlkMap.cBlocks = RT_H2LE_U32(pBlkMap->cBlocks);
728 uint64_t cBlocks = pCur->cBlocks;
730 while (cBlocks)
732 uint64_t cBlocksMax = RT_MIN(cBlocks, sizeof(abBitmapBuffer) * 8 - iBit);
740 cBlocks -= cBlocksMax;
796 * @param cBlocks How many blocks to allocate.
800 static int vciBlkMapAllocate(PVCIBLKMAP pBlkMap, uint32_t cBlocks, uint32_t fFlags,
807 LogFlowFunc(("pBlkMap=%#p cBlocks=%u poffBlockAddr=%#p\n",
808 pBlkMap, cBlocks, poffBlockAddr));
815 && pCur->cBlocks >= cBlocks)
818 || pCur->cBlocks < pBestFit->cBlocks)
822 if (pBestFit->cBlocks == cBlocks)
835 if (pBestFit->cBlocks > cBlocks)
843 pFree->cBlocks = pBestFit->cBlocks - cBlocks;
844 pBestFit->cBlocks -= pFree->cBlocks;
845 pFree->offAddrStart = pBestFit->offAddrStart + cBlocks;
869 pBlkMap->cBlocksAllocMeta += cBlocks;
871 pBlkMap->cBlocksAllocData += cBlocks;
873 pBlkMap->cBlocksFree -= cBlocks;
909 * @param cBlocks How many blocks to free.
912 static void vciBlkMapFree(PVCIBLKMAP pBlkMap, uint64_t offBlockAddr, uint32_t cBlocks,
917 LogFlowFunc(("pBlkMap=%#p offBlockAddr=%llu cBlocks=%u\n",
918 pBlkMap, offBlockAddr, cBlocks));
920 while (cBlocks)
927 && pBlk->cBlocks <= cBlocks)
930 cBlocks -= pBlk->cBlocks;
931 offBlockAddr += pBlk->cBlocks;
939 Assert(pBlkPrev->offAddrStart + pBlkPrev->cBlocks == pBlk->offAddrStart);
940 pBlkPrev->cBlocks += pBlk->cBlocks;
957 Assert(pBlk->offAddrStart + pBlk->cBlocks == pBlkNext->offAddrStart);
958 pBlk->cBlocks += pBlkNext->cBlocks;
976 pBlkMap->cBlocksAllocMeta -= cBlocks;
978 pBlkMap->cBlocksAllocData -= cBlocks;
980 pBlkMap->cBlocksFree += cBlocks;
1293 uint64_t cBlocks = cbSize / VCI_BLOCK_SIZE; /* Size of the cache in blocks. */
1323 rc = vciBlkMapCreate(cBlocks, &pCache->pBlkMap, &cBlkMap);
1388 Hdr.cBlocksCache = RT_H2LE_U64(cBlocks);