Lines Matching refs:dp

64 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
73 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
75 static int dbAllocNear(struct bmap * bmp, struct dmap * dp, s64 blkno,
78 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
80 static int dbAllocDmapLev(struct bmap * bmp, struct dmap * dp, int nblocks,
91 static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
93 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
101 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
103 static int dbInitDmap(struct dmap * dp, s64 blkno, int nblocks);
104 static int dbInitDmapTree(struct dmap * dp);
358 struct dmap *dp;
401 dp = (struct dmap *) mp->data;
409 if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
457 struct dmap *dp;
496 dp = (struct dmap *) mp->data;
529 dp->pmap[word] &=
532 dp->pmap[word] |=
548 memset(&dp->pmap[word], 0,
551 memset(&dp->pmap[word], (int) ONES,
732 struct dmap *dp;
811 dp = (struct dmap *) mp->data;
816 if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks))
843 dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results))
855 if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results))
989 struct dmap *dp;
1043 dp = (struct dmap *) mp->data;
1048 rc = dbAllocNext(bmp, dp, extblkno, (int) addnblocks);
1071 * dp - pointer to dmap.
1082 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
1090 if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1097 leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1143 if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask)
1182 return (dbAllocDmap(bmp, dp, blkno, nblocks));
1199 * dp - pointer to dmap.
1215 struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results)
1220 if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1225 leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx);
1245 blkno = le64_to_cpu(dp->start) + (word << L2DBWORD);
1254 dbFindBits(le32_to_cpu(dp->wmap[word]), l2nb);
1258 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
1808 struct dmap *dp;
1819 dp = (struct dmap *) mp->data;
1823 rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results);
1848 dp = (struct dmap *) mp->data;
1852 if (dp->tree.stree[ROOT] != L2BPERDMAP) {
1866 if ((rc = dbAllocDmap(bmp, dp, b, nb))) {
1905 dp = (struct dmap *) mp->data;
1909 if (dbFreeDmap(bmp, dp, b, BPERDMAP)) {
1939 * dp - pointer to dmap to attempt to allocate blocks from.
1955 struct dmap * dp, int nblocks, int l2nb, s64 * results)
1967 if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
1976 blkno = le64_to_cpu(dp->start) + (leafidx << L2DBWORD);
1982 if (dp->tree.stree[leafidx + LEAFIND] < BUDMIN)
1983 blkno += dbFindBits(le32_to_cpu(dp->wmap[leafidx]), l2nb);
1986 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
2010 * dp - pointer to dmap to allocate the block range from.
2020 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2029 oldroot = dp->tree.stree[ROOT];
2032 dbAllocBits(bmp, dp, blkno, nblocks);
2035 if (dp->tree.stree[ROOT] == oldroot)
2042 if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 1, 0)))
2043 dbFreeBits(bmp, dp, blkno, nblocks);
2065 * dp - pointer to dmap to free the block range from.
2075 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2084 oldroot = dp->tree.stree[ROOT];
2087 rc = dbFreeBits(bmp, dp, blkno, nblocks);
2090 if (rc || (dp->tree.stree[ROOT] == oldroot))
2097 if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) {
2105 if (dp->tree.stree[word] == NOFREE)
2106 dbBackSplit((dmtree_t *)&dp->tree, word, false);
2108 dbAllocBits(bmp, dp, blkno, nblocks);
2129 * dp - pointer to dmap to allocate bits from.
2137 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2141 dmtree_t *tp = (dmtree_t *) & dp->tree;
2146 leaf = dp->tree.stree + LEAFIND;
2183 dp->wmap[word] |= cpu_to_le32(ONES << (DBWORD - nb)
2192 dbMaxBud((u8 *)&dp->wmap[word]), false);
2202 memset(&dp->wmap[word], (int) ONES, nwords * 4);
2242 le32_add_cpu(&dp->nfree, -nblocks);
2276 * dp - pointer to dmap to free bits from.
2284 static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2288 dmtree_t *tp = (dmtree_t *) & dp->tree;
2332 dp->wmap[word] &=
2339 dbMaxBud((u8 *)&dp->wmap[word]), false);
2350 memset(&dp->wmap[word], 0, nwords * 4);
2386 le32_add_cpu(&dp->nfree, nblocks);
3186 struct dmap *dp;
3214 dp = (struct dmap *) mp->data;
3222 if ((rc = dbAllocDmapBU(bmp, dp, blkno, nb))) {
3238 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
3244 struct dmaptree *tp = (struct dmaptree *) & dp->tree;
3286 dp->wmap[word] |= cpu_to_le32(ONES << (DBWORD - nb)
3297 memset(&dp->wmap[word], (int) ONES, nwords * 4);
3306 le32_add_cpu(&dp->nfree, -nblocks);
3309 dbInitDmapTree(dp);
3336 dbFreeBits(bmp, dp, blkno, nblocks);
3368 struct dmap *dp;
3545 dp = (struct dmap *) mp->data;
3546 *l0leaf = dbInitDmap(dp, blkno, n);
3549 agno = le64_to_cpu(dp->start) >> l2agsize;
3717 * dp - pointer to page of map
3722 static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks)
3730 dp->nblocks = dp->nfree = cpu_to_le32(nblocks);
3731 dp->start = cpu_to_le64(Blkno);
3734 memset(&dp->wmap[0], 0, LPERDMAP * 4);
3735 memset(&dp->pmap[0], 0, LPERDMAP * 4);
3739 le32_add_cpu(&dp->nblocks, nblocks);
3740 le32_add_cpu(&dp->nfree, nblocks);
3760 dp->wmap[w] &= cpu_to_le32(~(ONES << (DBWORD - nb)
3762 dp->pmap[w] &= cpu_to_le32(~(ONES << (DBWORD - nb)
3770 memset(&dp->wmap[w], 0, nw * 4);
3771 memset(&dp->pmap[w], 0, nw * 4);
3794 dp->wmap[w] = dp->pmap[w] = cpu_to_le32(ONES >> b);
3800 dp->pmap[i] = dp->wmap[i] = cpu_to_le32(ONES);
3806 return (dbInitDmapTree(dp));
3818 * dp - dmap to complete
3824 static int dbInitDmapTree(struct dmap * dp)
3831 tp = &dp->tree;
3844 *cp++ = dbMaxBud((u8 *) & dp->wmap[i]);