Lines Matching defs:extent_info

5116  *	extent_info -   This is the structure that contains state about 
5128 hfs_split_extent(struct hfs_reclaim_extent_info *extent_info, uint32_t newBlockCount)
5131 int index = extent_info->extent_index;
5149 is_xattr = extent_info->is_xattr;
5150 extents = extent_info->extents;
5151 cp = VTOC(extent_info->vp);
5161 printf ("hfs_split_extent: Split record:%u recStartBlock=%u %u:(%u,%u) for %u blocks\n", extent_info->overflow_count, extent_info->recStartBlock, index, extents[index].startBlock, extents[index].blockCount, newBlockCount);
5167 if ((extent_info->fileID == kHFSExtentsFileID) && (extents[kHFSPlusExtentDensity - 1].blockCount != 0)) {
5177 read_recStartBlock = extent_info->recStartBlock;
5247 if (extent_info->catalog_fp) {
5248 /* (extent_info->catalog_fp != NULL) means the newly split
5259 * iterator information from the shared extent_info structure
5261 error = BTReplaceRecord(extent_info->fcb, extent_info->iterator,
5262 &(extent_info->btdata), extent_info->recordlen);
5264 printf ("hfs_split_extent: fileID=%u BTReplaceRecord returned error=%d\n", extent_info->fileID, error);
5292 bcopy((HFSPlusAttrKey *)&(extent_info->iterator->key), xattr_key, sizeof(HFSPlusAttrKey));
5309 extents_key->forkType = extent_info->forkType;
5310 extents_key->fileID = extent_info->fileID;
5363 error = BTSearchRecord(extent_info->fcb, &iterator, &btdata, &reclen, &iterator);
5366 printf ("hfs_split_extent: fileID=%u startBlock=%u BTSearchRecord error=%d\n", extent_info->fileID, read_recStartBlock, error);
5435 extents_key->forkType = extent_info->forkType;
5436 extents_key->fileID = extent_info->fileID;
5474 error = BTDeleteRecord(extent_info->fcb, &iterator);
5476 printf ("hfs_split_extent: fileID=%u startBlock=%u BTDeleteRecord error=%d\n", extent_info->fileID, read_recStartBlock, error);
5491 error = BTInsertRecord(extent_info->fcb, &iterator, &btdata, reclen);
5493 printf ("hfs_split_extent: fileID=%u, startBlock=%u BTInsertRecord error=%d\n", extent_info->fileID, write_recStartBlock, error);
5510 BTFlushPath(extent_info->fcb);
5541 * extent_info - This is the structure that contains state about
5549 hfs_reclaim_extent(struct hfsmount *hfsmp, const u_long allocLimit, struct hfs_reclaim_extent_info *extent_info, vfs_context_t context)
5564 index = extent_info->extent_index;
5565 cp = VTOC(extent_info->vp);
5567 oldStartBlock = extent_info->extents[index].startBlock;
5568 oldBlockCount = extent_info->extents[index].blockCount;
5571 printf ("hfs_reclaim_extent: Examine record:%u recStartBlock=%u, %u:(%u,%u)\n", extent_info->overflow_count, extent_info->recStartBlock, index, oldStartBlock, oldBlockCount);
5578 extent_info->cur_blockCount += oldBlockCount;
5589 extent_info->lockflags = hfs_systemfile_lock(hfsmp, extent_info->lockflags, HFS_EXCLUSIVE_LOCK);
5602 int idx = extent_info->extent_index;
5603 printf ("hfs_reclaim_extent: Split straddling extent %u:(%u,%u) for %u blocks\n", idx, extent_info->extents[idx].startBlock, extent_info->extents[idx].blockCount, newBlockCount);
5609 if (extent_info->is_sysfile) {
5610 node_size = get_btree_nodesize(extent_info->vp);
5644 error = hfs_split_extent(extent_info, newBlockCount);
5651 int idx = extent_info->extent_index;
5652 printf ("hfs_reclaim_extent: Split straddling extent %u:(%u,%u) for %u blocks failed, relocate full extent\n", idx, extent_info->extents[idx].startBlock, extent_info->extents[idx].blockCount, newBlockCount);
5667 if (extent_info->is_sysfile) {
5673 if ((extent_info->is_sysfile == false) &&
5689 printf ("hfs_reclaim_extent: fileID=%u start=%u, %u:(%u,%u) BlockAllocate error=%d\n", extent_info->fileID, extent_info->recStartBlock, index, oldStartBlock, oldBlockCount, error);
5698 if (extent_info->is_sysfile) {
5699 node_size = get_btree_nodesize(extent_info->vp);
5713 printf ("hfs_reclaim_extent: Not enough contiguous blocks available to relocate fileID=%d\n", extent_info->fileID);
5727 error = hfs_split_extent(extent_info, newBlockCount);
5729 printf ("hfs_reclaim_extent: fileID=%u start=%u, %u:(%u,%u) split error=%d\n", extent_info->fileID, extent_info->recStartBlock, index, oldStartBlock, oldBlockCount, error);
5735 printf ("hfs_reclaim_extent: fileID=%u start=%u, %u:(%u,%u) contig BlockAllocate error=%d\n", extent_info->fileID, extent_info->recStartBlock, index, oldStartBlock, oldBlockCount, error);
5741 error = hfs_copy_extent(hfsmp, extent_info->vp, oldStartBlock,
5744 printf ("hfs_reclaim_extent: fileID=%u start=%u, %u:(%u,%u)=>(%u,%u) hfs_copy_extent error=%d\n", extent_info->fileID, extent_info->recStartBlock, index, oldStartBlock, oldBlockCount, newStartBlock, newBlockCount, error);
5749 extent_info->extents[index].startBlock = newStartBlock;
5752 if (extent_info->catalog_fp) {
5754 if (extent_info->is_dirlink) {
5755 error = cat_update_dirlink(hfsmp, extent_info->forkType,
5756 extent_info->dirlink_desc, extent_info->dirlink_attr,
5757 &(extent_info->dirlink_fork->ff_data));
5761 if (extent_info->is_sysfile) {
5767 error = BTReplaceRecord(extent_info->fcb, extent_info->iterator,
5768 &(extent_info->btdata), extent_info->recordlen);
5771 printf ("hfs_reclaim_extent: fileID=%u, update record error=%u\n", extent_info->fileID, error);
5778 printf ("hfs_reclaim_extent: fileID=%u start=%u, %u:(%u,%u) BlockDeallocate error=%d\n", extent_info->fileID, extent_info->recStartBlock, index, oldStartBlock, oldBlockCount, error);
5781 extent_info->blocks_relocated += newBlockCount;
5784 printf ("hfs_reclaim_extent: Relocated record:%u %u:(%u,%u) to (%u,%u)\n", extent_info->overflow_count, index, oldStartBlock, oldBlockCount, newStartBlock, newBlockCount);
5794 extent_info->cur_blockCount += newBlockCount;
5797 hfs_systemfile_unlock(hfsmp, extent_info->lockflags);
5803 if ((extent_info->catalog_fp) &&
5804 (extent_info->is_sysfile == false)) {
5805 (void) hfs_update(extent_info->vp, MNT_WAIT);
5867 struct hfs_reclaim_extent_info *extent_info;
5894 MALLOC(extent_info, struct hfs_reclaim_extent_info *,
5896 if (extent_info == NULL) {
5899 bzero(extent_info, sizeof(struct hfs_reclaim_extent_info));
5900 extent_info->vp = vp;
5901 extent_info->fileID = fileID;
5902 extent_info->forkType = forktype;
5903 extent_info->is_sysfile = vnode_issystem(vp);
5905 extent_info->is_dirlink = true;
5909 if ((fileID == kHFSCatalogFileID) || (extent_info->is_dirlink == true)) {
5916 extent_info->lockflags = lockflags;
5917 extent_info->fcb = VTOF(hfsmp->hfs_extents_vp);
5929 if (extent_info->is_sysfile) {
5938 } else if (extent_info->is_dirlink == false) {
5974 printf("hfs_reclaim_file: === Start reclaiming %sfork for %sid=%u ===\n", (forktype ? "rsrc" : "data"), (extent_info->is_dirlink ? "dirlink" : "file"), fileID);
5977 if (extent_info->is_dirlink) {
5978 MALLOC(extent_info->dirlink_desc, struct cat_desc *,
5980 MALLOC(extent_info->dirlink_attr, struct cat_attr *,
5982 MALLOC(extent_info->dirlink_fork, struct filefork *,
5984 if ((extent_info->dirlink_desc == NULL) ||
5985 (extent_info->dirlink_attr == NULL) ||
5986 (extent_info->dirlink_fork == NULL)) {
5995 fp = extent_info->dirlink_fork;
5996 bzero(extent_info->dirlink_fork, sizeof(struct filefork));
5997 extent_info->dirlink_fork->ff_cp = cp;
6000 extent_info->dirlink_desc, extent_info->dirlink_attr,
6001 &(extent_info->dirlink_fork->ff_data));
6012 extent_info->catalog_fp = fp;
6013 extent_info->recStartBlock = 0;
6014 extent_info->extents = extent_info->catalog_fp->ff_extents;
6020 extent_info->extent_index = i;
6021 error = hfs_reclaim_extent(hfsmp, allocLimit, extent_info, context);
6023 printf ("hfs_reclaim_file: fileID=%u #%d %u:(%u,%u) hfs_reclaim_extent error=%d\n", fileID, extent_info->overflow_count, i, fp->ff_extents[i].startBlock, fp->ff_extents[i].blockCount, error);
6032 if (fp->ff_blocks <= extent_info->cur_blockCount) {
6034 printf ("hfs_reclaim_file: Nothing more to relocate, offset=%d, ff_blocks=%u, cur_blockCount=%u\n", i, fp->ff_blocks, extent_info->cur_blockCount);
6040 printf ("hfs_reclaim_file: Will check overflow records, offset=%d, ff_blocks=%u, cur_blockCount=%u\n", i, fp->ff_blocks, extent_info->cur_blockCount);
6043 MALLOC(extent_info->iterator, struct BTreeIterator *, sizeof(struct BTreeIterator), M_TEMP, M_WAITOK);
6044 if (extent_info->iterator == NULL) {
6048 bzero(extent_info->iterator, sizeof(struct BTreeIterator));
6049 key = (HFSPlusExtentKey *) &(extent_info->iterator->key);
6053 key->startBlock = extent_info->cur_blockCount;
6055 extent_info->btdata.bufferAddress = extent_info->record.overflow;
6056 extent_info->btdata.itemSize = sizeof(HFSPlusExtentRecord);
6057 extent_info->btdata.itemCount = 1;
6059 extent_info->catalog_fp = NULL;
6063 error = BTSearchRecord(extent_info->fcb, extent_info->iterator,
6064 &(extent_info->btdata), &(extent_info->recordlen),
6065 extent_info->iterator);
6068 extent_info->overflow_count++;
6069 extent_info->recStartBlock = key->startBlock;
6070 extent_info->extents = extent_info->record.overflow;
6072 if (extent_info->record.overflow[i].blockCount == 0) {
6075 extent_info->extent_index = i;
6076 error = hfs_reclaim_extent(hfsmp, allocLimit, extent_info, context);
6078 printf ("hfs_reclaim_file: fileID=%u #%d %u:(%u,%u) hfs_reclaim_extent error=%d\n", fileID, extent_info->overflow_count, i, extent_info->record.overflow[i].startBlock, extent_info->record.overflow[i].blockCount, error);
6085 error = BTIterateRecord(extent_info->fcb, kBTreeNextRecord,
6086 extent_info->iterator, &(extent_info->btdata),
6087 &(extent_info->recordlen));
6103 if (extent_info->blocks_relocated) {
6104 hfsmp->hfs_resize_blocksmoved += extent_info->blocks_relocated;
6108 extent_info->blocks_relocated, fileID, hfsmp->vcbVN);
6111 if (extent_info->iterator) {
6112 FREE(extent_info->iterator, M_TEMP);
6115 cat_releasedesc(extent_info->dirlink_desc);
6117 if (extent_info->dirlink_desc) {
6118 FREE(extent_info->dirlink_desc, M_TEMP);
6120 if (extent_info->dirlink_attr) {
6121 FREE(extent_info->dirlink_attr, M_TEMP);
6123 if (extent_info->dirlink_fork) {
6124 FREE(extent_info->dirlink_fork, M_TEMP);
6126 if ((extent_info->blocks_relocated != 0) && (extent_info->is_sysfile == false)) {
6132 if (extent_info) {
6133 FREE(extent_info, M_TEMP);
6643 struct hfs_reclaim_extent_info *extent_info;
6652 MALLOC(extent_info, struct hfs_reclaim_extent_info *,
6654 if (extent_info == NULL) {
6657 bzero(extent_info, sizeof(struct hfs_reclaim_extent_info));
6658 extent_info->vp = vp;
6659 extent_info->fileID = fileID;
6660 extent_info->is_xattr = true;
6661 extent_info->is_sysfile = vnode_issystem(vp);
6662 extent_info->fcb = VTOF(hfsmp->hfs_attribute_vp);
6663 lockflags = &(extent_info->lockflags);
6666 /* Initialize iterator from the extent_info structure */
6667 MALLOC(extent_info->iterator, struct BTreeIterator *,
6669 if (extent_info->iterator == NULL) {
6673 bzero(extent_info->iterator, sizeof(struct BTreeIterator));
6676 key = (HFSPlusAttrKey *)&(extent_info->iterator->key);
6682 /* Initialize btdata from extent_info structure. Note that the
6684 * extent_info structure itself.
6686 extent_info->btdata.bufferAddress = &(extent_info->record.xattr);
6687 extent_info->btdata.itemSize = sizeof(HFSPlusAttrRecord);
6688 extent_info->btdata.itemCount = 1;
6709 error = BTSearchRecord(extent_info->fcb, extent_info->iterator,
6710 &(extent_info->btdata), &(extent_info->recordlen),
6711 extent_info->iterator);
6724 error = BTIterateRecord(extent_info->fcb, kBTreeNextRecord,
6725 extent_info->iterator, &(extent_info->btdata),
6726 &(extent_info->recordlen));
6738 if ((extent_info->record.xattr.recordType != kHFSPlusAttrForkData) &&
6739 (extent_info->record.xattr.recordType != kHFSPlusAttrExtents)) {
6743 if (extent_info->record.xattr.recordType == kHFSPlusAttrForkData) {
6744 extent_info->overflow_count = 0;
6745 extent_info->extents = extent_info->record.xattr.forkData.theFork.extents;
6746 } else if (extent_info->record.xattr.recordType == kHFSPlusAttrExtents) {
6747 extent_info->overflow_count++;
6748 extent_info->extents = extent_info->record.xattr.overflowExtents.extents;
6751 extent_info->recStartBlock = key->startBlock;
6753 if (extent_info->extents[i].blockCount == 0) {
6756 extent_info->extent_index = i;
6757 error = hfs_reclaim_extent(hfsmp, allocLimit, extent_info, context);
6767 if (extent_info->blocks_relocated) {
6768 hfsmp->hfs_resize_blocksmoved += extent_info->blocks_relocated;
6771 if (extent_info->iterator) {
6772 FREE(extent_info->iterator, M_TEMP);
6774 if (extent_info) {
6775 FREE(extent_info, M_TEMP);