Lines Matching refs:tp

66 static void dbSplit(dmtree_t *tp, int leafno, int splitsz, int newval, bool is_ctl);
67 static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl);
68 static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl);
69 static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl);
90 static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl);
2141 dmtree_t *tp = (dmtree_t *) & dp->tree;
2191 dbSplit(tp, word, BUDMIN,
2232 dbSplit(tp, word, size, NOFREE, false);
2288 dmtree_t *tp = (dmtree_t *) & dp->tree;
2338 rc = dbJoin(tp, word,
2372 rc = dbJoin(tp, word, size, false);
2614 * tp - pointer to the tree containing the leaf.
2624 static void dbSplit(dmtree_t *tp, int leafno, int splitsz, int newval, bool is_ctl)
2628 s8 *leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
2632 if (leaf[leafno] > tp->dmt_budmin) {
2639 budsz = BUDSIZE(cursz, tp->dmt_budmin);
2646 dbAdjTree(tp, leafno ^ budsz, cursz, is_ctl);
2658 dbAdjTree(tp, leafno, newval, is_ctl);
2682 * tp - pointer to the tree containing the leaf.
2689 static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl)
2693 s8 *leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
2708 LITOL2BSZ(leafno, le32_to_cpu(tp->dmt_l2nleafs),
2709 tp->dmt_budmin);
2715 budsz = BUDSIZE(size, tp->dmt_budmin);
2724 if (bsz >= le32_to_cpu(tp->dmt_nleafs)) {
2740 dbSplit(tp, bud, cursz, cursz, is_ctl);
2762 * tp - pointer to the tree containing the leaf.
2768 static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
2775 if (newval >= tp->dmt_budmin) {
2778 leaf = tp->dmt_stree + le32_to_cpu(tp->dmt_leafidx);
2793 budsz = BUDSIZE(newval, tp->dmt_budmin);
2797 while (budsz < le32_to_cpu(tp->dmt_nleafs)) {
2823 dbAdjTree(tp, buddy, NOFREE, is_ctl);
2828 dbAdjTree(tp, leafno, NOFREE, is_ctl);
2841 dbAdjTree(tp, leafno, newval, is_ctl);
2856 * tp - pointer to the tree to be adjusted.
2862 static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)
2871 lp = leafno + le32_to_cpu(tp->dmt_leafidx);
2879 if (tp->dmt_stree[lp] == newval)
2884 tp->dmt_stree[lp] = newval;
2888 for (k = 0; k < le32_to_cpu(tp->dmt_height); k++) {
2900 max = TREEMAX(&tp->dmt_stree[lp]);
2905 if (tp->dmt_stree[pp] == max)
2910 tp->dmt_stree[pp] = max;
2931 * tp - pointer to the tree to be searched.
2942 static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx, bool is_ctl)
2952 if (l2nb > tp->dmt_stree[ROOT])
2959 for (k = le32_to_cpu(tp->dmt_height), ti = 1;
2970 if (l2nb <= tp->dmt_stree[x + n])
2983 *leafidx = x + n - le32_to_cpu(tp->dmt_leafidx);
3244 struct dmaptree *tp = (struct dmaptree *) & dp->tree;
3249 oldroot = tp->stree[ROOT];
3328 if (tp->stree[ROOT] == oldroot)
3335 if ((rc = dbAdjCtl(bmp, blkno, tp->stree[ROOT], 1, 0)))
3826 struct dmaptree *tp;
3831 tp = &dp->tree;
3832 tp->nleafs = cpu_to_le32(LPERDMAP);
3833 tp->l2nleafs = cpu_to_le32(L2LPERDMAP);
3834 tp->leafidx = cpu_to_le32(LEAFIND);
3835 tp->height = cpu_to_le32(4);
3836 tp->budmin = BUDMIN;
3842 cp = tp->stree + le32_to_cpu(tp->leafidx);
3847 return (dbInitTree(tp));
3874 s8 *tp, *cp, *cp1;
3876 tp = dtp->stree;
3901 for (i = 0, cp = tp + le32_to_cpu(dtp->leafidx);
3931 for (i = 0, cp = tp + child, cp1 = tp + parent;
3936 return (*tp);