Lines Matching refs:startingBlock

301 	u_int32_t		startingBlock,
310 u_int32_t startingBlock,
319 u_int32_t startingBlock,
328 u_int32_t startingBlock,
337 u_int32_t startingBlock,
353 u_int32_t startingBlock,
358 u_int32_t startingBlock,
377 u_int32_t startingBlock,
383 u_int32_t startingBlock,
391 u_int32_t startingBlock,
401 u_int32_t startingBlock,
406 u_int32_t startingBlock,
500 ; startingBlock - The first allocation block of the extent being freed.
504 static void hfs_unmap_free_extent(struct hfsmount *hfsmp, u_int32_t startingBlock, u_int32_t numBlocks)
512 KERNEL_DEBUG_CONSTANT(HFSDBG_UNMAP_FREE | DBG_FUNC_START, startingBlock, numBlocks, 0, 0, 0);
515 if (hfs_isallocated(hfsmp, startingBlock, numBlocks)) {
516 panic("hfs: %p: (%u,%u) unmapping allocated blocks", hfsmp, startingBlock, numBlocks);
522 offset = (u_int64_t) startingBlock * hfsmp->blockSize + (u_int64_t) hfsmp->hfsPlusIOPosOffset;
641 ; startingBlock - The first allocation block of the extent being allocated.
645 static void hfs_unmap_alloc_extent(struct hfsmount *hfsmp, u_int32_t startingBlock, u_int32_t numBlocks)
652 KERNEL_DEBUG_CONSTANT(HFSDBG_UNMAP_ALLOC | DBG_FUNC_START, startingBlock, numBlocks, 0, 0, 0);
655 offset = (u_int64_t) startingBlock * hfsmp->blockSize + (u_int64_t) hfsmp->hfsPlusIOPosOffset;
797 ; startingBlock - Preferred starting allocation block, 0 = no preference
818 u_int32_t startingBlock, /* preferred starting block, or 0 for no preference */
834 KERNEL_DEBUG_CONSTANT(HFSDBG_BLOCK_ALLOCATE | DBG_FUNC_START, startingBlock, minBlocks, maxBlocks, flags, 0);
908 if (startingBlock == 0) {
913 startingBlock = vcb->sparseAllocation;
916 startingBlock = vcb->nextAllocation;
923 if (startingBlock >= vcb->allocLimit) {
924 startingBlock = 0; /* overflow so start at beginning */
932 err = BlockAllocateContig(vcb, startingBlock, minBlocks, maxBlocks,
942 (*actualStartBlock > startingBlock) &&
956 err = BlockAllocateAny(vcb, startingBlock, vcb->allocLimit,
1004 * Now we have to do a bigger scan. Start at startingBlock and go up until the
1007 err = BlockAllocateAny(vcb, startingBlock, vcb->allocLimit,
1016 err = BlockAllocateAny(vcb, 1, startingBlock, maxBlocks,
1478 startingBlock Preferred first block for allocation
1490 u_int32_t startingBlock,
1500 return BlockAllocateContigRBTree(vcb, startingBlock, minBlocks, maxBlocks, useMetaZone,
1504 return BlockAllocateContigBitmap(vcb, startingBlock, minBlocks,
1514 u_int32_t startingBlock,
1524 KERNEL_DEBUG_CONSTANT(HFSDBG_ALLOC_CONTIG_BITMAP | DBG_FUNC_START, startingBlock, minBlocks, maxBlocks, useMetaZone, 0);
1534 * crosses startingBlock (i.e. starts before, ends after), then we
1536 * the second search look past startingBlock by minBlocks. But
1540 err = BlockFindContiguous(vcb, startingBlock, vcb->allocLimit, minBlocks,
1542 if (err == dskFulErr && startingBlock != 0) {
1547 err = BlockFindContiguous(vcb, 1, startingBlock, minBlocks, maxBlocks,
1575 u_int32_t startingBlock,
1591 /* Begin search at the end of the file, via startingBlock */
1593 search_sentinel.offset = startingBlock;
1751 hfsmp->vcbVN, node, startingBlock, minBlocks, maxBlocks);
1795 startingBlock Preferred first block for allocation
1813 u_int32_t startingBlock,
1823 return BlockAllocateAnyRBTree(vcb, startingBlock, maxBlocks, useMetaZone, actualStartBlock, actualNumBlocks);
1826 return BlockAllocateAnyBitmap(vcb, startingBlock, endingBlock, maxBlocks, useMetaZone, actualStartBlock, actualNumBlocks);
1840 u_int32_t startingBlock,
1852 err = BlockAllocateContigRBTree(vcb, startingBlock, 1, maxBlocks, useMetaZone,
1867 u_int32_t startingBlock,
1888 KERNEL_DEBUG_CONSTANT(HFSDBG_ALLOC_ANY_BITMAP | DBG_FUNC_START, startingBlock, endingBlock, maxBlocks, useMetaZone, 0);
1898 if (startingBlock <= vcb->hfs_metazone_end) {
1900 startingBlock = vcb->hfs_metazone_end + 1;
1909 if (maxBlocks > (endingBlock - startingBlock)) {
1910 maxBlocks = endingBlock - startingBlock;
1916 err = ReadBitmapBlock(vcb, startingBlock, &currCache, &blockRef);
1929 wordIndexInBlock = (startingBlock & (bitsPerBlock-1)) / kBitsPerWord;
1933 bitMask = kHighBitInWordMask >> (startingBlock & kBitsWithinWordMask);
1939 block=startingBlock;
2193 u_int32_t startingBlock,
2203 if ((startingBlock >= hfsmp->offset_block_end) &&
2212 err = BlockMarkAllocatedRBTree(vcb, startingBlock, numBlocks);
2216 if (!hfs_isallocated(hfsmp, startingBlock, numBlocks)) {
2218 startingBlock, numBlocks);
2220 check_rbtree_extents (hfsmp, startingBlock, numBlocks, ASSERT_ALLOC);
2229 return BlockMarkAllocatedInternal(vcb, startingBlock, numBlocks);
2250 startingBlock First block number to mark as allocated
2257 u_int32_t startingBlock,
2274 KERNEL_DEBUG_CONSTANT(HFSDBG_MARK_ALLOC_BITMAP | DBG_FUNC_START, startingBlock, numBlocks, 0, 0, 0);
2276 hfs_unmap_alloc_extent(vcb, startingBlock, numBlocks);
2282 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
2293 wordIndexInBlock = (startingBlock & (bitsPerBlock-1)) / kBitsPerWord;
2309 firstBit = startingBlock % kBitsPerWord;
2337 startingBlock += bitsPerBlock; // generate a block number in the next bitmap block
2343 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
2375 startingBlock += bitsPerBlock; // generate a block number in the next bitmap block
2381 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
2426 u_int32_t startingBlock,
2436 if (hfs_isallocated(hfsmp, startingBlock, numBlocks)) {
2438 startingBlock, numBlocks);
2440 check_rbtree_extents (VCBTOHFS(vcb), startingBlock, numBlocks, ASSERT_FREE);
2443 err = BlockMarkAllocatedInternal (vcb, startingBlock, numBlocks);
2448 if (!hfs_isallocated(hfsmp, startingBlock, numBlocks)) {
2450 startingBlock, numBlocks);
2457 rb_err = extent_tree_offset_alloc_space(&hfsmp->offset_tree, numBlocks, startingBlock);
2470 search_sentinel.offset = startingBlock;
2475 rb_err = extent_tree_offset_alloc_unaligned (&hfsmp->offset_tree, numBlocks, startingBlock);
2485 check_rbtree_extents (VCBTOHFS(vcb), startingBlock, numBlocks, ASSERT_ALLOC);
2522 u_int32_t startingBlock,
2531 if ((startingBlock >= hfsmp->offset_block_end) &&
2540 err = BlockMarkFreeRBTree(vcb, startingBlock, numBlocks);
2544 if (hfs_isallocated(hfsmp, startingBlock, numBlocks)) {
2546 startingBlock, numBlocks);
2548 check_rbtree_extents (hfsmp, startingBlock, numBlocks, ASSERT_FREE);
2555 return BlockMarkFreeInternal(vcb, startingBlock, numBlocks, true);
2579 * startingBlock: First block of the range to mark unused
2584 OSErr BlockMarkFreeUnused(ExtendedVCB *vcb, u_int32_t startingBlock, register u_int32_t numBlocks)
2599 * the bitmap block containing the bit for startingBlock.
2601 * bits to be marked unused from startingBlock to the
2602 * end of bitmap block containing startingBlock.
2604 lastBit = ((startingBlock + (bitsPerBlock - 1))/bitsPerBlock) * bitsPerBlock;
2605 curNumBlocks = lastBit - startingBlock;
2609 error = BlockMarkFreeInternal(vcb, startingBlock, curNumBlocks, false);
2613 startingBlock += curNumBlocks;
2635 if (hfs_isallocated(hfsmp, startingBlock, curNumBlocks) == true) {
2636 error = BlockMarkFreeInternal(vcb, startingBlock, curNumBlocks, false);
2641 startingBlock += curNumBlocks;
2659 startingBlock First block number to mark as freed
2675 u_int32_t startingBlock = startingBlock_in;
2700 (startingBlock + numBlocks > vcb->totalBlocks)) {
2702 panic ("BlockMarkFreeInternal() free non-existent blocks at %u (numBlock=%u) on vol %s\n", startingBlock, numBlocks, vcb->vcbVN);
2705 printf ("hfs: BlockMarkFreeInternal() trying to free non-existent blocks starting at %u (numBlock=%u) on volume %s\n", startingBlock, numBlocks, vcb->vcbVN);
2715 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
2727 wordIndexInBlock = (startingBlock & (bitsPerBlock-1)) / kBitsPerWord;
2730 // Look for a range of free blocks immediately before startingBlock
2735 currentBit = startingBlock % kBitsPerWord;
2760 currentBit = startingBlock % kBitsPerWord;
2786 startingBlock += bitsPerBlock; // generate a block number in the next bitmap block
2792 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
2823 startingBlock += bitsPerBlock; // generate a block number in the next bitmap block
2829 err = ReadBitmapBlock(vcb, startingBlock, &buffer, &blockRef);
2912 u_int32_t startingBlock,
2921 if (!hfs_isallocated(hfsmp, startingBlock, numBlocks)) {
2923 startingBlock, numBlocks);
2925 check_rbtree_extents (VCBTOHFS(vcb), startingBlock, numBlocks, ASSERT_ALLOC);
2928 err = BlockMarkFreeInternal(vcb, startingBlock, numBlocks, true);
2937 if ((startingBlock >= hfsmp->offset_block_end) &&
2950 if (hfs_isallocated(hfsmp, startingBlock, numBlocks)) {
2952 startingBlock, numBlocks);
2957 if (startingBlock >= hfsmp->offset_block_end) {
2969 newnode = extent_tree_free_space(&hfsmp->offset_tree, numBlocks, startingBlock);
2976 check_rbtree_extents (VCBTOHFS(vcb), startingBlock, numBlocks, ASSERT_FREE);
3017 startingBlock Preferred first block of range
3035 u_int32_t startingBlock,
3058 KERNEL_DEBUG_CONSTANT(HFSDBG_BLOCK_FIND_CONTIG | DBG_FUNC_START, startingBlock, endingBlock, minBlocks, maxBlocks, 0);
3068 if (startingBlock <= vcb->hfs_metazone_end) {
3070 startingBlock = vcb->hfs_metazone_end + 1;
3076 if ((endingBlock - startingBlock) < minBlocks)
3084 currentBlock = startingBlock;
3321 vcb->vcbVN, startingBlock, endingBlock, currentBlock,
3564 * startingBlock First allocation block number of the range to be scanned.
3582 hfs_isallocated_internal(struct hfsmount *hfsmp, u_int32_t startingBlock,
3598 KERNEL_DEBUG_CONSTANT(HFSDBG_IS_ALLOCATED | DBG_FUNC_START, startingBlock, numBlocks, stop_on_first, 0, 0);
3603 error = ReadBitmapBlock(hfsmp, startingBlock, &buffer, &blockRef);
3616 wordIndexInBlock = (startingBlock & (bitsPerBlock-1)) / kBitsPerWord;
3624 firstBit = startingBlock % kBitsPerWord;
3650 startingBlock += bitsPerBlock;
3656 error = ReadBitmapBlock(hfsmp, startingBlock, &buffer, &blockRef);
3682 startingBlock += bitsPerBlock;
3688 error = ReadBitmapBlock(hfsmp, startingBlock, &buffer, &blockRef);
3752 hfs_isallocated(struct hfsmount *hfsmp, u_int32_t startingBlock, u_int32_t numBlocks)
3757 error = hfs_isallocated_internal(hfsmp, startingBlock, numBlocks, true, &allocCount);
3933 int hfs_isallocated_scan(struct hfsmount *hfsmp, u_int32_t startingBlock, u_int32_t *bp_buf) {
3957 error = ReadBitmapBlock(hfsmp, startingBlock, &buffer, &blockRef);
3970 wordIndexInBlock = (startingBlock & (bitsPerBlock-1)) / kBitsPerWord;
3976 firstBit = startingBlock % kBitsPerWord;