void release_dup_extent_tree( xfs_agnumber_t agno) { pthread_mutex_lock(&dup_extent_tree_locks[agno]); btree_clear(dup_extent_trees[agno]); pthread_mutex_unlock(&dup_extent_tree_locks[agno]); }
void reset_bmaps(xfs_mount_t *mp) { xfs_agnumber_t agno; xfs_agblock_t ag_size; int ag_hdr_block; ag_hdr_block = howmany(4 * mp->m_sb.sb_sectsize, mp->m_sb.sb_blocksize); ag_size = mp->m_sb.sb_agblocks; for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) { if (agno == mp->m_sb.sb_agcount - 1) ag_size = (xfs_extlen_t)(mp->m_sb.sb_dblocks - (xfs_drfsbno_t)mp->m_sb.sb_agblocks * agno); #ifdef BTREE_STATS if (btree_find(ag_bmap[agno], 0, NULL)) { printf("ag_bmap[%d] btree stats:\n", i); btree_print_stats(ag_bmap[agno], stdout); } #endif /* * We always insert an item for the first block having a * given state. So the code below means: * * block 0..ag_hdr_block-1: XR_E_INUSE_FS * ag_hdr_block..ag_size: XR_E_UNKNOWN * ag_size... XR_E_BAD_STATE */ btree_clear(ag_bmap[agno]); btree_insert(ag_bmap[agno], 0, &states[XR_E_INUSE_FS]); btree_insert(ag_bmap[agno], ag_hdr_block, &states[XR_E_UNKNOWN]); btree_insert(ag_bmap[agno], ag_size, &states[XR_E_BAD_STATE]); } if (mp->m_sb.sb_logstart != 0) { set_bmap_ext(XFS_FSB_TO_AGNO(mp, mp->m_sb.sb_logstart), XFS_FSB_TO_AGBNO(mp, mp->m_sb.sb_logstart), mp->m_sb.sb_logblocks, XR_E_INUSE_FS); } reset_rt_bmap(); }
/*-----------------------------------------------------------------*/ void redoStackOffsets (void) { symbol *sym; int sPtr = 0; int xsPtr = -1; /* after register allocation is complete we know which variables will need to be assigned space on the stack. We will eliminate those variables which do not have the allocReq flag thus reducing the stack space */ for (sym = setFirstItem (istack->syms); sym; sym = setNextItem (istack->syms)) { int size = getSize (sym->type); /* nothing to do with parameters so continue */ if ((sym->_isparm && !IS_REGPARM (sym->etype))) continue; if (BTREE_STACK) { /* Remove them all, and let btree_alloc() below put them back in more efficiently. */ currFunc->stack -= size; SPEC_STAK (currFunc->etype) -= size; if(IS_AGGREGATE (sym->type) || sym->allocreq) btree_add_symbol (sym); } /* Do it the old way - compared to the btree approach we waste space when allocating variables that had their address taken, unions and aggregates. */ else { /* if allocation not required then subtract size from overall stack size & continue */ if (!IS_AGGREGATE (sym->type) && !sym->allocreq) { currFunc->stack -= size; SPEC_STAK (currFunc->etype) -= size; continue; } if (port->stack.direction > 0) { SPEC_STAK (sym->etype) = sym->stack = (sPtr + 1); sPtr += size; } else { sPtr -= size; SPEC_STAK (sym->etype) = sym->stack = sPtr; } } } if (BTREE_STACK && elementsInSet (istack->syms)) { btree_alloc (); btree_clear (); } /* do the same for the external stack */ if (!xstack) return; for (sym = setFirstItem (xstack->syms); sym; sym = setNextItem (xstack->syms)) { int size = getSize (sym->type); /* nothing to do with parameters so continue */ if ((sym->_isparm && !IS_REGPARM (sym->etype))) continue; if (IS_AGGREGATE (sym->type)) { SPEC_STAK (sym->etype) = sym->stack = (xsPtr + 1); xsPtr += size; continue; } /* if allocation not required then subtract size from overall stack size & continue */ if (!sym->allocreq) { currFunc->xstack -= size; SPEC_STAK (currFunc->etype) -= size; continue; } SPEC_STAK (sym->etype) = sym->stack = (xsPtr + 1); xsPtr += size; } }