ulfs_bmap.c revision 1.7 1 1.7 dholland /* $NetBSD: ulfs_bmap.c,v 1.7 2015/09/01 06:08:37 dholland Exp $ */
2 1.1 dholland /* from NetBSD: ufs_bmap.c,v 1.50 2013/01/22 09:39:18 dholland Exp */
3 1.1 dholland
4 1.1 dholland /*
5 1.1 dholland * Copyright (c) 1989, 1991, 1993
6 1.1 dholland * The Regents of the University of California. All rights reserved.
7 1.1 dholland * (c) UNIX System Laboratories, Inc.
8 1.1 dholland * All or some portions of this file are derived from material licensed
9 1.1 dholland * to the University of California by American Telephone and Telegraph
10 1.1 dholland * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11 1.1 dholland * the permission of UNIX System Laboratories, Inc.
12 1.1 dholland *
13 1.1 dholland * Redistribution and use in source and binary forms, with or without
14 1.1 dholland * modification, are permitted provided that the following conditions
15 1.1 dholland * are met:
16 1.1 dholland * 1. Redistributions of source code must retain the above copyright
17 1.1 dholland * notice, this list of conditions and the following disclaimer.
18 1.1 dholland * 2. Redistributions in binary form must reproduce the above copyright
19 1.1 dholland * notice, this list of conditions and the following disclaimer in the
20 1.1 dholland * documentation and/or other materials provided with the distribution.
21 1.1 dholland * 3. Neither the name of the University nor the names of its contributors
22 1.1 dholland * may be used to endorse or promote products derived from this software
23 1.1 dholland * without specific prior written permission.
24 1.1 dholland *
25 1.1 dholland * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 1.1 dholland * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 1.1 dholland * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 1.1 dholland * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 1.1 dholland * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 1.1 dholland * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 1.1 dholland * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.1 dholland * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.1 dholland * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.1 dholland * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.1 dholland * SUCH DAMAGE.
36 1.1 dholland *
37 1.1 dholland * @(#)ufs_bmap.c 8.8 (Berkeley) 8/11/95
38 1.1 dholland */
39 1.1 dholland
40 1.1 dholland #include <sys/cdefs.h>
41 1.7 dholland __KERNEL_RCSID(0, "$NetBSD: ulfs_bmap.c,v 1.7 2015/09/01 06:08:37 dholland Exp $");
42 1.1 dholland
43 1.1 dholland #include <sys/param.h>
44 1.1 dholland #include <sys/systm.h>
45 1.4 dholland #include <sys/stat.h>
46 1.1 dholland #include <sys/buf.h>
47 1.1 dholland #include <sys/proc.h>
48 1.1 dholland #include <sys/vnode.h>
49 1.1 dholland #include <sys/mount.h>
50 1.1 dholland #include <sys/resourcevar.h>
51 1.1 dholland #include <sys/trace.h>
52 1.1 dholland #include <sys/fstrans.h>
53 1.1 dholland
54 1.1 dholland #include <miscfs/specfs/specdev.h>
55 1.1 dholland
56 1.2 dholland #include <ufs/lfs/ulfs_inode.h>
57 1.2 dholland #include <ufs/lfs/ulfsmount.h>
58 1.2 dholland #include <ufs/lfs/ulfs_extern.h>
59 1.2 dholland #include <ufs/lfs/ulfs_bswap.h>
60 1.1 dholland
61 1.1 dholland static bool
62 1.5 dholland ulfs_issequential(const struct lfs *fs, daddr_t daddr0, daddr_t daddr1)
63 1.1 dholland {
64 1.1 dholland
65 1.3 dholland /* for ulfs, blocks in a hole is not 'contiguous'. */
66 1.1 dholland if (daddr0 == 0)
67 1.1 dholland return false;
68 1.1 dholland
69 1.5 dholland return (daddr0 + fs->um_seqinc == daddr1);
70 1.1 dholland }
71 1.1 dholland
72 1.1 dholland /*
73 1.6 dholland * This is used for block pointers in inodes and elsewhere, which can
74 1.6 dholland * contain the magic value UNWRITTEN, which is -2. This is mishandled
75 1.6 dholland * by u32 -> u64 promotion unless special-cased.
76 1.6 dholland *
77 1.6 dholland * XXX this should be rolled into better inode accessors and go away.
78 1.6 dholland */
79 1.6 dholland static inline uint64_t
80 1.6 dholland ulfs_fix_unwritten(uint32_t val)
81 1.6 dholland {
82 1.6 dholland if (val == (uint32_t)UNWRITTEN) {
83 1.6 dholland return (uint64_t)(int64_t)UNWRITTEN;
84 1.6 dholland } else {
85 1.6 dholland return val;
86 1.6 dholland }
87 1.6 dholland }
88 1.6 dholland
89 1.6 dholland
90 1.6 dholland /*
91 1.1 dholland * Bmap converts the logical block number of a file to its physical block
92 1.1 dholland * number on the disk. The conversion is done by using the logical block
93 1.1 dholland * number to index into the array of block pointers described by the dinode.
94 1.1 dholland */
95 1.1 dholland int
96 1.3 dholland ulfs_bmap(void *v)
97 1.1 dholland {
98 1.1 dholland struct vop_bmap_args /* {
99 1.1 dholland struct vnode *a_vp;
100 1.1 dholland daddr_t a_bn;
101 1.1 dholland struct vnode **a_vpp;
102 1.1 dholland daddr_t *a_bnp;
103 1.1 dholland int *a_runp;
104 1.1 dholland } */ *ap = v;
105 1.1 dholland int error;
106 1.1 dholland
107 1.1 dholland /*
108 1.1 dholland * Check for underlying vnode requests and ensure that logical
109 1.1 dholland * to physical mapping is requested.
110 1.1 dholland */
111 1.1 dholland if (ap->a_vpp != NULL)
112 1.1 dholland *ap->a_vpp = VTOI(ap->a_vp)->i_devvp;
113 1.1 dholland if (ap->a_bnp == NULL)
114 1.1 dholland return (0);
115 1.1 dholland
116 1.1 dholland fstrans_start(ap->a_vp->v_mount, FSTRANS_SHARED);
117 1.3 dholland error = ulfs_bmaparray(ap->a_vp, ap->a_bn, ap->a_bnp, NULL, NULL,
118 1.3 dholland ap->a_runp, ulfs_issequential);
119 1.1 dholland fstrans_done(ap->a_vp->v_mount);
120 1.1 dholland return error;
121 1.1 dholland }
122 1.1 dholland
123 1.1 dholland /*
124 1.1 dholland * Indirect blocks are now on the vnode for the file. They are given negative
125 1.1 dholland * logical block numbers. Indirect blocks are addressed by the negative
126 1.1 dholland * address of the first data block to which they point. Double indirect blocks
127 1.1 dholland * are addressed by one less than the address of the first indirect block to
128 1.1 dholland * which they point. Triple indirect blocks are addressed by one less than
129 1.1 dholland * the address of the first double indirect block to which they point.
130 1.1 dholland *
131 1.3 dholland * ulfs_bmaparray does the bmap conversion, and if requested returns the
132 1.1 dholland * array of logical blocks which must be traversed to get to a block.
133 1.1 dholland * Each entry contains the offset into that block that gets you to the
134 1.1 dholland * next block and the disk address of the block (if it is assigned).
135 1.1 dholland */
136 1.1 dholland
137 1.1 dholland int
138 1.3 dholland ulfs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, struct indir *ap,
139 1.3 dholland int *nump, int *runp, ulfs_issequential_callback_t is_sequential)
140 1.1 dholland {
141 1.1 dholland struct inode *ip;
142 1.1 dholland struct buf *bp, *cbp;
143 1.3 dholland struct ulfsmount *ump;
144 1.5 dholland struct lfs *fs;
145 1.1 dholland struct mount *mp;
146 1.3 dholland struct indir a[ULFS_NIADDR + 1], *xap;
147 1.1 dholland daddr_t daddr;
148 1.1 dholland daddr_t metalbn;
149 1.1 dholland int error, maxrun = 0, num;
150 1.1 dholland
151 1.1 dholland ip = VTOI(vp);
152 1.1 dholland mp = vp->v_mount;
153 1.1 dholland ump = ip->i_ump;
154 1.5 dholland fs = ip->i_lfs;
155 1.1 dholland #ifdef DIAGNOSTIC
156 1.1 dholland if ((ap != NULL && nump == NULL) || (ap == NULL && nump != NULL))
157 1.3 dholland panic("ulfs_bmaparray: invalid arguments");
158 1.1 dholland #endif
159 1.1 dholland
160 1.1 dholland if (runp) {
161 1.1 dholland /*
162 1.1 dholland * XXX
163 1.1 dholland * If MAXBSIZE is the largest transfer the disks can handle,
164 1.1 dholland * we probably want maxrun to be 1 block less so that we
165 1.1 dholland * don't create a block larger than the device can handle.
166 1.1 dholland */
167 1.1 dholland *runp = 0;
168 1.1 dholland maxrun = MAXPHYS / mp->mnt_stat.f_iosize - 1;
169 1.1 dholland }
170 1.1 dholland
171 1.3 dholland if (bn >= 0 && bn < ULFS_NDADDR) {
172 1.1 dholland if (nump != NULL)
173 1.1 dholland *nump = 0;
174 1.3 dholland if (ump->um_fstype == ULFS1)
175 1.7 dholland daddr = ulfs_fix_unwritten(ulfs_rw32(ip->i_din->u_32.di_db[bn],
176 1.6 dholland ULFS_MPNEEDSWAP(fs)));
177 1.1 dholland else
178 1.7 dholland daddr = ulfs_rw64(ip->i_din->u_64.di_db[bn],
179 1.5 dholland ULFS_MPNEEDSWAP(fs));
180 1.5 dholland *bnp = blkptrtodb(fs, daddr);
181 1.1 dholland /*
182 1.1 dholland * Since this is FFS independent code, we are out of
183 1.1 dholland * scope for the definitions of BLK_NOCOPY and
184 1.1 dholland * BLK_SNAP, but we do know that they will fall in
185 1.1 dholland * the range 1..um_seqinc, so we use that test and
186 1.1 dholland * return a request for a zeroed out buffer if attempts
187 1.1 dholland * are made to read a BLK_NOCOPY or BLK_SNAP block.
188 1.1 dholland */
189 1.1 dholland if ((ip->i_flags & (SF_SNAPSHOT | SF_SNAPINVAL)) == SF_SNAPSHOT
190 1.1 dholland && daddr > 0 &&
191 1.5 dholland daddr < fs->um_seqinc) {
192 1.1 dholland *bnp = -1;
193 1.1 dholland } else if (*bnp == 0) {
194 1.1 dholland if ((ip->i_flags & (SF_SNAPSHOT | SF_SNAPINVAL))
195 1.1 dholland == SF_SNAPSHOT) {
196 1.5 dholland *bnp = blkptrtodb(fs, bn * fs->um_seqinc);
197 1.1 dholland } else {
198 1.1 dholland *bnp = -1;
199 1.1 dholland }
200 1.1 dholland } else if (runp) {
201 1.3 dholland if (ump->um_fstype == ULFS1) {
202 1.3 dholland for (++bn; bn < ULFS_NDADDR && *runp < maxrun &&
203 1.5 dholland is_sequential(fs,
204 1.7 dholland ulfs_fix_unwritten(ulfs_rw32(ip->i_din->u_32.di_db[bn - 1],
205 1.6 dholland ULFS_MPNEEDSWAP(fs))),
206 1.7 dholland ulfs_fix_unwritten(ulfs_rw32(ip->i_din->u_32.di_db[bn],
207 1.6 dholland ULFS_MPNEEDSWAP(fs))));
208 1.1 dholland ++bn, ++*runp);
209 1.1 dholland } else {
210 1.3 dholland for (++bn; bn < ULFS_NDADDR && *runp < maxrun &&
211 1.5 dholland is_sequential(fs,
212 1.7 dholland ulfs_rw64(ip->i_din->u_64.di_db[bn - 1],
213 1.5 dholland ULFS_MPNEEDSWAP(fs)),
214 1.7 dholland ulfs_rw64(ip->i_din->u_64.di_db[bn],
215 1.5 dholland ULFS_MPNEEDSWAP(fs)));
216 1.1 dholland ++bn, ++*runp);
217 1.1 dholland }
218 1.1 dholland }
219 1.1 dholland return (0);
220 1.1 dholland }
221 1.1 dholland
222 1.1 dholland xap = ap == NULL ? a : ap;
223 1.1 dholland if (!nump)
224 1.1 dholland nump = #
225 1.3 dholland if ((error = ulfs_getlbns(vp, bn, xap, nump)) != 0)
226 1.1 dholland return (error);
227 1.1 dholland
228 1.1 dholland num = *nump;
229 1.1 dholland
230 1.1 dholland /* Get disk address out of indirect block array */
231 1.7 dholland // XXX clean this up
232 1.3 dholland if (ump->um_fstype == ULFS1)
233 1.7 dholland daddr = ulfs_fix_unwritten(ulfs_rw32(ip->i_din->u_32.di_ib[xap->in_off],
234 1.6 dholland ULFS_MPNEEDSWAP(fs)));
235 1.1 dholland else
236 1.7 dholland daddr = ulfs_rw64(ip->i_din->u_64.di_ib[xap->in_off],
237 1.5 dholland ULFS_MPNEEDSWAP(fs));
238 1.1 dholland
239 1.1 dholland for (bp = NULL, ++xap; --num; ++xap) {
240 1.1 dholland /*
241 1.1 dholland * Exit the loop if there is no disk address assigned yet and
242 1.1 dholland * the indirect block isn't in the cache, or if we were
243 1.1 dholland * looking for an indirect block and we've found it.
244 1.1 dholland */
245 1.1 dholland
246 1.1 dholland metalbn = xap->in_lbn;
247 1.1 dholland if (metalbn == bn)
248 1.1 dholland break;
249 1.1 dholland if (daddr == 0) {
250 1.1 dholland mutex_enter(&bufcache_lock);
251 1.1 dholland cbp = incore(vp, metalbn);
252 1.1 dholland mutex_exit(&bufcache_lock);
253 1.1 dholland if (cbp == NULL)
254 1.1 dholland break;
255 1.1 dholland }
256 1.1 dholland
257 1.1 dholland /*
258 1.1 dholland * If we get here, we've either got the block in the cache
259 1.1 dholland * or we have a disk address for it, go fetch it.
260 1.1 dholland */
261 1.1 dholland if (bp)
262 1.1 dholland brelse(bp, 0);
263 1.1 dholland
264 1.1 dholland xap->in_exists = 1;
265 1.1 dholland bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0);
266 1.1 dholland if (bp == NULL) {
267 1.1 dholland
268 1.1 dholland /*
269 1.1 dholland * getblk() above returns NULL only iff we are
270 1.1 dholland * pagedaemon. See the implementation of getblk
271 1.1 dholland * for detail.
272 1.1 dholland */
273 1.1 dholland
274 1.1 dholland return (ENOMEM);
275 1.1 dholland }
276 1.1 dholland if (bp->b_oflags & (BO_DONE | BO_DELWRI)) {
277 1.1 dholland trace(TR_BREADHIT, pack(vp, size), metalbn);
278 1.1 dholland }
279 1.1 dholland #ifdef DIAGNOSTIC
280 1.1 dholland else if (!daddr)
281 1.3 dholland panic("ulfs_bmaparray: indirect block not in cache");
282 1.1 dholland #endif
283 1.1 dholland else {
284 1.1 dholland trace(TR_BREADMISS, pack(vp, size), metalbn);
285 1.5 dholland bp->b_blkno = blkptrtodb(fs, daddr);
286 1.1 dholland bp->b_flags |= B_READ;
287 1.1 dholland BIO_SETPRIO(bp, BPRIO_TIMECRITICAL);
288 1.1 dholland VOP_STRATEGY(vp, bp);
289 1.1 dholland curlwp->l_ru.ru_inblock++; /* XXX */
290 1.1 dholland if ((error = biowait(bp)) != 0) {
291 1.1 dholland brelse(bp, 0);
292 1.1 dholland return (error);
293 1.1 dholland }
294 1.1 dholland }
295 1.3 dholland if (ump->um_fstype == ULFS1) {
296 1.6 dholland daddr = ulfs_fix_unwritten(ulfs_rw32(((u_int32_t *)bp->b_data)[xap->in_off],
297 1.6 dholland ULFS_MPNEEDSWAP(fs)));
298 1.1 dholland if (num == 1 && daddr && runp) {
299 1.1 dholland for (bn = xap->in_off + 1;
300 1.5 dholland bn < MNINDIR(fs) && *runp < maxrun &&
301 1.5 dholland is_sequential(fs,
302 1.6 dholland ulfs_fix_unwritten(ulfs_rw32(((int32_t *)bp->b_data)[bn-1],
303 1.6 dholland ULFS_MPNEEDSWAP(fs))),
304 1.6 dholland ulfs_fix_unwritten(ulfs_rw32(((int32_t *)bp->b_data)[bn],
305 1.6 dholland ULFS_MPNEEDSWAP(fs))));
306 1.1 dholland ++bn, ++*runp);
307 1.1 dholland }
308 1.1 dholland } else {
309 1.3 dholland daddr = ulfs_rw64(((u_int64_t *)bp->b_data)[xap->in_off],
310 1.5 dholland ULFS_MPNEEDSWAP(fs));
311 1.1 dholland if (num == 1 && daddr && runp) {
312 1.1 dholland for (bn = xap->in_off + 1;
313 1.5 dholland bn < MNINDIR(fs) && *runp < maxrun &&
314 1.5 dholland is_sequential(fs,
315 1.3 dholland ulfs_rw64(((int64_t *)bp->b_data)[bn-1],
316 1.5 dholland ULFS_MPNEEDSWAP(fs)),
317 1.3 dholland ulfs_rw64(((int64_t *)bp->b_data)[bn],
318 1.5 dholland ULFS_MPNEEDSWAP(fs)));
319 1.1 dholland ++bn, ++*runp);
320 1.1 dholland }
321 1.1 dholland }
322 1.1 dholland }
323 1.1 dholland if (bp)
324 1.1 dholland brelse(bp, 0);
325 1.1 dholland
326 1.1 dholland /*
327 1.1 dholland * Since this is FFS independent code, we are out of scope for the
328 1.1 dholland * definitions of BLK_NOCOPY and BLK_SNAP, but we do know that they
329 1.1 dholland * will fall in the range 1..um_seqinc, so we use that test and
330 1.1 dholland * return a request for a zeroed out buffer if attempts are made
331 1.1 dholland * to read a BLK_NOCOPY or BLK_SNAP block.
332 1.1 dholland */
333 1.1 dholland if ((ip->i_flags & (SF_SNAPSHOT | SF_SNAPINVAL)) == SF_SNAPSHOT
334 1.5 dholland && daddr > 0 && daddr < fs->um_seqinc) {
335 1.1 dholland *bnp = -1;
336 1.1 dholland return (0);
337 1.1 dholland }
338 1.5 dholland *bnp = blkptrtodb(fs, daddr);
339 1.1 dholland if (*bnp == 0) {
340 1.1 dholland if ((ip->i_flags & (SF_SNAPSHOT | SF_SNAPINVAL))
341 1.1 dholland == SF_SNAPSHOT) {
342 1.5 dholland *bnp = blkptrtodb(fs, bn * fs->um_seqinc);
343 1.1 dholland } else {
344 1.1 dholland *bnp = -1;
345 1.1 dholland }
346 1.1 dholland }
347 1.1 dholland return (0);
348 1.1 dholland }
349 1.1 dholland
350 1.1 dholland /*
351 1.1 dholland * Create an array of logical block number/offset pairs which represent the
352 1.1 dholland * path of indirect blocks required to access a data block. The first "pair"
353 1.1 dholland * contains the logical block number of the appropriate single, double or
354 1.1 dholland * triple indirect block and the offset into the inode indirect block array.
355 1.1 dholland * Note, the logical block number of the inode single/double/triple indirect
356 1.1 dholland * block appears twice in the array, once with the offset into the i_ffs1_ib and
357 1.1 dholland * once with the offset into the page itself.
358 1.1 dholland */
359 1.1 dholland int
360 1.3 dholland ulfs_getlbns(struct vnode *vp, daddr_t bn, struct indir *ap, int *nump)
361 1.1 dholland {
362 1.1 dholland daddr_t metalbn, realbn;
363 1.3 dholland struct ulfsmount *ump;
364 1.5 dholland struct lfs *fs;
365 1.1 dholland int64_t blockcnt;
366 1.1 dholland int lbc;
367 1.1 dholland int i, numlevels, off;
368 1.1 dholland
369 1.3 dholland ump = VFSTOULFS(vp->v_mount);
370 1.5 dholland fs = ump->um_lfs;
371 1.1 dholland if (nump)
372 1.1 dholland *nump = 0;
373 1.1 dholland numlevels = 0;
374 1.1 dholland realbn = bn;
375 1.1 dholland if (bn < 0)
376 1.1 dholland bn = -bn;
377 1.3 dholland KASSERT(bn >= ULFS_NDADDR);
378 1.1 dholland
379 1.1 dholland /*
380 1.1 dholland * Determine the number of levels of indirection. After this loop
381 1.1 dholland * is done, blockcnt indicates the number of data blocks possible
382 1.3 dholland * at the given level of indirection, and ULFS_NIADDR - i is the number
383 1.1 dholland * of levels of indirection needed to locate the requested block.
384 1.1 dholland */
385 1.1 dholland
386 1.3 dholland bn -= ULFS_NDADDR;
387 1.3 dholland for (lbc = 0, i = ULFS_NIADDR;; i--, bn -= blockcnt) {
388 1.1 dholland if (i == 0)
389 1.1 dholland return (EFBIG);
390 1.1 dholland
391 1.5 dholland lbc += fs->um_lognindir;
392 1.1 dholland blockcnt = (int64_t)1 << lbc;
393 1.1 dholland
394 1.1 dholland if (bn < blockcnt)
395 1.1 dholland break;
396 1.1 dholland }
397 1.1 dholland
398 1.1 dholland /* Calculate the address of the first meta-block. */
399 1.3 dholland metalbn = -((realbn >= 0 ? realbn : -realbn) - bn + ULFS_NIADDR - i);
400 1.1 dholland
401 1.1 dholland /*
402 1.1 dholland * At each iteration, off is the offset into the bap array which is
403 1.1 dholland * an array of disk addresses at the current level of indirection.
404 1.1 dholland * The logical block number and the offset in that block are stored
405 1.1 dholland * into the argument array.
406 1.1 dholland */
407 1.1 dholland ap->in_lbn = metalbn;
408 1.3 dholland ap->in_off = off = ULFS_NIADDR - i;
409 1.1 dholland ap->in_exists = 0;
410 1.1 dholland ap++;
411 1.3 dholland for (++numlevels; i <= ULFS_NIADDR; i++) {
412 1.1 dholland /* If searching for a meta-data block, quit when found. */
413 1.1 dholland if (metalbn == realbn)
414 1.1 dholland break;
415 1.1 dholland
416 1.5 dholland lbc -= fs->um_lognindir;
417 1.5 dholland off = (bn >> lbc) & (MNINDIR(fs) - 1);
418 1.1 dholland
419 1.1 dholland ++numlevels;
420 1.1 dholland ap->in_lbn = metalbn;
421 1.1 dholland ap->in_off = off;
422 1.1 dholland ap->in_exists = 0;
423 1.1 dholland ++ap;
424 1.1 dholland
425 1.1 dholland metalbn -= -1 + ((int64_t)off << lbc);
426 1.1 dholland }
427 1.1 dholland if (nump)
428 1.1 dholland *nump = numlevels;
429 1.1 dholland return (0);
430 1.1 dholland }
431