Lines Matching defs:blkno

64 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
70 static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc,
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,
85 static int dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno,
87 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks);
89 static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno);
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);
348 * blkno - starting block number to be freed.
355 int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
368 if (unlikely((blkno == 0) || (blkno + nblocks > bmp->db_mapsize))) {
370 printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
371 (unsigned long long) blkno,
382 jfs_issue_discard(ipbmap, blkno, nblocks);
388 for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
395 lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
406 nb = min(rem, BPERDMAP - (blkno & (BPERDMAP - 1)));
409 if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
440 * blkno - starting block number of the range.
450 int free, s64 blkno, s64 nblocks, struct tblock * tblk)
464 if (blkno + nblocks > bmp->db_mapsize) {
465 printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
466 (unsigned long long) blkno,
482 for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) {
484 lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
502 dbitno = blkno & (BPERDMAP - 1);
731 s64 lblkno, blkno;
777 blkno = hint + 1;
779 if (blkno >= bmp->db_mapsize)
782 agno = blkno >> bmp->db_agl2size;
784 /* check if blkno crosses over into a new allocation group.
788 if ((blkno & (bmp->db_agsize - 1)) == 0)
806 lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
816 if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks))
819 *results = blkno;
843 dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results))
919 * blkno - starting block of the current allocation.
936 s64 blkno, s64 nblocks, s64 addnblocks, s64 * results)
942 if ((rc = dbExtend(ip, blkno, nblocks, addnblocks)) == 0) {
943 *results = blkno;
956 (ip, blkno + nblocks - 1, addnblocks + nblocks, results));
973 * blkno - starting block of the current allocation.
983 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
997 if (((rel_block = blkno & (sbi->nbperpage - 1))) &&
1002 lastblkno = blkno + nblocks - 1;
1072 * blkno - starting block number of the range.
1082 static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
1102 dbitno = blkno & (BPERDMAP - 1);
1182 return (dbAllocDmap(bmp, dp, blkno, nblocks));
1200 * blkno - block number to allocate near.
1215 struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results)
1228 * (i.e. blkno). also, determine the last word in the dmap
1231 word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
1245 blkno = le64_to_cpu(dp->start) + (word << L2DBWORD);
1253 blkno +=
1258 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
1259 *results = blkno;
1328 s64 blkno, lblkno;
1343 blkno = (s64) agno << bmp->db_agl2size;
1364 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1367 printk(KERN_ERR "blkno = %Lx, blocks = %Lx\n",
1368 (unsigned long long) blkno,
1379 lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, bmp->db_aglevel);
1438 blkno = 0;
1440 blkno &= ~(MAXL1SIZE - 1);
1442 blkno &= ~(MAXL0SIZE - 1);
1444 blkno +=
1465 &blkno))) {
1477 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1524 s64 blkno = 0;
1532 if ((rc = dbFindCtl(bmp, l2nb, bmp->db_maxlevel, &blkno)))
1537 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1580 s64 nblocks, blkno;
1586 u64 blkno;
1590 /* max blkno / nblocks pairs to trim */
1613 rc = dbAllocAG(bmp, agno, nblocks, l2nb, &blkno);
1615 tt->blkno = blkno;
1647 jfs_issue_discard(ip, tt->blkno, tt->nblocks);
1648 dbFree(ip, tt->blkno, tt->nblocks);
1673 * *blkno - on entry, starting block number for conducting the search.
1684 static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
1697 for (lev = level, b = *blkno; lev >= 0; lev--) {
1752 *blkno = b;
1784 * first dmap (i.e. blkno).
1790 * blkno - starting block number of the dmap to start the allocation
1803 dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
1815 lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
1835 assert((blkno & (BPERDMAP - 1)) == 0);
1839 for (n = nblocks, b = blkno; n > 0; n -= nb, b += nb) {
1878 *results = blkno;
1891 for (n = nblocks - n, b = blkno; n > 0;
1957 s64 blkno;
1976 blkno = le64_to_cpu(dp->start) + (leafidx << L2DBWORD);
1983 blkno += dbFindBits(le32_to_cpu(dp->wmap[leafidx]), l2nb);
1986 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
1987 *results = blkno;
2011 * blkno - starting block number of the block to be allocated.
2020 static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2032 dbAllocBits(bmp, dp, blkno, nblocks);
2042 if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 1, 0)))
2043 dbFreeBits(bmp, dp, blkno, nblocks);
2066 * blkno - starting block number of the block to be freed.
2075 static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno,
2087 rc = dbFreeBits(bmp, dp, blkno, nblocks);
2097 if ((rc = dbAdjCtl(bmp, blkno, dp->tree.stree[ROOT], 0, 0))) {
2098 word = (blkno & (BPERDMAP - 1)) >> L2DBWORD;
2108 dbAllocBits(bmp, dp, blkno, nblocks);
2130 * blkno - starting block number of the bits to be allocated.
2137 static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2151 dbitno = blkno & (BPERDMAP - 1);
2250 agno = blkno >> bmp->db_agl2size;
2277 * blkno - starting block number of the bits to be freed.
2284 static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2295 dbitno = blkno & (BPERDMAP - 1);
2393 agno = blkno >> bmp->db_agl2size;
2452 * blkno - the first block of a block range within a dmap. it is
2468 dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
2480 lblkno = BLKTOCTL(blkno, bmp->db_l2nbperpage, level);
2495 leafno = BLKTOCTLLEAF(blkno, dcp->budmin);
2556 dbAdjCtl(bmp, blkno, dcp->stree[ROOT], alloc,
3176 * blkno - starting block number to be freed.
3183 int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks)
3195 ASSERT(nblocks <= bmp->db_mapsize - blkno);
3201 for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
3208 lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
3219 nb = min(rem, BPERDMAP - (blkno & (BPERDMAP - 1)));
3222 if ((rc = dbAllocDmapBU(bmp, dp, blkno, nb))) {
3238 static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno,
3254 dbitno = blkno & (BPERDMAP - 1);
3317 agno = blkno >> bmp->db_agl2size;
3335 if ((rc = dbAdjCtl(bmp, blkno, tp->stree[ROOT], 1, 0)))
3336 dbFreeBits(bmp, dp, blkno, nblocks);
3345 * FUNCTION: extend bmap from blkno for nblocks;
3359 int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks)
3374 newsize = blkno + nblocks;
3376 jfs_info("dbExtendFS: blkno:%Ld nblocks:%Ld newsize:%Ld",
3377 (long long) blkno, (long long) nblocks, (long long) newsize);
3451 k = blkno >> L2MAXL1SIZE;
3453 p = BLKTOL1(blkno, sbi->l2nbperpage); /* L1 page */
3461 /* read in L1 page: (blkno & (MAXL1SIZE - 1)) */
3468 j = (blkno & (MAXL1SIZE - 1)) >> L2MAXL0SIZE;
3470 p = BLKTOL0(blkno, sbi->l2nbperpage);
3492 /* read in L0 page: (blkno & (MAXL0SIZE - 1)) */
3500 i = (blkno & (MAXL0SIZE - 1)) >>
3503 p = BLKTODMAP(blkno,
3528 if ((n = blkno & (BPERDMAP - 1))) {
3546 *l0leaf = dbInitDmap(dp, blkno, n);
3557 blkno += n;
3724 int blkno, w, b, r, nw, nb, i;
3727 blkno = Blkno & (BPERDMAP - 1);
3729 if (blkno == 0) {
3744 w = blkno >> L2DBWORD;
3751 for (r = nblocks; r > 0; r -= nb, blkno += nb) {
3753 b = blkno & (DBWORD - 1);
3784 if (blkno == BPERDMAP)
3788 w = blkno >> L2DBWORD;
3791 b = blkno & (DBWORD - 1);
3819 * blkno - starting block number for this dmap