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);
318 int dbFree(struct inode *ip, s64 blkno, s64 nblocks) in dbFree() argument
331 if (unlikely((blkno == 0) || (blkno + nblocks > bmp->db_mapsize))) { in dbFree()
335 (unsigned long long) nblocks); in dbFree()
344 if (JFS_SBI(sb)->minblks_trim <= nblocks) in dbFree()
345 jfs_issue_discard(ipbmap, blkno, nblocks); in dbFree()
351 for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) { in dbFree()
412 int free, s64 blkno, s64 nblocks, struct tblock * tblk) in dbUpdatePMap() argument
426 if (blkno + nblocks > bmp->db_mapsize) { in dbUpdatePMap()
429 (unsigned long long) nblocks); in dbUpdatePMap()
444 for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) { in dbUpdatePMap()
687 int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) in dbAlloc() argument
700 assert(nblocks > 0); in dbAlloc()
706 l2nb = BLKSTOL2(nblocks); in dbAlloc()
724 rc = dbAllocAny(bmp, nblocks, l2nb, results); in dbAlloc()
762 if (nblocks <= BPERDMAP) { in dbAlloc()
778 if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks)) in dbAlloc()
805 dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results)) in dbAlloc()
817 if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results)) in dbAlloc()
834 if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) != -ENOSPC) in dbAlloc()
850 if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) == -ENOSPC) in dbAlloc()
851 rc = dbAllocAny(bmp, nblocks, l2nb, results); in dbAlloc()
880 int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) in dbAllocExact() argument
898 if (nblocks <= 0 || nblocks > BPERDMAP || blkno >= bmp->db_mapsize) { in dbAllocExact()
903 if (nblocks > ((s64) 1 << bmp->db_maxfreebud)) { in dbAllocExact()
919 rc = dbAllocNext(bmp, dp, blkno, nblocks); in dbAllocExact()
966 s64 blkno, s64 nblocks, s64 addnblocks, s64 * results) in dbReAlloc() argument
972 if ((rc = dbExtend(ip, blkno, nblocks, addnblocks)) == 0) { in dbReAlloc()
986 (ip, blkno + nblocks - 1, addnblocks + nblocks, results)); in dbReAlloc()
1013 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) in dbExtend() argument
1028 (rel_block + nblocks + addnblocks > sbi->nbperpage)) in dbExtend()
1032 lastblkno = blkno + nblocks - 1; in dbExtend()
1113 int nblocks) in dbAllocNext() argument
1138 if (dbitno + nblocks > BPERDMAP) in dbAllocNext()
1160 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) { in dbAllocNext()
1212 return (dbAllocDmap(bmp, dp, blkno, nblocks)); in dbAllocNext()
1245 struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results) in dbAllocNear() argument
1288 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0) in dbAllocNear()
1353 dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) in dbAllocAG() argument
1394 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); in dbAllocAG()
1399 (unsigned long long) nblocks); in dbAllocAG()
1507 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); in dbAllocAG()
1551 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results) in dbAllocAny() argument
1567 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); in dbAllocAny()
1610 s64 nblocks, blkno; in dbDiscardAG() local
1617 u64 nblocks; in dbDiscardAG() member
1627 nblocks = bmp->db_agfree[agno]; in dbDiscardAG()
1628 max_ranges = nblocks; in dbDiscardAG()
1639 while (nblocks >= minlen) { in dbDiscardAG()
1640 l2nb = BLKSTOL2(nblocks); in dbDiscardAG()
1643 rc = dbAllocAG(bmp, agno, nblocks, l2nb, &blkno); in dbDiscardAG()
1646 tt->nblocks = nblocks; in dbDiscardAG()
1654 nblocks = bmp->db_agfree[agno]; in dbDiscardAG()
1658 l2nb = BLKSTOL2(nblocks) - 1; in dbDiscardAG()
1659 nblocks = 1 << l2nb; in dbDiscardAG()
1672 tt->nblocks = 0; /* mark the current end */ in dbDiscardAG()
1673 for (tt = totrim; tt->nblocks != 0; tt++) { in dbDiscardAG()
1677 jfs_issue_discard(ip, tt->blkno, tt->nblocks); in dbDiscardAG()
1678 dbFree(ip, tt->blkno, tt->nblocks); in dbDiscardAG()
1679 trimmed += tt->nblocks; in dbDiscardAG()
1833 dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) in dbAllocCtl() argument
1853 rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results); in dbAllocCtl()
1869 for (n = nblocks, b = blkno; n > 0; n -= nb, b += nb) { in dbAllocCtl()
1921 for (n = nblocks - n, b = blkno; n > 0; in dbAllocCtl()
1985 struct dmap * dp, int nblocks, int l2nb, s64 * results) in dbAllocDmapLev() argument
2013 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0) in dbAllocDmapLev()
2048 int nblocks) in dbAllocDmap() argument
2059 dbAllocBits(bmp, dp, blkno, nblocks); in dbAllocDmap()
2070 dbFreeBits(bmp, dp, blkno, nblocks); in dbAllocDmap()
2103 int nblocks) in dbFreeDmap() argument
2114 rc = dbFreeBits(bmp, dp, blkno, nblocks); in dbFreeDmap()
2135 dbAllocBits(bmp, dp, blkno, nblocks); in dbFreeDmap()
2165 int nblocks) in dbAllocBits() argument
2182 assert(dbitno + nblocks <= BPERDMAP); in dbAllocBits()
2197 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) { in dbAllocBits()
2269 le32_add_cpu(&dp->nfree, -nblocks); in dbAllocBits()
2282 bmp->db_agfree[agno] -= nblocks; in dbAllocBits()
2283 bmp->db_nfree -= nblocks; in dbAllocBits()
2312 int nblocks) in dbFreeBits() argument
2327 assert(dbitno + nblocks <= BPERDMAP); in dbFreeBits()
2346 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) { in dbFreeBits()
2413 le32_add_cpu(&dp->nfree, nblocks); in dbFreeBits()
2421 bmp->db_nfree += nblocks; in dbFreeBits()
2422 bmp->db_agfree[agno] += nblocks; in dbFreeBits()
3195 int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks) in dbAllocBottomUp() argument
3207 ASSERT(nblocks <= bmp->db_mapsize - blkno); in dbAllocBottomUp()
3213 for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) { in dbAllocBottomUp()
3251 int nblocks) in dbAllocDmapBU() argument
3270 assert(dbitno + nblocks <= BPERDMAP); in dbAllocDmapBU()
3285 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) { in dbAllocDmapBU()
3318 le32_add_cpu(&dp->nfree, -nblocks); in dbAllocDmapBU()
3334 bmp->db_agfree[agno] -= nblocks; in dbAllocDmapBU()
3335 bmp->db_nfree -= nblocks; in dbAllocDmapBU()
3348 dbFreeBits(bmp, dp, blkno, nblocks); in dbAllocDmapBU()
3371 int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) in dbExtendFS() argument
3386 newsize = blkno + nblocks; in dbExtendFS()
3389 (long long) blkno, (long long) nblocks, (long long) newsize); in dbExtendFS()
3546 n = min(nblocks, (s64)BPERDMAP - n); in dbExtendFS()
3554 n = min_t(s64, nblocks, BPERDMAP); in dbExtendFS()
3570 nblocks -= n; in dbExtendFS()
3571 if (nblocks == 0) in dbExtendFS()
3583 if (nblocks) in dbExtendFS()
3607 if (nblocks) in dbExtendFS()
3734 static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks) in dbInitDmap() argument
3742 dp->nblocks = dp->nfree = cpu_to_le32(nblocks); in dbInitDmap()
3745 if (nblocks == BPERDMAP) { in dbInitDmap()
3751 le32_add_cpu(&dp->nblocks, nblocks); in dbInitDmap()
3752 le32_add_cpu(&dp->nfree, nblocks); in dbInitDmap()
3763 for (r = nblocks; r > 0; r -= nb, blkno += nb) { in dbInitDmap()
3991 static int dbGetL2AGSize(s64 nblocks) in dbGetL2AGSize() argument
3997 if (nblocks < BPERDMAP * MAXAG) in dbGetL2AGSize()
4003 if (m & nblocks) in dbGetL2AGSize()
4008 if (sz < nblocks) in dbGetL2AGSize()
4042 s64 nblocks; in dbMapFileSizeToMapSize() local
4047 nblocks = ipbmap->i_size >> JFS_SBI(sb)->l2bsize; in dbMapFileSizeToMapSize()
4048 npages = nblocks >> JFS_SBI(sb)->l2nbperpage; in dbMapFileSizeToMapSize()
4076 nblocks = ndmaps << L2BPERDMAP; in dbMapFileSizeToMapSize()
4078 return (nblocks); in dbMapFileSizeToMapSize()