Lines Matching refs:dp
77 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
86 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
88 static int dbAllocNear(struct bmap * bmp, struct dmap * dp, s64 blkno,
91 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
93 static int dbAllocDmapLev(struct bmap * bmp, struct dmap * dp, int nblocks,
104 static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
106 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
114 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
116 static int dbInitDmap(struct dmap * dp, s64 blkno, int nblocks);
117 static int dbInitDmapTree(struct dmap * dp);
334 struct dmap *dp; in dbFree() local
377 dp = (struct dmap *) mp->data; in dbFree()
385 if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) { in dbFree()
432 struct dmap *dp; in dbUpdatePMap() local
471 dp = (struct dmap *) mp->data; in dbUpdatePMap()
504 dp->pmap[word] &= in dbUpdatePMap()
507 dp->pmap[word] |= in dbUpdatePMap()
523 memset(&dp->pmap[word], 0, in dbUpdatePMap()
526 memset(&dp->pmap[word], (int) ONES, in dbUpdatePMap()
707 struct dmap *dp; in dbAlloc() local
786 dp = (struct dmap *) mp->data; in dbAlloc()
791 if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks)) in dbAlloc()
818 dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results)) in dbAlloc()
830 if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results)) in dbAlloc()
898 struct dmap *dp; in dbAllocExact() local
929 dp = (struct dmap *) mp->data; in dbAllocExact()
932 rc = dbAllocNext(bmp, dp, blkno, nblocks); in dbAllocExact()
1032 struct dmap *dp; in dbExtend() local
1086 dp = (struct dmap *) mp->data; in dbExtend()
1091 rc = dbAllocNext(bmp, dp, extblkno, (int) addnblocks); in dbExtend()
1125 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, in dbAllocNext() argument
1133 if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) { in dbAllocNext()
1140 leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx); in dbAllocNext()
1186 if ((mask & ~le32_to_cpu(dp->wmap[word])) != mask) in dbAllocNext()
1225 return (dbAllocDmap(bmp, dp, blkno, nblocks)); in dbAllocNext()
1258 struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results) in dbAllocNear() argument
1263 if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) { in dbAllocNear()
1268 leaf = dp->tree.stree + le32_to_cpu(dp->tree.leafidx); in dbAllocNear()
1288 blkno = le64_to_cpu(dp->start) + (word << L2DBWORD); in dbAllocNear()
1297 dbFindBits(le32_to_cpu(dp->wmap[word]), l2nb); in dbAllocNear()
1301 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0) in dbAllocNear()
1851 struct dmap *dp; in dbAllocCtl() local
1862 dp = (struct dmap *) mp->data; in dbAllocCtl()
1866 rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results); in dbAllocCtl()
1891 dp = (struct dmap *) mp->data; in dbAllocCtl()
1895 if (dp->tree.stree[ROOT] != L2BPERDMAP) { in dbAllocCtl()
1909 if ((rc = dbAllocDmap(bmp, dp, b, nb))) { in dbAllocCtl()
1948 dp = (struct dmap *) mp->data; in dbAllocCtl()
1952 if (dbFreeDmap(bmp, dp, b, BPERDMAP)) { in dbAllocCtl()
1998 struct dmap * dp, int nblocks, int l2nb, s64 * results) in dbAllocDmapLev() argument
2010 if (dbFindLeaf((dmtree_t *) & dp->tree, l2nb, &leafidx)) in dbAllocDmapLev()
2016 blkno = le64_to_cpu(dp->start) + (leafidx << L2DBWORD); in dbAllocDmapLev()
2022 if (dp->tree.stree[leafidx + LEAFIND] < BUDMIN) in dbAllocDmapLev()
2023 blkno += dbFindBits(le32_to_cpu(dp->wmap[leafidx]), l2nb); in dbAllocDmapLev()
2026 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0) in dbAllocDmapLev()
2060 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, in dbAllocDmap() argument
2069 oldroot = dp->tree.stree[ROOT]; in dbAllocDmap()
2072 dbAllocBits(bmp, dp, blkno, nblocks); in dbAllocDmap()
2075 if (dp->tree.stree[ROOT] == oldroot) in dbAllocDmap()
2082 if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 1, 0))) in dbAllocDmap()
2083 dbFreeBits(bmp, dp, blkno, nblocks); in dbAllocDmap()
2115 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, in dbFreeDmap() argument
2124 oldroot = dp->tree.stree[ROOT]; in dbFreeDmap()
2127 rc = dbFreeBits(bmp, dp, blkno, nblocks); in dbFreeDmap()
2130 if (rc || (dp->tree.stree[ROOT] == oldroot)) in dbFreeDmap()
2137 if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) { in dbFreeDmap()
2145 if (dp->tree.stree[word] == NOFREE) in dbFreeDmap()
2146 dbBackSplit((dmtree_t *) & dp->tree, word); in dbFreeDmap()
2148 dbAllocBits(bmp, dp, blkno, nblocks); in dbFreeDmap()
2177 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, in dbAllocBits() argument
2181 dmtree_t *tp = (dmtree_t *) & dp->tree; in dbAllocBits()
2186 leaf = dp->tree.stree + LEAFIND; in dbAllocBits()
2223 dp->wmap[word] |= cpu_to_le32(ONES << (DBWORD - nb) in dbAllocBits()
2232 dbMaxBud((u8 *) & dp->wmap[word])); in dbAllocBits()
2242 memset(&dp->wmap[word], (int) ONES, nwords * 4); in dbAllocBits()
2282 le32_add_cpu(&dp->nfree, -nblocks); in dbAllocBits()
2324 static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, in dbFreeBits() argument
2328 dmtree_t *tp = (dmtree_t *) & dp->tree; in dbFreeBits()
2372 dp->wmap[word] &= in dbFreeBits()
2379 dbMaxBud((u8 *) & dp->wmap[word])); in dbFreeBits()
2390 memset(&dp->wmap[word], 0, nwords * 4); in dbFreeBits()
2426 le32_add_cpu(&dp->nfree, nblocks); in dbFreeBits()
3211 struct dmap *dp; in dbAllocBottomUp() local
3239 dp = (struct dmap *) mp->data; in dbAllocBottomUp()
3247 if ((rc = dbAllocDmapBU(bmp, dp, blkno, nb))) { in dbAllocBottomUp()
3263 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno, in dbAllocDmapBU() argument
3269 struct dmaptree *tp = (struct dmaptree *) & dp->tree; in dbAllocDmapBU()
3311 dp->wmap[word] |= cpu_to_le32(ONES << (DBWORD - nb) in dbAllocDmapBU()
3322 memset(&dp->wmap[word], (int) ONES, nwords * 4); in dbAllocDmapBU()
3331 le32_add_cpu(&dp->nfree, -nblocks); in dbAllocDmapBU()
3334 dbInitDmapTree(dp); in dbAllocDmapBU()
3361 dbFreeBits(bmp, dp, blkno, nblocks); in dbAllocDmapBU()
3393 struct dmap *dp; in dbExtendFS() local
3570 dp = (struct dmap *) mp->data; in dbExtendFS()
3571 *l0leaf = dbInitDmap(dp, blkno, n); in dbExtendFS()
3574 agno = le64_to_cpu(dp->start) >> l2agsize; in dbExtendFS()
3747 static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks) in dbInitDmap() argument
3755 dp->nblocks = dp->nfree = cpu_to_le32(nblocks); in dbInitDmap()
3756 dp->start = cpu_to_le64(Blkno); in dbInitDmap()
3759 memset(&dp->wmap[0], 0, LPERDMAP * 4); in dbInitDmap()
3760 memset(&dp->pmap[0], 0, LPERDMAP * 4); in dbInitDmap()
3764 le32_add_cpu(&dp->nblocks, nblocks); in dbInitDmap()
3765 le32_add_cpu(&dp->nfree, nblocks); in dbInitDmap()
3785 dp->wmap[w] &= cpu_to_le32(~(ONES << (DBWORD - nb) in dbInitDmap()
3787 dp->pmap[w] &= cpu_to_le32(~(ONES << (DBWORD - nb) in dbInitDmap()
3795 memset(&dp->wmap[w], 0, nw * 4); in dbInitDmap()
3796 memset(&dp->pmap[w], 0, nw * 4); in dbInitDmap()
3819 dp->wmap[w] = dp->pmap[w] = cpu_to_le32(ONES >> b); in dbInitDmap()
3825 dp->pmap[i] = dp->wmap[i] = cpu_to_le32(ONES); in dbInitDmap()
3831 return (dbInitDmapTree(dp)); in dbInitDmap()
3849 static int dbInitDmapTree(struct dmap * dp) in dbInitDmapTree() argument
3856 tp = &dp->tree; in dbInitDmapTree()
3869 *cp++ = dbMaxBud((u8 *) & dp->wmap[i]); in dbInitDmapTree()