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);
911 * nblocks - extent length;
918 int dbAllocExact(struct inode *ip, s64 blkno, int nblocks)
936 if (nblocks <= 0 || nblocks > BPERDMAP || blkno >= bmp->db_mapsize) {
941 if (nblocks > ((s64) 1 << bmp->db_maxfreebud)) {
957 rc = dbAllocNext(bmp, dp, blkno, nblocks);
988 * nblocks - number of contiguous blocks within the current
1004 s64 blkno, s64 nblocks, s64 addnblocks, s64 * results)
1010 if ((rc = dbExtend(ip, blkno, nblocks, addnblocks)) == 0) {
1024 (ip, blkno + nblocks - 1, addnblocks + nblocks, results));
1042 * nblocks - number of contiguous blocks within the current
1051 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
1066 (rel_block + nblocks + addnblocks > sbi->nbperpage))
1070 lastblkno = blkno + nblocks - 1;
1141 * nblocks - number of contiguous free blocks of the range.
1151 int nblocks)
1176 if (dbitno + nblocks > BPERDMAP)
1198 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
1250 return (dbAllocDmap(bmp, dp, blkno, nblocks));
1269 * nblocks - actual number of contiguous free blocks desired.
1283 struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results)
1326 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
1378 * nblocks - actual number of contiguous free blocks desired.
1391 dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1432 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1437 (unsigned long long) nblocks);
1545 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1577 * nblocks - actual number of contiguous free blocks desired.
1589 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results)
1605 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1648 s64 nblocks, blkno;
1655 u64 nblocks;
1658 /* max blkno / nblocks pairs to trim */
1665 nblocks = bmp->db_agfree[agno];
1666 max_ranges = nblocks;
1677 while (nblocks >= minlen) {
1678 l2nb = BLKSTOL2(nblocks);
1681 rc = dbAllocAG(bmp, agno, nblocks, l2nb, &blkno);
1684 tt->nblocks = nblocks;
1692 nblocks = bmp->db_agfree[agno];
1696 l2nb = BLKSTOL2(nblocks) - 1;
1697 nblocks = 1LL << l2nb;
1710 tt->nblocks = 0; /* mark the current end */
1711 for (tt = totrim; tt->nblocks != 0; tt++) {
1715 jfs_issue_discard(ip, tt->blkno, tt->nblocks);
1716 dbFree(ip, tt->blkno, tt->nblocks);
1717 trimmed += tt->nblocks;
1856 * nblocks - actual number of contiguous free blocks to allocate.
1871 dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
1891 rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results);
1907 for (n = nblocks, b = blkno; n > 0; n -= nb, b += nb) {
1959 for (n = nblocks - n, b = blkno; n > 0;
2002 * if so, nblocks of blocks are allocated; otherwise, ENOSPC is
2009 * nblocks - actual number of contiguous block desired.
2023 struct dmap * dp, int nblocks, int l2nb, s64 * results)
2054 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0)
2080 * nblocks - number of blocks to be allocated.
2089 int nblocks)
2100 dbAllocBits(bmp, dp, blkno, nblocks);
2111 dbFreeBits(bmp, dp, blkno, nblocks);
2135 * nblocks - number of blocks to be freed.
2144 int nblocks)
2155 rc = dbFreeBits(bmp, dp, blkno, nblocks);
2176 dbAllocBits(bmp, dp, blkno, nblocks);
2199 * nblocks - number of bits to be allocated.
2206 int nblocks)
2223 assert(dbitno + nblocks <= BPERDMAP);
2238 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
2310 le32_add_cpu(&dp->nfree, -nblocks);
2323 bmp->db_agfree[agno] -= nblocks;
2324 bmp->db_nfree -= nblocks;
2346 * nblocks - number of bits to be freed.
2353 int nblocks)
2368 assert(dbitno + nblocks <= BPERDMAP);
2387 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
2454 le32_add_cpu(&dp->nfree, nblocks);
2462 bmp->db_nfree += nblocks;
2463 bmp->db_agfree[agno] += nblocks;
3241 * nblocks - number of blocks to be freed.
3247 int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks)
3259 ASSERT(nblocks <= bmp->db_mapsize - blkno);
3265 for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) {
3303 int nblocks)
3322 assert(dbitno + nblocks <= BPERDMAP);
3337 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) {
3370 le32_add_cpu(&dp->nfree, -nblocks);
3386 bmp->db_agfree[agno] -= nblocks;
3387 bmp->db_nfree -= nblocks;
3400 dbFreeBits(bmp, dp, blkno, nblocks);
3409 * FUNCTION: extend bmap from blkno for nblocks;
3423 int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks)
3438 newsize = blkno + nblocks;
3440 jfs_info("dbExtendFS: blkno:%Ld nblocks:%Ld newsize:%Ld",
3441 (long long) blkno, (long long) nblocks, (long long) newsize);
3598 n = min(nblocks, (s64)BPERDMAP - n);
3606 n = min_t(s64, nblocks, BPERDMAP);
3622 nblocks -= n;
3623 if (nblocks == 0)
3635 if (nblocks)
3659 if (nblocks)
3782 * nblocks - number of blocks this page
3786 static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks)
3794 dp->nblocks = dp->nfree = cpu_to_le32(nblocks);
3797 if (nblocks == BPERDMAP) {
3803 le32_add_cpu(&dp->nblocks, nblocks);
3804 le32_add_cpu(&dp->nfree, nblocks);
3815 for (r = nblocks; r > 0; r -= nb, blkno += nb) {
3854 /* does nblocks fall on a 32-bit boundary ? */
4039 * nblocks - Number of blocks in aggregate
4043 static int dbGetL2AGSize(s64 nblocks)
4049 if (nblocks < BPERDMAP * MAXAG)
4055 if (m & nblocks)
4060 if (sz < nblocks)
4093 s64 nblocks;
4098 nblocks = ipbmap->i_size >> JFS_SBI(sb)->l2bsize;
4099 npages = nblocks >> JFS_SBI(sb)->l2nbperpage;
4127 nblocks = ndmaps << L2BPERDMAP;
4129 return (nblocks);