rcache.c revision 1.4.6.2 1 1.4.6.2 he /* $NetBSD: rcache.c,v 1.4.6.2 2002/01/16 09:57:29 he Exp $ */
2 1.1 bouyer
3 1.1 bouyer /*-
4 1.1 bouyer * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 1.1 bouyer * All rights reserved.
6 1.1 bouyer *
7 1.1 bouyer * This code is derived from software contributed to The NetBSD Foundation
8 1.4.6.2 he * by Martin J. Laubach <mjl (at) emsi.priv.at> and
9 1.1 bouyer * Manuel Bouyer <Manuel.Bouyer (at) lip6.fr>.
10 1.1 bouyer *
11 1.1 bouyer * Redistribution and use in source and binary forms, with or without
12 1.1 bouyer * modification, are permitted provided that the following conditions
13 1.1 bouyer * are met:
14 1.1 bouyer * 1. Redistributions of source code must retain the above copyright
15 1.1 bouyer * notice, this list of conditions and the following disclaimer.
16 1.1 bouyer * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 bouyer * notice, this list of conditions and the following disclaimer in the
18 1.1 bouyer * documentation and/or other materials provided with the distribution.
19 1.1 bouyer * 3. All advertising materials mentioning features or use of this software
20 1.1 bouyer * must display the following acknowledgement:
21 1.4.6.2 he * This product includes software developed by the NetBSD
22 1.4.6.2 he * Foundation, Inc. and its contributors.
23 1.1 bouyer * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.1 bouyer * contributors may be used to endorse or promote products derived
25 1.1 bouyer * from this software without specific prior written permission.
26 1.1 bouyer *
27 1.1 bouyer * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.1 bouyer * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.1 bouyer * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.4.6.2 he * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.1 bouyer * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.1 bouyer * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.1 bouyer * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.1 bouyer * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.1 bouyer * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.1 bouyer * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.1 bouyer * POSSIBILITY OF SUCH DAMAGE.
38 1.1 bouyer */
39 1.1 bouyer /*-----------------------------------------------------------------------*/
40 1.1 bouyer #include <sys/types.h>
41 1.1 bouyer #include <sys/uio.h>
42 1.1 bouyer #include <sys/mman.h>
43 1.1 bouyer #include <sys/param.h>
44 1.1 bouyer #include <sys/sysctl.h>
45 1.1 bouyer #include <ufs/ufs/dinode.h>
46 1.1 bouyer
47 1.1 bouyer #include <stdio.h>
48 1.1 bouyer #include <stdlib.h>
49 1.1 bouyer #include <unistd.h>
50 1.1 bouyer #include <fcntl.h>
51 1.1 bouyer #include <errno.h>
52 1.1 bouyer #include <string.h>
53 1.1 bouyer
54 1.1 bouyer #include "dump.h"
55 1.1 bouyer
56 1.1 bouyer /*-----------------------------------------------------------------------*/
57 1.1 bouyer #define MAXCACHEBUFS 512 /* max 512 buffers */
58 1.1 bouyer #define MAXMEMPART 6 /* max 15% of the user mem */
59 1.1 bouyer
60 1.1 bouyer /*-----------------------------------------------------------------------*/
61 1.1 bouyer struct cheader {
62 1.1 bouyer volatile size_t count;
63 1.1 bouyer };
64 1.1 bouyer
65 1.1 bouyer struct cdesc {
66 1.1 bouyer volatile daddr_t blkstart;
67 1.1 bouyer volatile daddr_t blkend;/* start + nblksread */
68 1.1 bouyer volatile daddr_t blocksRead;
69 1.1 bouyer volatile size_t time;
70 1.1 bouyer #ifdef DIAGNOSTICS
71 1.1 bouyer volatile pid_t owner;
72 1.1 bouyer #endif
73 1.1 bouyer };
74 1.1 bouyer
75 1.1 bouyer static int findlru __P((void));
76 1.1 bouyer
77 1.1 bouyer static void *shareBuffer = NULL;
78 1.1 bouyer static struct cheader *cheader;
79 1.1 bouyer static struct cdesc *cdesc;
80 1.1 bouyer static char *cdata;
81 1.1 bouyer static int cachebufs;
82 1.1 bouyer static int nblksread;
83 1.1 bouyer
84 1.1 bouyer #ifdef STATS
85 1.1 bouyer static int nreads;
86 1.1 bouyer static int nphysread;
87 1.1 bouyer static int64_t readsize;
88 1.1 bouyer static int64_t physreadsize;
89 1.1 bouyer #endif
90 1.1 bouyer
91 1.1 bouyer #define CDATA(i) (cdata + ((i) * nblksread * dev_bsize))
92 1.1 bouyer
93 1.1 bouyer /*-----------------------------------------------------------------------*/
94 1.1 bouyer void
95 1.1 bouyer initcache(cachesize, readblksize)
96 1.1 bouyer int cachesize;
97 1.1 bouyer int readblksize;
98 1.1 bouyer {
99 1.1 bouyer size_t len;
100 1.1 bouyer size_t sharedSize;
101 1.1 bouyer
102 1.4 perseant nblksread = (readblksize + ufsib->ufs_bsize - 1) / ufsib->ufs_bsize;
103 1.1 bouyer if(cachesize == -1) { /* Compute from memory available */
104 1.1 bouyer int usermem;
105 1.1 bouyer int mib[2] = { CTL_HW, HW_USERMEM };
106 1.4.6.2 he
107 1.1 bouyer len = sizeof(usermem);
108 1.1 bouyer if (sysctl(mib, 2, &usermem, &len, NULL, 0) < 0) {
109 1.1 bouyer msg("sysctl(hw.usermem) failed: %s\n", strerror(errno));
110 1.1 bouyer return;
111 1.1 bouyer }
112 1.1 bouyer cachebufs = (usermem / MAXMEMPART) / (nblksread * dev_bsize);
113 1.1 bouyer } else { /* User specified */
114 1.1 bouyer cachebufs = cachesize;
115 1.1 bouyer }
116 1.4.6.2 he
117 1.1 bouyer if(cachebufs) { /* Don't allocate if zero --> no caching */
118 1.1 bouyer if (cachebufs > MAXCACHEBUFS)
119 1.1 bouyer cachebufs = MAXCACHEBUFS;
120 1.1 bouyer
121 1.1 bouyer sharedSize = sizeof(struct cheader) +
122 1.1 bouyer sizeof(struct cdesc) * cachebufs +
123 1.1 bouyer nblksread * cachebufs * dev_bsize;
124 1.4.6.2 he #ifdef STATS
125 1.1 bouyer fprintf(stderr, "Using %d buffers (%d bytes)\n", cachebufs,
126 1.1 bouyer sharedSize);
127 1.1 bouyer #endif
128 1.1 bouyer shareBuffer = mmap(NULL, sharedSize, PROT_READ | PROT_WRITE,
129 1.1 bouyer MAP_ANON | MAP_SHARED, -1, 0);
130 1.1 bouyer if (shareBuffer == (void *)-1) {
131 1.1 bouyer msg("can't mmap shared memory for buffer: %s\n",
132 1.1 bouyer strerror(errno));
133 1.1 bouyer return;
134 1.1 bouyer }
135 1.1 bouyer cheader = shareBuffer;
136 1.1 bouyer cdesc = (struct cdesc *) (((char *) shareBuffer) +
137 1.1 bouyer sizeof(struct cheader));
138 1.1 bouyer cdata = ((char *) shareBuffer) + sizeof(struct cheader) +
139 1.1 bouyer sizeof(struct cdesc) * cachebufs;
140 1.1 bouyer
141 1.1 bouyer memset(shareBuffer, '\0', sharedSize);
142 1.1 bouyer }
143 1.1 bouyer }
144 1.1 bouyer
145 1.4.6.2 he /*
146 1.4.6.2 he * Find the cache buffer descriptor that shows the minimal access time
147 1.4.6.2 he */
148 1.1 bouyer static int
149 1.1 bouyer findlru()
150 1.1 bouyer {
151 1.4.6.2 he int i;
152 1.4.6.2 he size_t minTime = cdesc[0].time;
153 1.4.6.2 he int minIdx = 0;
154 1.1 bouyer
155 1.1 bouyer for (i = 0; i < cachebufs; i++) {
156 1.1 bouyer if (cdesc[i].time < minTime) {
157 1.1 bouyer minIdx = i;
158 1.1 bouyer minTime = cdesc[i].time;
159 1.1 bouyer }
160 1.1 bouyer }
161 1.1 bouyer
162 1.1 bouyer return minIdx;
163 1.1 bouyer }
164 1.1 bouyer /*-----------------------------------------------------------------------*/
165 1.1 bouyer /*
166 1.1 bouyer * Read data directly from disk, with smart error handling.
167 1.1 bouyer * Try to recover from hard errors by reading in sector sized pieces.
168 1.1 bouyer * Error recovery is attempted at most BREADEMAX times before seeking
169 1.1 bouyer * consent from the operator to continue.
170 1.1 bouyer */
171 1.1 bouyer
172 1.1 bouyer
173 1.1 bouyer static int breaderrors = 0;
174 1.1 bouyer #define BREADEMAX 32
175 1.1 bouyer
176 1.1 bouyer void
177 1.1 bouyer rawread(blkno, buf, size)
178 1.1 bouyer daddr_t blkno;
179 1.1 bouyer char *buf;
180 1.1 bouyer int size;
181 1.1 bouyer {
182 1.1 bouyer int cnt, i;
183 1.1 bouyer #ifdef STATS
184 1.1 bouyer nphysread++;
185 1.1 bouyer physreadsize += size;
186 1.1 bouyer #endif
187 1.1 bouyer
188 1.4.6.2 he loop:
189 1.1 bouyer if (lseek(diskfd, ((off_t) blkno << dev_bshift), 0) < 0) {
190 1.1 bouyer msg("rawread: lseek fails\n");
191 1.1 bouyer goto err;
192 1.1 bouyer }
193 1.1 bouyer if ((cnt = read(diskfd, buf, size)) == size)
194 1.1 bouyer return;
195 1.4.6.2 he if (blkno + (size / dev_bsize) > ufsib->ufs_dsize) {
196 1.4.6.2 he /*
197 1.4.6.2 he * Trying to read the final fragment.
198 1.4.6.2 he *
199 1.4.6.2 he * NB - dump only works in TP_BSIZE blocks, hence
200 1.4.6.2 he * rounds `dev_bsize' fragments up to TP_BSIZE pieces.
201 1.4.6.2 he * It should be smarter about not actually trying to
202 1.4.6.2 he * read more than it can get, but for the time being
203 1.4.6.2 he * we punt and scale back the read only when it gets
204 1.4.6.2 he * us into trouble. (mkm 9/25/83)
205 1.4.6.2 he */
206 1.4.6.2 he size -= dev_bsize;
207 1.4.6.2 he goto loop;
208 1.4.6.2 he }
209 1.1 bouyer if (cnt == -1)
210 1.1 bouyer msg("read error from %s: %s: [block %d]: count=%d\n",
211 1.1 bouyer disk, strerror(errno), blkno, size);
212 1.1 bouyer else
213 1.1 bouyer msg("short read error from %s: [block %d]: count=%d, got=%d\n",
214 1.1 bouyer disk, blkno, size, cnt);
215 1.1 bouyer err:
216 1.1 bouyer if (++breaderrors > BREADEMAX) {
217 1.4.6.1 tv msg("More than %d block read errors from %s\n",
218 1.1 bouyer BREADEMAX, disk);
219 1.1 bouyer broadcast("DUMP IS AILING!\n");
220 1.1 bouyer msg("This is an unrecoverable error.\n");
221 1.1 bouyer if (!query("Do you want to attempt to continue?")){
222 1.1 bouyer dumpabort(0);
223 1.1 bouyer /*NOTREACHED*/
224 1.1 bouyer } else
225 1.1 bouyer breaderrors = 0;
226 1.1 bouyer }
227 1.1 bouyer /*
228 1.1 bouyer * Zero buffer, then try to read each sector of buffer separately.
229 1.1 bouyer */
230 1.1 bouyer memset(buf, 0, size);
231 1.1 bouyer for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) {
232 1.1 bouyer if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0) {
233 1.1 bouyer msg("rawread: lseek2 fails: %s!\n",
234 1.1 bouyer strerror(errno));
235 1.1 bouyer continue;
236 1.1 bouyer }
237 1.1 bouyer if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize)
238 1.1 bouyer continue;
239 1.1 bouyer if (cnt == -1) {
240 1.4.6.1 tv msg("read error from %s: %s: [sector %d]: count=%ld: "
241 1.1 bouyer "%s\n", disk, strerror(errno), blkno, dev_bsize,
242 1.1 bouyer strerror(errno));
243 1.1 bouyer continue;
244 1.1 bouyer }
245 1.4.6.1 tv msg("short read error from %s: [sector %d]: count=%ld, got=%d\n",
246 1.1 bouyer disk, blkno, dev_bsize, cnt);
247 1.1 bouyer }
248 1.1 bouyer }
249 1.1 bouyer
250 1.1 bouyer /*-----------------------------------------------------------------------*/
251 1.1 bouyer #define min(a,b) (((a) < (b)) ? (a) : (b))
252 1.1 bouyer
253 1.1 bouyer void
254 1.1 bouyer bread(blkno, buf, size)
255 1.1 bouyer daddr_t blkno;
256 1.1 bouyer char *buf;
257 1.1 bouyer int size;
258 1.1 bouyer {
259 1.4.6.2 he int osize = size;
260 1.1 bouyer daddr_t oblkno = blkno;
261 1.1 bouyer char *obuf = buf;
262 1.1 bouyer daddr_t numBlocks = (size + dev_bsize -1) / dev_bsize;
263 1.1 bouyer
264 1.1 bouyer #ifdef STATS
265 1.1 bouyer nreads++;
266 1.1 bouyer readsize += size;
267 1.1 bouyer #endif
268 1.1 bouyer
269 1.1 bouyer if (!shareBuffer) {
270 1.1 bouyer rawread(blkno, buf, size);
271 1.1 bouyer return;
272 1.1 bouyer }
273 1.1 bouyer
274 1.1 bouyer if (flock(diskfd, LOCK_EX)) {
275 1.1 bouyer msg("flock(LOCK_EX) failed: %s\n",
276 1.1 bouyer strerror(errno));
277 1.1 bouyer rawread(blkno, buf, size);
278 1.1 bouyer return;
279 1.1 bouyer }
280 1.1 bouyer
281 1.1 bouyer retry:
282 1.1 bouyer while(size > 0) {
283 1.4.6.2 he int i;
284 1.4.6.2 he
285 1.1 bouyer for (i = 0; i < cachebufs; i++) {
286 1.1 bouyer struct cdesc *curr = &cdesc[i];
287 1.1 bouyer
288 1.1 bouyer #ifdef DIAGNOSTICS
289 1.1 bouyer if (curr->owner) {
290 1.1 bouyer fprintf(stderr, "Owner is set (%d, me=%d), can"
291 1.1 bouyer "not happen.\n", curr->owner, getpid());
292 1.1 bouyer }
293 1.1 bouyer #endif
294 1.1 bouyer
295 1.1 bouyer if (curr->blkend == 0)
296 1.1 bouyer continue;
297 1.1 bouyer /*
298 1.1 bouyer * If we find a bit of the read in the buffers,
299 1.1 bouyer * now compute how many blocks we can copy,
300 1.1 bouyer * copy them out, adjust blkno, buf and size,
301 1.1 bouyer * and restart
302 1.1 bouyer */
303 1.1 bouyer if (curr->blkstart <= blkno &&
304 1.1 bouyer blkno < curr->blkend) {
305 1.1 bouyer /* Number of data blocks to be copied */
306 1.1 bouyer int toCopy = min(size,
307 1.1 bouyer (curr->blkend - blkno) * dev_bsize);
308 1.1 bouyer #ifdef DIAGNOSTICS
309 1.1 bouyer if (toCopy <= 0 ||
310 1.1 bouyer toCopy > nblksread * dev_bsize) {
311 1.1 bouyer fprintf(stderr, "toCopy %d !\n",
312 1.1 bouyer toCopy);
313 1.1 bouyer dumpabort(0);
314 1.1 bouyer }
315 1.1 bouyer if (CDATA(i) + (blkno - curr->blkstart) *
316 1.1 bouyer dev_bsize < CDATA(i) ||
317 1.1 bouyer CDATA(i) + (blkno - curr->blkstart) *
318 1.1 bouyer dev_bsize >
319 1.1 bouyer CDATA(i) + nblksread * dev_bsize) {
320 1.1 bouyer fprintf(stderr, "%p < %p !!!\n",
321 1.1 bouyer CDATA(i) + (blkno -
322 1.1 bouyer curr->blkstart) * dev_bsize,
323 1.1 bouyer CDATA(i));
324 1.1 bouyer fprintf(stderr, "cdesc[i].blkstart %d "
325 1.4.6.2 he "blkno %d dev_bsize %ld\n",
326 1.1 bouyer curr->blkstart, blkno, dev_bsize);
327 1.1 bouyer dumpabort(0);
328 1.1 bouyer }
329 1.1 bouyer #endif
330 1.1 bouyer memcpy(buf, CDATA(i) +
331 1.1 bouyer (blkno - curr->blkstart) * dev_bsize,
332 1.1 bouyer toCopy);
333 1.1 bouyer
334 1.1 bouyer buf += toCopy;
335 1.1 bouyer size -= toCopy;
336 1.1 bouyer blkno += (toCopy + dev_bsize - 1) / dev_bsize;
337 1.1 bouyer numBlocks -=
338 1.1 bouyer (toCopy + dev_bsize - 1) / dev_bsize;
339 1.1 bouyer
340 1.1 bouyer curr->time = cheader->count++;
341 1.1 bouyer
342 1.1 bouyer /*
343 1.1 bouyer * If all data of a cache block have been
344 1.1 bouyer * read, chances are good no more reads
345 1.1 bouyer * will occur, so expire the cache immediately
346 1.1 bouyer */
347 1.1 bouyer
348 1.1 bouyer curr->blocksRead +=
349 1.1 bouyer (toCopy + dev_bsize -1) / dev_bsize;
350 1.1 bouyer if (curr->blocksRead >= nblksread)
351 1.1 bouyer curr->time = 0;
352 1.1 bouyer
353 1.1 bouyer goto retry;
354 1.1 bouyer }
355 1.1 bouyer }
356 1.1 bouyer
357 1.1 bouyer /* No more to do? */
358 1.1 bouyer if (size == 0)
359 1.1 bouyer break;
360 1.4.6.2 he
361 1.1 bouyer /*
362 1.1 bouyer * This does actually not happen if fs blocks are not greater
363 1.1 bouyer * than nblksread.
364 1.1 bouyer */
365 1.4.6.2 he if (numBlocks > nblksread || blkno >= ufsib->ufs_dsize) {
366 1.1 bouyer rawread(oblkno, obuf, osize);
367 1.1 bouyer break;
368 1.1 bouyer } else {
369 1.4.6.2 he int idx;
370 1.4.6.2 he ssize_t rsize;
371 1.4.6.2 he daddr_t blockBlkNo;
372 1.1 bouyer
373 1.1 bouyer blockBlkNo = (blkno / nblksread) * nblksread;
374 1.1 bouyer idx = findlru();
375 1.1 bouyer rsize = min(nblksread,
376 1.4 perseant ufsib->ufs_dsize - blockBlkNo) *
377 1.1 bouyer dev_bsize;
378 1.3 perseant
379 1.1 bouyer #ifdef DIAGNOSTICS
380 1.1 bouyer if (cdesc[idx].owner)
381 1.1 bouyer fprintf(stderr, "Owner is set (%d, me=%d), can"
382 1.1 bouyer "not happen(2).\n", cdesc[idx].owner,
383 1.1 bouyer getpid());
384 1.1 bouyer cdesc[idx].owner = getpid();
385 1.1 bouyer #endif
386 1.1 bouyer cdesc[idx].time = cheader->count++;
387 1.1 bouyer cdesc[idx].blkstart = blockBlkNo;
388 1.1 bouyer cdesc[idx].blocksRead = 0;
389 1.1 bouyer
390 1.1 bouyer if (lseek(diskfd,
391 1.1 bouyer ((off_t) (blockBlkNo) << dev_bshift), 0) < 0) {
392 1.1 bouyer msg("readBlocks: lseek fails: %s\n",
393 1.1 bouyer strerror(errno));
394 1.1 bouyer rsize = -1;
395 1.1 bouyer } else {
396 1.1 bouyer rsize = read(diskfd, CDATA(idx), rsize);
397 1.1 bouyer if (rsize < 0) {
398 1.1 bouyer msg("readBlocks: read fails: %s\n",
399 1.1 bouyer strerror(errno));
400 1.1 bouyer }
401 1.1 bouyer }
402 1.1 bouyer
403 1.1 bouyer /* On errors, panic, punt, try to read without
404 1.1 bouyer * cache and let raw read routine do the rest.
405 1.1 bouyer */
406 1.1 bouyer
407 1.1 bouyer if (rsize <= 0) {
408 1.1 bouyer rawread(oblkno, obuf, osize);
409 1.1 bouyer #ifdef DIAGNOSTICS
410 1.1 bouyer if (cdesc[idx].owner != getpid())
411 1.1 bouyer fprintf(stderr, "Owner changed from "
412 1.1 bouyer "%d to %d, can't happen\n",
413 1.1 bouyer getpid(), cdesc[idx].owner);
414 1.1 bouyer cdesc[idx].owner = 0;
415 1.1 bouyer #endif
416 1.1 bouyer break;
417 1.1 bouyer }
418 1.1 bouyer
419 1.1 bouyer /* On short read, just note the fact and go on */
420 1.1 bouyer cdesc[idx].blkend = blockBlkNo + rsize / dev_bsize;
421 1.1 bouyer
422 1.1 bouyer #ifdef STATS
423 1.1 bouyer nphysread++;
424 1.1 bouyer physreadsize += rsize;
425 1.1 bouyer #endif
426 1.1 bouyer #ifdef DIAGNOSTICS
427 1.1 bouyer if (cdesc[idx].owner != getpid())
428 1.1 bouyer fprintf(stderr, "Owner changed from "
429 1.1 bouyer "%d to %d, can't happen\n",
430 1.1 bouyer getpid(), cdesc[idx].owner);
431 1.1 bouyer cdesc[idx].owner = 0;
432 1.1 bouyer #endif
433 1.1 bouyer /*
434 1.1 bouyer * We swapped some of data in, let the loop fetch
435 1.1 bouyer * them from cache
436 1.1 bouyer */
437 1.1 bouyer }
438 1.1 bouyer }
439 1.4.6.2 he
440 1.1 bouyer if (flock(diskfd, LOCK_UN))
441 1.1 bouyer msg("flock(LOCK_UN) failed: %s\n",
442 1.1 bouyer strerror(errno));
443 1.1 bouyer return;
444 1.1 bouyer }
445 1.1 bouyer
446 1.1 bouyer /*-----------------------------------------------------------------------*/
447 1.1 bouyer void
448 1.1 bouyer printcachestats()
449 1.1 bouyer {
450 1.1 bouyer #ifdef STATS
451 1.1 bouyer fprintf(stderr, "Pid %d: %d reads (%u bytes) "
452 1.1 bouyer "%d physical reads (%u bytes) %d%% hits, %d%% overhead\n",
453 1.1 bouyer getpid(), nreads, (u_int) readsize, nphysread,
454 1.1 bouyer (u_int) physreadsize, (nreads - nphysread) * 100 / nreads,
455 1.1 bouyer (int) (((physreadsize - readsize) * 100) / readsize));
456 1.1 bouyer #endif
457 1.1 bouyer }
458 1.1 bouyer
459 1.1 bouyer /*-----------------------------------------------------------------------*/
460