Lines Matching refs:nblocks

65 			int nblocks);
72 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results);
74 int nblocks);
76 int nblocks,
79 int nblocks);
80 static int dbAllocDmapLev(struct bmap * bmp, struct dmap * dp, int nblocks,
83 static int dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb,
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);
92 int nblocks);
94 int nblocks);
102 int nblocks);
103 static int dbInitDmap(struct dmap * dp, s64 blkno, int nblocks);
107 static int dbGetL2AGSize(s64 nblocks);
349 * nblocks - number of blocks 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",
372 (unsigned long long) nblocks);
381 if (JFS_SBI(sb)->minblks_trim <= nblocks)
382 jfs_issue_discard(ipbmap, blkno, nblocks);
388 for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
441 * nblocks - number of contiguous blocks in 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",
467 (unsigned long long) nblocks);
482 for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) {
716 * nblocks - number of contiguous blocks in the range.
725 int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
737 /* assert that nblocks is valid */
738 assert(nblocks > 0);
744 l2nb = BLKSTOL2(nblocks);
762 rc = dbAllocAny(bmp, nblocks, l2nb, results);
800 if (nblocks <= BPERDMAP) {
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))
872 if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) != -ENOSPC)
888 if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) == -ENOSPC)
889 rc = dbAllocAny(bmp, nblocks, l2nb, results);
920 * nblocks - number of contiguous blocks within the current
936 s64 blkno, s64 nblocks, s64 addnblocks, s64 * results)
942 if ((rc = dbExtend(ip, blkno, nblocks, addnblocks)) == 0) {
956 (ip, blkno + nblocks - 1, addnblocks + nblocks, results));
974 * nblocks - number of contiguous blocks within the current
983 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
998 (rel_block + nblocks + addnblocks > sbi->nbperpage))
1002 lastblkno = blkno + nblocks - 1;
1073 * nblocks - number of contiguous free blocks of the range.
1083 int nblocks)
1108 if (dbitno + nblocks > BPERDMAP)
1130 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
1182 return (dbAllocDmap(bmp, dp, blkno, nblocks));
1201 * nblocks - actual number of contiguous free blocks desired.
1215 struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results)
1258 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
1310 * nblocks - actual number of contiguous free blocks desired.
1323 dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1364 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1369 (unsigned long long) nblocks);
1477 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1509 * nblocks - actual number of contiguous free blocks desired.
1521 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results)
1537 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1580 s64 nblocks, blkno;
1587 u64 nblocks;
1590 /* max blkno / nblocks pairs to trim */
1597 nblocks = bmp->db_agfree[agno];
1598 max_ranges = nblocks;
1609 while (nblocks >= minlen) {
1610 l2nb = BLKSTOL2(nblocks);
1613 rc = dbAllocAG(bmp, agno, nblocks, l2nb, &blkno);
1616 tt->nblocks = nblocks;
1624 nblocks = bmp->db_agfree[agno];
1628 l2nb = BLKSTOL2(nblocks) - 1;
1629 nblocks = 1LL << l2nb;
1642 tt->nblocks = 0; /* mark the current end */
1643 for (tt = totrim; tt->nblocks != 0; tt++) {
1647 jfs_issue_discard(ip, tt->blkno, tt->nblocks);
1648 dbFree(ip, tt->blkno, tt->nblocks);
1649 trimmed += tt->nblocks;
1788 * nblocks - actual number of contiguous free blocks to allocate.
1803 dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
1823 rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results);
1839 for (n = nblocks, b = blkno; n > 0; n -= nb, b += nb) {
1891 for (n = nblocks - n, b = blkno; n > 0;
1934 * if so, nblocks of blocks are allocated; otherwise, ENOSPC is
1941 * nblocks - actual number of contiguous block desired.
1955 struct dmap * dp, int nblocks, int l2nb, s64 * results)
1986 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
2012 * nblocks - number of blocks to be allocated.
2021 int nblocks)
2032 dbAllocBits(bmp, dp, blkno, nblocks);
2043 dbFreeBits(bmp, dp, blkno, nblocks);
2067 * nblocks - number of blocks to be freed.
2076 int nblocks)
2087 rc = dbFreeBits(bmp, dp, blkno, nblocks);
2108 dbAllocBits(bmp, dp, blkno, nblocks);
2131 * nblocks - number of bits to be allocated.
2138 int nblocks)
2155 assert(dbitno + nblocks <= BPERDMAP);
2170 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
2242 le32_add_cpu(&dp->nfree, -nblocks);
2255 bmp->db_agfree[agno] -= nblocks;
2256 bmp->db_nfree -= nblocks;
2278 * nblocks - number of bits to be freed.
2285 int nblocks)
2300 assert(dbitno + nblocks <= BPERDMAP);
2319 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
2386 le32_add_cpu(&dp->nfree, nblocks);
2394 bmp->db_nfree += nblocks;
2395 bmp->db_agfree[agno] += nblocks;
3177 * nblocks - number of blocks 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) {
3239 int nblocks)
3258 assert(dbitno + nblocks <= BPERDMAP);
3273 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
3306 le32_add_cpu(&dp->nfree, -nblocks);
3322 bmp->db_agfree[agno] -= nblocks;
3323 bmp->db_nfree -= nblocks;
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);
3534 n = min(nblocks, (s64)BPERDMAP - n);
3542 n = min_t(s64, nblocks, BPERDMAP);
3558 nblocks -= n;
3559 if (nblocks == 0)
3571 if (nblocks)
3595 if (nblocks)
3718 * nblocks - number of blocks this page
3722 static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks)
3730 dp->nblocks = dp->nfree = cpu_to_le32(nblocks);
3733 if (nblocks == BPERDMAP) {
3739 le32_add_cpu(&dp->nblocks, nblocks);
3740 le32_add_cpu(&dp->nfree, nblocks);
3751 for (r = nblocks; r > 0; r -= nb, blkno += nb) {
3790 /* does nblocks fall on a 32-bit boundary ? */
3975 * nblocks - Number of blocks in aggregate
3979 static int dbGetL2AGSize(s64 nblocks)
3985 if (nblocks < BPERDMAP * MAXAG)
3991 if (m & nblocks)
3996 if (sz < nblocks)
4029 s64 nblocks;
4034 nblocks = ipbmap->i_size >> JFS_SBI(sb)->l2bsize;
4035 npages = nblocks >> JFS_SBI(sb)->l2nbperpage;
4063 nblocks = ndmaps << L2BPERDMAP;
4065 return (nblocks);