Lines Matching refs:vcb
113 ExtendedVCB *vcb,
119 ExtendedVCB *vcb,
124 ExtendedVCB *vcb,
133 ExtendedVCB *vcb,
142 ExtendedVCB *vcb,
152 ExtendedVCB *vcb,
176 ; vcb - Pointer to ExtendedVCB for the volume to allocate space on
201 ExtendedVCB *vcb, /* which volume to allocate space on */
222 freeBlocks = hfs_freeblks(VCBTOHFS(vcb), 0);
250 HFS_MOUNT_LOCK(vcb, TRUE);
251 startingBlock = vcb->nextAllocation;
252 HFS_MOUNT_UNLOCK(vcb, TRUE);
255 if (startingBlock >= vcb->allocLimit) {
264 err = BlockAllocateContig(vcb, startingBlock, minBlocks, maxBlocks,
272 ((*actualStartBlock < VCBTOHFS(vcb)->hfs_metazone_start) ||
273 (*actualStartBlock > VCBTOHFS(vcb)->hfs_metazone_end))) {
274 HFS_MOUNT_LOCK(vcb, TRUE);
275 HFS_UPDATE_NEXT_ALLOCATION(vcb, *actualStartBlock);
276 HFS_MOUNT_UNLOCK(vcb, TRUE);
286 err = BlockAllocateKnown(vcb, maxBlocks, actualStartBlock, actualNumBlocks);
288 err = BlockAllocateAny(vcb, startingBlock, vcb->allocLimit,
292 err = BlockAllocateAny(vcb, 1, startingBlock, maxBlocks,
312 HFS_MOUNT_LOCK(vcb, TRUE);
315 ((*actualStartBlock < VCBTOHFS(vcb)->hfs_metazone_start) ||
316 (*actualStartBlock > VCBTOHFS(vcb)->hfs_metazone_end))) {
317 HFS_UPDATE_NEXT_ALLOCATION(vcb, *actualStartBlock);
322 vcb->freeBlocks -= *actualNumBlocks;
323 MarkVCBDirty(vcb);
324 HFS_MOUNT_UNLOCK(vcb, TRUE);
326 hfs_generate_volume_notifications(VCBTOHFS(vcb));
341 ; vcb - Pointer to ExtendedVCB for the volume to free space on
355 ExtendedVCB *vcb, // Which volume to deallocate space on
372 err = BlockMarkFree(vcb, firstBlock, numBlocks);
379 HFS_MOUNT_LOCK(vcb, TRUE);
380 vcb->freeBlocks += numBlocks;
381 if (vcb->nextAllocation == (firstBlock + numBlocks))
382 HFS_UPDATE_NEXT_ALLOCATION(vcb, (vcb->nextAllocation - numBlocks));
383 MarkVCBDirty(vcb);
384 HFS_MOUNT_UNLOCK(vcb, TRUE);
386 hfs_generate_volume_notifications(VCBTOHFS(vcb));
400 MetaZoneFreeBlocks(ExtendedVCB *vcb)
415 bit = VCBTOHFS(vcb)->hfs_metazone_start;
419 lastbit = VCBTOHFS(vcb)->hfs_metazone_end;
420 bytesperblock = vcb->vcbVBMIOSize;
431 (void) ReleaseBitmapBlock(vcb, blockRef, false);
434 if (ReadBitmapBlock(vcb, bit, &currCache, &blockRef) != 0) {
447 (void) ReleaseBitmapBlock(vcb, blockRef, false);
458 ExtendedVCB *vcb,
461 struct hfsmount *hfsmp = VCBTOHFS(vcb);
485 ; vcb -- Pointer to ExtendedVCB
494 ExtendedVCB *vcb,
508 REQUIRE_FILE_LOCK(vcb->hfs_allocation_vp, false);
510 blockSize = (u_int32_t)vcb->vcbVBMIOSize;
513 if (vcb->vcbSigWord == kHFSPlusSigWord) {
514 vp = vcb->hfs_allocation_vp; /* use allocation file vnode */
517 vp = VCBTOHFS(vcb)->hfs_devvp; /* use device I/O vnode */
518 block += vcb->vcbVBMSt; /* map to physical block */
546 ; vcb
552 ExtendedVCB *vcb,
567 struct hfsmount *hfsmp = VCBTOHFS(vcb);
594 vcb Pointer to volume where space is to be allocated
606 ExtendedVCB *vcb,
630 err = BlockFindContiguous(vcb, startingBlock, vcb->allocLimit, minBlocks,
637 err = BlockFindContiguous(vcb, 1, startingBlock, minBlocks, maxBlocks,
644 err = BlockMarkAllocated(vcb, *actualStartBlock, *actualNumBlocks);
660 vcb Pointer to volume where space is to be allocated
672 ExtendedVCB *vcb,
691 struct hfsmount *hfsmp = VCBTOHFS(vcb);
700 if (!useMetaZone && (vcb->hfs_flags & HFS_METADATA_ZONE)) {
701 if (startingBlock <= vcb->hfs_metazone_end) {
702 if (endingBlock > (vcb->hfs_metazone_end + 2))
703 startingBlock = vcb->hfs_metazone_end + 1;
719 err = ReadBitmapBlock(vcb, startingBlock, &currCache, &blockRef);
729 bitsPerBlock = vcb->vcbVBMIOSize * kBitsPerByte;
730 wordsPerBlock = vcb->vcbVBMIOSize / kBytesPerWord;
758 err = ReleaseBitmapBlock(vcb, blockRef, false);
765 block = NextBitmapBlock(vcb, block);
772 err = ReadBitmapBlock(vcb, block, &currCache, &blockRef);
830 err = ReleaseBitmapBlock(vcb, blockRef, true);
839 nextBlock = NextBitmapBlock(vcb, block);
845 err = ReadBitmapBlock(vcb, block, &currCache, &blockRef);
867 if ((*actualStartBlock + *actualNumBlocks) > vcb->allocLimit)
868 panic("BlockAllocateAny: allocation overflow on \"%s\"", vcb->vcbVN);
876 (void) ReleaseBitmapBlock(vcb, blockRef, dirty);
891 vcb Pointer to volume where space is to be allocated
903 ExtendedVCB *vcb,
913 if (vcb->vcbFreeExtCnt == 0)
917 *actualStartBlock = vcb->vcbFreeExt[0].startBlock;
918 foundBlocks = vcb->vcbFreeExt[0].blockCount;
924 newStartBlock = vcb->vcbFreeExt[0].startBlock + foundBlocks;
925 newBlockCount = vcb->vcbFreeExt[0].blockCount - foundBlocks;
929 for (i=1; i<vcb->vcbFreeExtCnt; ++i)
931 if (vcb->vcbFreeExt[i].blockCount > newBlockCount)
933 vcb->vcbFreeExt[i-1].startBlock = vcb->vcbFreeExt[i].startBlock;
934 vcb->vcbFreeExt[i-1].blockCount = vcb->vcbFreeExt[i].blockCount;
945 if (i == vcb->vcbFreeExtCnt)
948 --vcb->vcbFreeExtCnt;
953 vcb->vcbFreeExt[i-1].startBlock = newStartBlock;
954 vcb->vcbFreeExt[i-1].blockCount = newBlockCount;
958 if ((*actualStartBlock + *actualNumBlocks) > vcb->allocLimit)
960 printf ("hfs: BlockAllocateKnown() found allocation overflow on \"%s\"", vcb->vcbVN);
961 hfs_mark_volume_inconsistent(vcb);
971 err = BlockMarkAllocated(vcb, *actualStartBlock, *actualNumBlocks);
989 vcb Pointer to volume where space is to be allocated
996 ExtendedVCB *vcb,
1011 struct hfsmount *hfsmp = VCBTOHFS(vcb);
1018 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
1026 bitsPerBlock = vcb->vcbVBMIOSize * kBitsPerByte;
1027 wordsPerBlock = vcb->vcbVBMIOSize / kBytesPerWord;
1076 err = ReleaseBitmapBlock(vcb, blockRef, true);
1079 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
1114 err = ReleaseBitmapBlock(vcb, blockRef, true);
1117 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
1142 (void)ReleaseBitmapBlock(vcb, blockRef, true);
1158 vcb Pointer to volume where space is to be freed
1165 ExtendedVCB *vcb,
1180 struct hfsmount *hfsmp = VCBTOHFS(vcb);
1184 * NOTE: We use vcb->totalBlocks instead of vcb->allocLimit because we
1187 if (startingBlock + numBlocks > vcb->totalBlocks) {
1188 printf ("hfs: BlockMarkFree() trying to free non-existent blocks starting at %u (numBlock=%u) on volume %s\n", startingBlock, numBlocks, vcb->vcbVN);
1189 hfs_mark_volume_inconsistent(vcb);
1195 discard.offset = (uint64_t)startingBlock * (uint64_t)vcb->blockSize;
1196 discard.length = (uint64_t)numBlocks * (uint64_t)vcb->blockSize;
1203 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
1216 bitsPerBlock = vcb->vcbVBMIOSize * kBitsPerByte;
1217 wordsPerBlock = vcb->vcbVBMIOSize / kBytesPerWord;
1258 err = ReleaseBitmapBlock(vcb, blockRef, true);
1261 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
1294 err = ReleaseBitmapBlock(vcb, blockRef, true);
1297 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
1320 (void)ReleaseBitmapBlock(vcb, blockRef, true);
1324 VNOP_IOCTL(vcb->hfs_devvp, DKIOCDISCARD, (caddr_t)&discard, 0, vfs_context_kernel());
1334 printf ("hfs: BlockMarkFree() trying to free unallocated blocks on volume %s\n", vcb->vcbVN);
1335 hfs_mark_volume_inconsistent(vcb);
1352 vcb Pointer to volume where space is to be allocated
1370 ExtendedVCB *vcb,
1399 if (!useMetaZone && (vcb->hfs_flags & HFS_METADATA_ZONE)) {
1400 if (startingBlock <= vcb->hfs_metazone_end) {
1401 if (endingBlock > (vcb->hfs_metazone_end + 2))
1402 startingBlock = vcb->hfs_metazone_end + 1;
1423 currentBlock = NextBitmapBlock(vcb, currentBlock);
1428 err = ReadBitmapBlock(vcb, currentBlock, &buffer, &blockRef);
1434 wordsPerBlock = vcb->vcbVBMIOSize / kBytesPerWord;
1480 err = ReleaseBitmapBlock(vcb, blockRef, false);
1487 currentBlock = NextBitmapBlock(vcb, currentBlock);
1493 err = ReadBitmapBlock(vcb, currentBlock, &buffer, &blockRef);
1566 err = ReleaseBitmapBlock(vcb, blockRef, false);
1575 nextBlock = NextBitmapBlock(vcb, currentBlock);
1581 err = ReadBitmapBlock(vcb, currentBlock, &buffer, &blockRef);
1628 tempWord = vcb->vcbFreeExtCnt;
1629 if (tempWord == kMaxFreeExtents && vcb->vcbFreeExt[kMaxFreeExtents-1].blockCount < foundBlocks)
1634 while (tempWord && vcb->vcbFreeExt[tempWord-1].blockCount < foundBlocks)
1636 vcb->vcbFreeExt[tempWord] = vcb->vcbFreeExt[tempWord-1];
1639 vcb->vcbFreeExt[tempWord].startBlock = firstBlock;
1640 vcb->vcbFreeExt[tempWord].blockCount = foundBlocks;
1642 if (vcb->vcbFreeExtCnt < kMaxFreeExtents)
1643 ++vcb->vcbFreeExtCnt;
1665 if ((firstBlock + foundBlocks) > vcb->allocLimit) {
1667 vcb->vcbVN, startingBlock, endingBlock, currentBlock,
1673 (void) ReleaseBitmapBlock(vcb, blockRef, false);