Lines Matching refs:nblocks

37 #define DBALLOC(dbmap,mapsize,blkno,nblocks) \  argument
38 DBAlloc(dbmap,mapsize,blkno,nblocks)
39 #define DBFREE(dbmap,mapsize,blkno,nblocks) \ argument
40 DBFree(dbmap,mapsize,blkno,nblocks)
41 #define DBALLOCCK(dbmap,mapsize,blkno,nblocks) \ argument
42 DBAllocCK(dbmap,mapsize,blkno,nblocks)
43 #define DBFREECK(dbmap,mapsize,blkno,nblocks) \ argument
44 DBFreeCK(dbmap,mapsize,blkno,nblocks)
53 #define DBALLOC(dbmap, mapsize, blkno, nblocks) argument
54 #define DBFREE(dbmap, mapsize, blkno, nblocks) argument
55 #define DBALLOCCK(dbmap, mapsize, blkno, nblocks) argument
56 #define DBFREECK(dbmap, mapsize, blkno, nblocks) argument
106 int nblocks);
113 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results);
115 int nblocks);
117 int nblocks,
120 int nblocks);
121 static int dbAllocDmapLev(struct bmap * bmp, struct dmap * dp, int nblocks,
124 static int dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb,
126 static int dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno,
128 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks);
133 int nblocks);
135 int nblocks);
144 int nblocks);
145 static int dbInitDmap(struct dmap * dp, s64 blkno, int nblocks);
149 static int dbGetL2AGSize(s64 nblocks);
373 int dbFree(struct inode *ip, s64 blkno, s64 nblocks) in dbFree() argument
385 if (unlikely((blkno == 0) || (blkno + nblocks > bmp->db_mapsize))) { in dbFree()
389 (unsigned long long) nblocks); in dbFree()
399 for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) { in dbFree()
463 int free, s64 blkno, s64 nblocks, struct tblock * tblk) in dbUpdatePMap() argument
476 if (blkno + nblocks > bmp->db_mapsize) { in dbUpdatePMap()
479 (unsigned long long) nblocks); in dbUpdatePMap()
495 for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) { in dbUpdatePMap()
743 int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) in dbAlloc() argument
756 assert(nblocks > 0); in dbAlloc()
760 if (OVER_LIMIT(ip, nblocks)) in dbAlloc()
768 l2nb = BLKSTOL2(nblocks); in dbAlloc()
787 rc = dbAllocAny(bmp, nblocks, l2nb, results); in dbAlloc()
790 nblocks); in dbAlloc()
829 if (nblocks <= BPERDMAP) { in dbAlloc()
845 if ((rc = dbAllocNext(bmp, dp, blkno, (int) nblocks)) in dbAlloc()
850 *results, nblocks); in dbAlloc()
874 dbAllocNear(bmp, dp, blkno, (int) nblocks, l2nb, results)) in dbAlloc()
878 *results, nblocks); in dbAlloc()
889 if ((rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results)) in dbAlloc()
893 *results, nblocks); in dbAlloc()
909 if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) in dbAlloc()
913 *results, nblocks); in dbAlloc()
929 if ((rc = dbAllocAG(bmp, agno, nblocks, l2nb, results)) == -ENOSPC) in dbAlloc()
930 rc = dbAllocAny(bmp, nblocks, l2nb, results); in dbAlloc()
932 DBALLOC(bmp->db_DBmap, bmp->db_mapsize, *results, nblocks); in dbAlloc()
962 int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) in dbAllocExact() argument
980 if (nblocks <= 0 || nblocks > BPERDMAP || blkno >= bmp->db_mapsize) { in dbAllocExact()
985 if (nblocks > ((s64) 1 << bmp->db_maxfreebud)) { in dbAllocExact()
1001 rc = dbAllocNext(bmp, dp, blkno, nblocks); in dbAllocExact()
1006 DBALLOC(bmp->db_DBmap, bmp->db_mapsize, blkno, nblocks); in dbAllocExact()
1049 s64 blkno, s64 nblocks, s64 addnblocks, s64 * results) in dbReAlloc() argument
1055 if ((rc = dbExtend(ip, blkno, nblocks, addnblocks)) == 0) { in dbReAlloc()
1069 (ip, blkno + nblocks - 1, addnblocks + nblocks, results)); in dbReAlloc()
1096 static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) in dbExtend() argument
1111 (rel_block + nblocks + addnblocks > sbi->nbperpage)) in dbExtend()
1115 lastblkno = blkno + nblocks - 1; in dbExtend()
1157 DBALLOCCK(bmp->db_DBmap, bmp->db_mapsize, blkno, nblocks); in dbExtend()
1201 int nblocks) in dbAllocNext() argument
1227 if (dbitno + nblocks > BPERDMAP) in dbAllocNext()
1249 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) { in dbAllocNext()
1301 return (dbAllocDmap(bmp, dp, blkno, nblocks)); in dbAllocNext()
1334 struct dmap * dp, s64 blkno, int nblocks, int l2nb, s64 * results) in dbAllocNear() argument
1378 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0) in dbAllocNear()
1443 dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) in dbAllocAG() argument
1485 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); in dbAllocAG()
1490 (unsigned long long) nblocks); in dbAllocAG()
1600 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); in dbAllocAG()
1644 static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results) in dbAllocAny() argument
1660 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); in dbAllocAny()
1817 dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) in dbAllocCtl() argument
1837 rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results); in dbAllocCtl()
1853 for (n = nblocks, b = blkno; n > 0; n -= nb, b += nb) { in dbAllocCtl()
1905 for (n = nblocks - n, b = blkno; n > 0; in dbAllocCtl()
1970 struct dmap * dp, int nblocks, int l2nb, s64 * results) in dbAllocDmapLev() argument
1998 if ((rc = dbAllocDmap(bmp, dp, blkno, nblocks)) == 0) in dbAllocDmapLev()
2033 int nblocks) in dbAllocDmap() argument
2044 dbAllocBits(bmp, dp, blkno, nblocks); in dbAllocDmap()
2055 dbFreeBits(bmp, dp, blkno, nblocks); in dbAllocDmap()
2088 int nblocks) in dbFreeDmap() argument
2099 dbFreeBits(bmp, dp, blkno, nblocks); in dbFreeDmap()
2120 dbAllocBits(bmp, dp, blkno, nblocks); in dbFreeDmap()
2150 int nblocks) in dbAllocBits() argument
2167 assert(dbitno + nblocks <= BPERDMAP); in dbAllocBits()
2182 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) { in dbAllocBits()
2254 dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) - nblocks); in dbAllocBits()
2267 bmp->db_agfree[agno] -= nblocks; in dbAllocBits()
2268 bmp->db_nfree -= nblocks; in dbAllocBits()
2297 int nblocks) in dbFreeBits() argument
2311 assert(dbitno + nblocks <= BPERDMAP); in dbFreeBits()
2330 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) { in dbFreeBits()
2393 dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) + nblocks); in dbFreeBits()
2401 bmp->db_nfree += nblocks; in dbFreeBits()
2402 bmp->db_agfree[agno] += nblocks; in dbFreeBits()
3160 int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks) in dbAllocBottomUp() argument
3172 ASSERT(nblocks <= bmp->db_mapsize - blkno); in dbAllocBottomUp()
3178 for (rem = nblocks; rem > 0; rem -= nb, blkno += nb) { in dbAllocBottomUp()
3220 int nblocks) in dbAllocDmapBU() argument
3242 assert(dbitno + nblocks <= BPERDMAP); in dbAllocDmapBU()
3257 for (rembits = nblocks; rembits > 0; rembits -= nb, dbitno += nb) { in dbAllocDmapBU()
3290 dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) - nblocks); in dbAllocDmapBU()
3306 bmp->db_agfree[agno] -= nblocks; in dbAllocDmapBU()
3307 bmp->db_nfree -= nblocks; in dbAllocDmapBU()
3320 dbFreeBits(bmp, dp, blkno, nblocks); in dbAllocDmapBU()
3343 int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) in dbExtendFS() argument
3358 newsize = blkno + nblocks; in dbExtendFS()
3361 (long long) blkno, (long long) nblocks, (long long) newsize); in dbExtendFS()
3518 n = min(nblocks, (s64)BPERDMAP - n); in dbExtendFS()
3526 n = min(nblocks, (s64)BPERDMAP); in dbExtendFS()
3542 nblocks -= n; in dbExtendFS()
3543 if (nblocks == 0) in dbExtendFS()
3555 if (nblocks) in dbExtendFS()
3579 if (nblocks) in dbExtendFS()
3707 static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks) in dbInitDmap() argument
3715 dp->nblocks = dp->nfree = cpu_to_le32(nblocks); in dbInitDmap()
3718 if (nblocks == BPERDMAP) { in dbInitDmap()
3724 dp->nblocks = in dbInitDmap()
3725 cpu_to_le32(le32_to_cpu(dp->nblocks) + nblocks); in dbInitDmap()
3726 dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) + nblocks); in dbInitDmap()
3737 for (r = nblocks; r > 0; r -= nb, blkno += nb) { in dbInitDmap()
3965 static int dbGetL2AGSize(s64 nblocks) in dbGetL2AGSize() argument
3971 if (nblocks < BPERDMAP * MAXAG) in dbGetL2AGSize()
3977 if (m & nblocks) in dbGetL2AGSize()
3982 if (sz < nblocks) in dbGetL2AGSize()
4016 s64 nblocks; in dbMapFileSizeToMapSize() local
4021 nblocks = ipbmap->i_size >> JFS_SBI(sb)->l2bsize; in dbMapFileSizeToMapSize()
4022 npages = nblocks >> JFS_SBI(sb)->l2nbperpage; in dbMapFileSizeToMapSize()
4050 nblocks = ndmaps << L2BPERDMAP; in dbMapFileSizeToMapSize()
4052 return (nblocks); in dbMapFileSizeToMapSize()
4107 void DBAlloc(uint * dbmap, s64 mapsize, s64 blkno, s64 nblocks) in DBAlloc() argument
4113 assert(nblocks > 0 && nblocks <= mapsize); in DBAlloc()
4115 assert(blkno + nblocks <= mapsize); in DBAlloc()
4118 while (nblocks > 0) { in DBAlloc()
4120 nb = min(nblocks, 32 - bitno); in DBAlloc()
4128 nblocks -= nb; in DBAlloc()
4136 static void DBFree(uint * dbmap, s64 mapsize, s64 blkno, s64 nblocks) in DBFree() argument
4142 assert(nblocks > 0 && nblocks <= mapsize); in DBFree()
4144 assert(blkno + nblocks <= mapsize); in DBFree()
4147 while (nblocks > 0) { in DBFree()
4149 nb = min(nblocks, 32 - bitno); in DBFree()
4157 nblocks -= nb; in DBFree()
4165 static void DBAllocCK(uint * dbmap, s64 mapsize, s64 blkno, s64 nblocks) in DBAllocCK() argument
4171 assert(nblocks > 0 && nblocks <= mapsize); in DBAllocCK()
4173 assert(blkno + nblocks <= mapsize); in DBAllocCK()
4176 while (nblocks > 0) { in DBAllocCK()
4178 nb = min(nblocks, 32 - bitno); in DBAllocCK()
4185 nblocks -= nb; in DBAllocCK()
4193 static void DBFreeCK(uint * dbmap, s64 mapsize, s64 blkno, s64 nblocks) in DBFreeCK() argument
4199 assert(nblocks > 0 && nblocks <= mapsize); in DBFreeCK()
4201 assert(blkno + nblocks <= mapsize); in DBFreeCK()
4204 while (nblocks > 0) { in DBFreeCK()
4206 nb = min(nblocks, 32 - bitno); in DBFreeCK()
4213 nblocks -= nb; in DBFreeCK()