Lines Matching +full:1 +full:- +full:of +full:- +full:4
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) International Business Machines Corp., 2000-2002
10 #define BMAPVERSION 1 /* version number */
11 #define TREESIZE (256+64+16+4+1) /* size of a dmap tree */
12 #define LEAFIND (64+16+4+1) /* index of 1st leaf of a dmap tree */
14 #define L2LPERDMAP 8 /* l2 number of leaves per dmap tree */
15 #define DBWORD 32 /* # of blks covered by a map word */
16 #define L2DBWORD 5 /* l2 # of blks covered by a mword */
18 #define BPERDMAP (LPERDMAP * DBWORD) /* num of blks per dmap */
19 #define L2BPERDMAP 13 /* l2 num of blks per dmap */
20 #define CTLTREESIZE (1024+256+64+16+4+1) /* size of a dmapctl tree */
21 #define CTLLEAFIND (256+64+16+4+1) /* idx of 1st leaf of a dmapctl tree */
22 #define LPERCTL 1024 /* num of leaves per dmapctl tree */
23 #define L2LPERCTL 10 /* l2 num of leaves per dmapctl tree */
24 #define ROOT 0 /* index of the root of a tree */
25 #define NOFREE ((s8) -1) /* no blocks free */
26 #define MAXAG 128 /* max number of allocation groups */
27 #define L2MAXAG 7 /* l2 max num of AG */
28 #define L2MINAGSZ 25 /* l2 of minimum AG size in bytes */
29 #define BMAPBLKNO 0 /* lblkno of bmap within the map */
32 * maximum l2 number of disk blocks at the various dmapctl levels.
34 #define L2MAXL0SIZE (L2BPERDMAP + 1 * L2LPERCTL)
39 * maximum number of disk blocks at the various dmapctl levels.
41 #define MAXL0SIZE ((s64)1 << L2MAXL0SIZE)
42 #define MAXL1SIZE ((s64)1 << L2MAXL1SIZE)
43 #define MAXL2SIZE ((s64)1 << L2MAXL2SIZE)
49 * of the tree.
56 tmp2 = max(*(cp), *(cp+1)); in TREEMAX()
62 * convert disk block number to the logical block number of the dmap
63 * describing the disk block. s is the log2(number of logical blocks per page)
65 * The calculation figures out how many logical pages are in front of the dmap.
66 * - the number of dmaps preceding it
67 * - the number of L0 pages preceding its L0 page
68 * - the number of L1 pages preceding its L1 page
69 * - 3 is added to account for the L2, L1, and L0 page for this dmap
70 * - 1 is added to account for the control page of the map.
73 ((((b) >> 13) + ((b) >> 23) + ((b) >> 33) + 3 + 1) << (s))
76 * convert disk block number to the logical block number of the LEVEL 0
77 * dmapctl describing the disk block. s is the log2(number of logical blocks
80 * The calculation figures out how many logical pages are in front of the L0.
81 * - the number of dmap pages preceding it
82 * - the number of L0 pages preceding it
83 * - the number of L1 pages preceding its L1 page
84 * - 2 is added to account for the L2, and L1 page for this L0
85 * - 1 is added to account for the control page of the map.
88 (((((b) >> 23) << 10) + ((b) >> 23) + ((b) >> 33) + 2 + 1) << (s))
91 * convert disk block number to the logical block number of the LEVEL 1
92 * dmapctl describing the disk block. s is the log2(number of logical blocks
95 * The calculation figures out how many logical pages are in front of the L1.
96 * - the number of dmap pages preceding it
97 * - the number of L0 pages preceding it
98 * - the number of L1 pages preceding it
99 * - 1 is added to account for the L2 page
100 * - 1 is added to account for the control page of the map.
103 (((((b) >> 33) << 20) + (((b) >> 33) << 10) + ((b) >> 33) + 1 + 1) << (s))
106 * convert disk block number to the logical block number of the dmapctl
110 (((l) == 2) ? 1 : ((l) == 1) ? BLKTOL1((b),(s)) : BLKTOL0((b),(s)))
113 * convert aggregate map size to the zero origin dmapctl level of the
117 (((size) <= MAXL0SIZE) ? 0 : ((size) <= MAXL1SIZE) ? 1 : 2)
121 #define BLKTOAG(b,sbi) ((b) >> ((sbi)->bmap->db_agl2size))
127 ((s64)(a) << (JFS_SBI((ip)->i_sb)->bmap->db_agl2size))
135 __le32 nleafs; /* 4: number of tree leafs */
136 __le32 l2nleafs; /* 4: l2 number of tree leafs */
137 __le32 leafidx; /* 4: index of first tree leaf */
138 __le32 height; /* 4: height of the tree */
139 s8 budmin; /* 1: min l2 tree leaf value to combine */
142 }; /* - 360 - */
148 __le32 nblocks; /* 4: num blks covered by this dmap */
149 __le32 nfree; /* 4: num of free blks in this dmap */
153 __le32 wmap[LPERDMAP]; /* 1024: bits of the working map */
154 __le32 pmap[LPERDMAP]; /* 1024: bits of the persistent map */
155 }; /* - 4096 - */
163 __le32 nleafs; /* 4: number of tree leafs */
164 __le32 l2nleafs; /* 4: l2 number of tree leafs */
165 __le32 leafidx; /* 4: index of the first tree leaf */
166 __le32 height; /* 4: height of tree */
167 s8 budmin; /* 1: minimum l2 tree leaf value */
170 }; /* - 4096 - */
189 * on-disk aggregate disk allocation map descriptor.
192 __le64 dn_mapsize; /* 8: number of blocks in aggregate */
194 __le32 dn_l2nbperpage; /* 4: number of blks per page */
195 __le32 dn_numag; /* 4: total number of ags */
196 __le32 dn_maxlevel; /* 4: number of active ags */
197 __le32 dn_maxag; /* 4: max active alloc group number */
198 __le32 dn_agpref; /* 4: preferred alloc group (hint) */
199 __le32 dn_aglevel; /* 4: dmapctl level holding the AG */
200 __le32 dn_agheight; /* 4: height in dmapctl of the AG */
201 __le32 dn_agwidth; /* 4: width in dmapctl of the AG */
202 __le32 dn_agstart; /* 4: start tree index at AG height */
203 __le32 dn_agl2size; /* 4: l2 num of blks per alloc group */
205 __le64 dn_agsize; /* 8: num of blks per alloc group */
206 s8 dn_maxfreebud; /* 1: max free buddy system */
208 }; /* - 4096 - */
211 s64 dn_mapsize; /* number of blocks in aggregate */
213 int dn_l2nbperpage; /* number of blks per page */
214 int dn_numag; /* total number of ags */
215 int dn_maxlevel; /* number of active ags */
219 int dn_agheight; /* height in dmapctl of the AG */
220 int dn_agwidth; /* width in dmapctl of the AG */
222 int dn_agl2size; /* l2 num of blks per alloc group */
224 s64 dn_agsize; /* num of blks per alloc group */
226 }; /* - 4096 - */
228 * in-memory aggregate disk allocation map descriptor.
231 struct dbmap db_bmap; /* on-disk aggregate map descriptor */
234 atomic_t db_active[MAXAG]; /* count of active, open files in AG */
238 /* macros for accessing fields within in-memory aggregate map descriptor */
259 /* convert number of blocks to log2 number of blocks, rounding up to
264 /* convert number of leafs to log2 leaf value */
265 #define NLSTOL2BSZ(n) (31 - cntlz((n)) + BUDMIN)
272 (((b) & (((s64)1 << ((m) + L2LPERCTL)) - 1)) >> (m))
275 #define BUDSIZE(s,m) (1 << ((s) - (m)))