Lines Matching refs:tp
79 static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval);
80 static int dbBackSplit(dmtree_t * tp, int leafno);
81 static int dbJoin(dmtree_t * tp, int leafno, int newval);
82 static void dbAdjTree(dmtree_t * tp, int leafno, int newval);
103 static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx);
2181 dmtree_t *tp = (dmtree_t *) & dp->tree; in dbAllocBits() local
2231 dbSplit(tp, word, BUDMIN, in dbAllocBits()
2272 dbSplit(tp, word, size, NOFREE); in dbAllocBits()
2328 dmtree_t *tp = (dmtree_t *) & dp->tree; in dbFreeBits() local
2378 rc = dbJoin(tp, word, in dbFreeBits()
2412 rc = dbJoin(tp, word, size); in dbFreeBits()
2660 static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) in dbSplit() argument
2664 s8 *leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx); in dbSplit()
2668 if (leaf[leafno] > tp->dmt_budmin) { in dbSplit()
2675 budsz = BUDSIZE(cursz, tp->dmt_budmin); in dbSplit()
2682 dbAdjTree(tp, leafno ^ budsz, cursz); in dbSplit()
2694 dbAdjTree(tp, leafno, newval); in dbSplit()
2725 static int dbBackSplit(dmtree_t * tp, int leafno) in dbBackSplit() argument
2729 s8 *leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx); in dbBackSplit()
2744 LITOL2BSZ(leafno, le32_to_cpu(tp->dmt_l2nleafs), in dbBackSplit()
2745 tp->dmt_budmin); in dbBackSplit()
2751 budsz = BUDSIZE(size, tp->dmt_budmin); in dbBackSplit()
2760 if (bsz >= le32_to_cpu(tp->dmt_nleafs)) { in dbBackSplit()
2776 dbSplit(tp, bud, cursz, cursz); in dbBackSplit()
2804 static int dbJoin(dmtree_t * tp, int leafno, int newval) in dbJoin() argument
2811 if (newval >= tp->dmt_budmin) { in dbJoin()
2814 leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx); in dbJoin()
2829 budsz = BUDSIZE(newval, tp->dmt_budmin); in dbJoin()
2833 while (budsz < le32_to_cpu(tp->dmt_nleafs)) { in dbJoin()
2859 dbAdjTree(tp, buddy, NOFREE); in dbJoin()
2864 dbAdjTree(tp, leafno, NOFREE); in dbJoin()
2877 dbAdjTree(tp, leafno, newval); in dbJoin()
2898 static void dbAdjTree(dmtree_t * tp, int leafno, int newval) in dbAdjTree() argument
2905 lp = leafno + le32_to_cpu(tp->dmt_leafidx); in dbAdjTree()
2910 if (tp->dmt_stree[lp] == newval) in dbAdjTree()
2915 tp->dmt_stree[lp] = newval; in dbAdjTree()
2919 for (k = 0; k < le32_to_cpu(tp->dmt_height); k++) { in dbAdjTree()
2931 max = TREEMAX(&tp->dmt_stree[lp]); in dbAdjTree()
2936 if (tp->dmt_stree[pp] == max) in dbAdjTree()
2941 tp->dmt_stree[pp] = max; in dbAdjTree()
2972 static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx) in dbFindLeaf() argument
2979 if (l2nb > tp->dmt_stree[ROOT]) in dbFindLeaf()
2986 for (k = le32_to_cpu(tp->dmt_height), ti = 1; in dbFindLeaf()
2995 if (l2nb <= tp->dmt_stree[x + n]) in dbFindLeaf()
3008 *leafidx = x + n - le32_to_cpu(tp->dmt_leafidx); in dbFindLeaf()
3269 struct dmaptree *tp = (struct dmaptree *) & dp->tree; in dbAllocDmapBU() local
3274 oldroot = tp->stree[ROOT]; in dbAllocDmapBU()
3353 if (tp->stree[ROOT] == oldroot) in dbAllocDmapBU()
3360 if ((rc = dbAdjCtl(bmp, blkno, tp->stree[ROOT], 1, 0))) in dbAllocDmapBU()
3851 struct dmaptree *tp; in dbInitDmapTree() local
3856 tp = &dp->tree; in dbInitDmapTree()
3857 tp->nleafs = cpu_to_le32(LPERDMAP); in dbInitDmapTree()
3858 tp->l2nleafs = cpu_to_le32(L2LPERDMAP); in dbInitDmapTree()
3859 tp->leafidx = cpu_to_le32(LEAFIND); in dbInitDmapTree()
3860 tp->height = cpu_to_le32(4); in dbInitDmapTree()
3861 tp->budmin = BUDMIN; in dbInitDmapTree()
3867 cp = tp->stree + le32_to_cpu(tp->leafidx); in dbInitDmapTree()
3872 return (dbInitTree(tp)); in dbInitDmapTree()
3899 s8 *tp, *cp, *cp1; in dbInitTree() local
3901 tp = dtp->stree; in dbInitTree()
3926 for (i = 0, cp = tp + le32_to_cpu(dtp->leafidx); in dbInitTree()
3956 for (i = 0, cp = tp + child, cp1 = tp + parent; in dbInitTree()
3961 return (*tp); in dbInitTree()