inode.c revision 1.63 1 /* $NetBSD: inode.c,v 1.63 2015/09/01 06:16:58 dholland Exp $ */
2
3 /*-
4 * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Konrad E. Schroder <perseant (at) hhhh.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /*
33 * Copyright (c) 1980, 1986, 1993
34 * The Regents of the University of California. All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 */
60
61 #include <sys/types.h>
62 #include <sys/param.h>
63 #include <sys/time.h>
64 #include <sys/buf.h>
65 #include <sys/mount.h>
66
67 #define vnode uvnode
68 #include <ufs/lfs/lfs.h>
69 #include <ufs/lfs/lfs_accessors.h>
70 #include <ufs/lfs/lfs_inode.h>
71 #undef vnode
72
73 #include <err.h>
74 #ifndef SMALL
75 #include <pwd.h>
76 #endif
77 #include <stdio.h>
78 #include <stdlib.h>
79 #include <string.h>
80 #include <util.h>
81
82 #include "bufcache.h"
83 #include "vnode.h"
84 #include "lfs_user.h"
85
86 #include "fsck.h"
87 #include "fsutil.h"
88 #include "extern.h"
89
90 static int iblock(struct inodesc *, long, u_int64_t);
91 int blksreqd(struct lfs *, int);
92 int lfs_maxino(void);
93
94 /*
95 * Get a dinode of a given inum.
96 * XXX combine this function with vget.
97 */
98 union lfs_dinode *
99 ginode(ino_t ino)
100 {
101 struct uvnode *vp;
102 struct ubuf *bp;
103 IFILE *ifp;
104 daddr_t daddr;
105 unsigned segno;
106
107 vp = vget(fs, ino);
108 if (vp == NULL)
109 return NULL;
110
111 if (din_table[ino] == 0x0) {
112 LFS_IENTRY(ifp, fs, ino, bp);
113 daddr = lfs_if_getdaddr(fs, ifp);
114 segno = lfs_dtosn(fs, daddr);
115 din_table[ino] = daddr;
116 seg_table[segno].su_nbytes += DINOSIZE(fs);
117 brelse(bp, 0);
118 }
119 return VTOI(vp)->i_din;
120 }
121
122 /*
123 * Check validity of held blocks in an inode, recursing through all blocks.
124 */
125 int
126 ckinode(union lfs_dinode *dp, struct inodesc *idesc)
127 {
128 daddr_t lbn, pbn;
129 long ret, n, ndb, offset;
130 union lfs_dinode dino;
131 u_int64_t remsize, sizepb;
132 mode_t mode;
133 char pathbuf[MAXPATHLEN + 1];
134 struct uvnode *vp, *thisvp;
135
136 if (idesc->id_fix != IGNORE)
137 idesc->id_fix = DONTKNOW;
138 idesc->id_entryno = 0;
139 idesc->id_filesize = lfs_dino_getsize(fs, dp);
140 mode = lfs_dino_getmode(fs, dp) & LFS_IFMT;
141 if (mode == LFS_IFBLK || mode == LFS_IFCHR ||
142 (mode == LFS_IFLNK && (lfs_dino_getsize(fs, dp) < lfs_sb_getmaxsymlinklen(fs) ||
143 (lfs_sb_getmaxsymlinklen(fs) == 0 &&
144 lfs_dino_getblocks(fs, dp) == 0))))
145 return (KEEPON);
146 /* XXX is this safe if we're 32-bit? */
147 dino = *dp;
148 ndb = howmany(lfs_dino_getsize(fs, &dino), lfs_sb_getbsize(fs));
149
150 thisvp = vget(fs, idesc->id_number);
151 for (lbn = 0; lbn < ULFS_NDADDR; lbn++) {
152 pbn = lfs_dino_getdb(fs, &dino, lbn);
153 if (thisvp)
154 idesc->id_numfrags =
155 lfs_numfrags(fs, VTOI(thisvp)->i_lfs_fragsize[lbn]);
156 else {
157 if (--ndb == 0 && (offset = lfs_blkoff(fs, lfs_dino_getsize(fs, &dino))) != 0) {
158 idesc->id_numfrags =
159 lfs_numfrags(fs, lfs_fragroundup(fs, offset));
160 } else
161 idesc->id_numfrags = lfs_sb_getfrag(fs);
162 }
163 if (pbn == 0) {
164 if (idesc->id_type == DATA && ndb >= 0) {
165 /* An empty block in a directory XXX */
166 getpathname(pathbuf, sizeof(pathbuf),
167 idesc->id_number, idesc->id_number);
168 pfatal("DIRECTORY %s INO %lld: CONTAINS EMPTY BLOCKS [1]",
169 pathbuf, (long long)idesc->id_number);
170 if (reply("ADJUST LENGTH") == 1) {
171 vp = vget(fs, idesc->id_number);
172 dp = VTOD(vp);
173 lfs_dino_setsize(fs, dp,
174 lbn * lfs_sb_getbsize(fs));
175 printf(
176 "YOU MUST RERUN FSCK AFTERWARDS\n");
177 rerun = 1;
178 inodirty(VTOI(vp));
179 } else
180 break;
181 }
182 continue;
183 }
184 idesc->id_blkno = pbn;
185 idesc->id_lblkno = lbn;
186 if (idesc->id_type == ADDR) {
187 ret = (*idesc->id_func) (idesc);
188 } else
189 ret = dirscan(idesc);
190 if (ret & STOP)
191 return (ret);
192 }
193 idesc->id_numfrags = lfs_sb_getfrag(fs);
194 remsize = lfs_dino_getsize(fs, &dino) - lfs_sb_getbsize(fs) * ULFS_NDADDR;
195 sizepb = lfs_sb_getbsize(fs);
196 for (n = 1; n <= ULFS_NIADDR; n++) {
197 pbn = lfs_dino_getib(fs, &dino, n-1);
198 if (pbn) {
199 idesc->id_blkno = pbn;
200 ret = iblock(idesc, n, remsize);
201 if (ret & STOP)
202 return (ret);
203 } else {
204 if (idesc->id_type == DATA && remsize > 0) {
205 /* An empty block in a directory XXX */
206 getpathname(pathbuf, sizeof(pathbuf),
207 idesc->id_number, idesc->id_number);
208 pfatal("DIRECTORY %s INO %lld: CONTAINS EMPTY BLOCKS [2]",
209 pathbuf, (long long)idesc->id_number);
210 if (reply("ADJUST LENGTH") == 1) {
211 vp = vget(fs, idesc->id_number);
212 dp = VTOD(vp);
213 lfs_dino_setsize(fs, dp,
214 lfs_dino_getsize(fs, dp) - remsize);
215 remsize = 0;
216 printf(
217 "YOU MUST RERUN FSCK AFTERWARDS\n");
218 rerun = 1;
219 inodirty(VTOI(vp));
220 break;
221 } else
222 break;
223 }
224 }
225 sizepb *= LFS_NINDIR(fs);
226 remsize -= sizepb;
227 }
228 return (KEEPON);
229 }
230
231 static int
232 iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
233 {
234 unsigned j, maxindir;
235 daddr_t found;
236 struct ubuf *bp;
237 int i, n, (*func) (struct inodesc *), nif;
238 u_int64_t sizepb;
239 char pathbuf[MAXPATHLEN + 1], buf[BUFSIZ];
240 struct uvnode *devvp, *vp;
241 int diddirty = 0;
242
243 if (idesc->id_type == ADDR) {
244 func = idesc->id_func;
245 n = (*func) (idesc);
246 if ((n & KEEPON) == 0)
247 return (n);
248 } else
249 func = dirscan;
250 if (chkrange(idesc->id_blkno, idesc->id_numfrags))
251 return (SKIP);
252
253 devvp = fs->lfs_devvp;
254 bread(devvp, LFS_FSBTODB(fs, idesc->id_blkno), lfs_sb_getbsize(fs),
255 0, &bp);
256 ilevel--;
257 for (sizepb = lfs_sb_getbsize(fs), i = 0; i < ilevel; i++)
258 sizepb *= LFS_NINDIR(fs);
259 if (isize > sizepb * LFS_NINDIR(fs))
260 nif = LFS_NINDIR(fs);
261 else
262 nif = howmany(isize, sizepb);
263 if (idesc->id_func == pass1check && nif < LFS_NINDIR(fs)) {
264 maxindir = LFS_NINDIR(fs);
265 for (j = nif; j < maxindir; j++) {
266 found = lfs_iblock_get(fs, bp->b_data, j);
267 if (found == 0)
268 continue;
269 (void)snprintf(buf, sizeof(buf),
270 "PARTIALLY TRUNCATED INODE I=%llu",
271 (unsigned long long)idesc->id_number);
272 if (dofix(idesc, buf)) {
273 lfs_iblock_set(fs, bp->b_data, j, 0);
274 ++diddirty;
275 }
276 }
277 }
278 maxindir = nif;
279 for (j = 0; j < maxindir; j++) {
280 found = lfs_iblock_get(fs, bp->b_data, j);
281 if (found) {
282 idesc->id_blkno = found;
283 if (ilevel == 0) {
284 /*
285 * dirscan needs lfs_lblkno.
286 */
287 idesc->id_lblkno++;
288 n = (*func) (idesc);
289 } else {
290 n = iblock(idesc, ilevel, isize);
291 }
292 if (n & STOP) {
293 if (diddirty)
294 VOP_BWRITE(bp);
295 else
296 brelse(bp, 0);
297 return (n);
298 }
299 } else {
300 if (idesc->id_type == DATA && isize > 0) {
301 /* An empty block in a directory XXX */
302 getpathname(pathbuf, sizeof(pathbuf),
303 idesc->id_number, idesc->id_number);
304 pfatal("DIRECTORY %s INO %lld: CONTAINS EMPTY BLOCKS [3]",
305 pathbuf, (long long)idesc->id_number);
306 if (reply("ADJUST LENGTH") == 1) {
307 vp = vget(fs, idesc->id_number);
308 lfs_dino_setsize(fs, VTOI(vp)->i_din,
309 lfs_dino_getsize(fs,
310 VTOI(vp)->i_din)
311 - isize);
312 isize = 0;
313 printf(
314 "YOU MUST RERUN FSCK AFTERWARDS\n");
315 rerun = 1;
316 inodirty(VTOI(vp));
317 if (diddirty)
318 VOP_BWRITE(bp);
319 else
320 brelse(bp, 0);
321 return (STOP);
322 }
323 }
324 }
325 isize -= sizepb;
326 }
327 if (diddirty)
328 VOP_BWRITE(bp);
329 else
330 brelse(bp, 0);
331 return (KEEPON);
332 }
333
334 /*
335 * Check that a block in a legal block number.
336 * Return 0 if in range, 1 if out of range.
337 */
338 int
339 chkrange(daddr_t blk, int cnt)
340 {
341 if (blk < lfs_sntod(fs, 0)) {
342 return (1);
343 }
344 if (blk > maxfsblock) {
345 return (1);
346 }
347 if (blk + cnt < lfs_sntod(fs, 0)) {
348 return (1);
349 }
350 if (blk + cnt > maxfsblock) {
351 return (1);
352 }
353 return (0);
354 }
355
356 /*
357 * Routines to maintain information about directory inodes.
358 * This is built during the first pass and used during the
359 * second and third passes.
360 *
361 * Enter inodes into the cache.
362 */
363 void
364 cacheino(union lfs_dinode *dp, ino_t inumber)
365 {
366 struct inoinfo *inp;
367 struct inoinfo **inpp, **ninpsort;
368 unsigned int blks, i;
369
370 blks = howmany(lfs_dino_getsize(fs, dp), lfs_sb_getbsize(fs));
371 if (blks > ULFS_NDADDR)
372 blks = ULFS_NDADDR + ULFS_NIADDR;
373 inp = emalloc(sizeof(*inp) + (blks - 1) * sizeof(inp->i_blks[0]));
374 inpp = &inphead[inumber % numdirs];
375 inp->i_nexthash = *inpp;
376 *inpp = inp;
377 inp->i_child = inp->i_sibling = inp->i_parentp = 0;
378 if (inumber == ULFS_ROOTINO)
379 inp->i_parent = ULFS_ROOTINO;
380 else
381 inp->i_parent = (ino_t) 0;
382 inp->i_dotdot = (ino_t) 0;
383 inp->i_number = inumber;
384 inp->i_isize = lfs_dino_getsize(fs, dp);
385
386 inp->i_numblks = blks * sizeof(inp->i_blks[0]);
387 for (i=0; i<blks && i<ULFS_NDADDR; i++) {
388 inp->i_blks[i] = lfs_dino_getdb(fs, dp, i);
389 }
390 for (; i<blks; i++) {
391 inp->i_blks[i] = lfs_dino_getib(fs, dp, i - ULFS_NDADDR);
392 }
393 if (inplast == listmax) {
394 ninpsort = erealloc(inpsort,
395 (listmax + 100) * sizeof(struct inoinfo *));
396 inpsort = ninpsort;
397 listmax += 100;
398 }
399 inpsort[inplast++] = inp;
400 }
401
402 /*
403 * Look up an inode cache structure.
404 */
405 struct inoinfo *
406 getinoinfo(ino_t inumber)
407 {
408 struct inoinfo *inp;
409
410 for (inp = inphead[inumber % numdirs]; inp; inp = inp->i_nexthash) {
411 if (inp->i_number != inumber)
412 continue;
413 return (inp);
414 }
415 err(EEXIT, "cannot find inode %llu", (unsigned long long)inumber);
416 return ((struct inoinfo *) 0);
417 }
418
419 /*
420 * Clean up all the inode cache structure.
421 */
422 void
423 inocleanup(void)
424 {
425 struct inoinfo **inpp;
426
427 if (inphead == NULL)
428 return;
429 for (inpp = &inpsort[inplast - 1]; inpp >= inpsort; inpp--)
430 free((char *) (*inpp));
431 free((char *) inphead);
432 free((char *) inpsort);
433 inphead = inpsort = NULL;
434 }
435
436 void
437 inodirty(struct inode *ip)
438 {
439 ip->i_flag |= IN_MODIFIED;
440 }
441
442 void
443 clri(struct inodesc * idesc, const char *type, int flag)
444 {
445 struct uvnode *vp;
446
447 vp = vget(fs, idesc->id_number);
448 if (flag & 0x1) {
449 pwarn("%s %s", type,
450 (lfs_dino_getmode(fs, VTOI(vp)->i_din) & LFS_IFMT) == LFS_IFDIR ? "DIR" : "FILE");
451 pinode(idesc->id_number);
452 }
453 if ((flag & 0x2) || preen || reply("CLEAR") == 1) {
454 if (preen && flag != 2)
455 printf(" (CLEARED)\n");
456 n_files--;
457 (void) ckinode(VTOD(vp), idesc);
458 clearinode(idesc->id_number);
459 statemap[idesc->id_number] = USTATE;
460 vnode_destroy(vp);
461 return;
462 }
463 return;
464 }
465
466 void
467 clearinode(ino_t inumber)
468 {
469 struct ubuf *bp;
470 IFILE *ifp;
471 daddr_t daddr;
472
473 /* Send cleared inode to the free list */
474
475 LFS_IENTRY(ifp, fs, inumber, bp);
476 daddr = lfs_if_getdaddr(fs, ifp);
477 if (daddr == LFS_UNUSED_DADDR) {
478 brelse(bp, 0);
479 return;
480 }
481 lfs_if_setdaddr(fs, ifp, LFS_UNUSED_DADDR);
482 lfs_if_setnextfree(fs, ifp, lfs_sb_getfreehd(fs));
483 lfs_sb_setfreehd(fs, inumber);
484 sbdirty();
485 VOP_BWRITE(bp);
486
487 /*
488 * update segment usage.
489 */
490 if (daddr != LFS_UNUSED_DADDR) {
491 SEGUSE *sup;
492 u_int32_t oldsn = lfs_dtosn(fs, daddr);
493
494 seg_table[oldsn].su_nbytes -= DINOSIZE(fs);
495 LFS_SEGENTRY(sup, fs, oldsn, bp);
496 sup->su_nbytes -= DINOSIZE(fs);
497 LFS_WRITESEGENTRY(sup, fs, oldsn, bp); /* Ifile */
498 }
499 }
500
501 int
502 findname(struct inodesc * idesc)
503 {
504 struct lfs_direct *dirp = idesc->id_dirp;
505 size_t len;
506 char *buf;
507
508 if (dirp->d_ino != idesc->id_parent)
509 return (KEEPON);
510 len = lfs_dir_getnamlen(fs, dirp) + 1;
511 /* XXX this is wrong: namlen+1 can be up to MAXPATHLEN+1 */
512 if (len > MAXPATHLEN) {
513 /* Truncate it but don't overflow the buffer */
514 /* XXX: this case doesn't null-terminate the result */
515 len = MAXPATHLEN;
516 }
517 /* this is namebuf with utils.h */
518 buf = __UNCONST(idesc->id_name);
519 (void)memcpy(buf, dirp->d_name, len);
520 return (STOP | FOUND);
521 }
522
523 int
524 findino(struct inodesc * idesc)
525 {
526 struct lfs_direct *dirp = idesc->id_dirp;
527
528 if (dirp->d_ino == 0)
529 return (KEEPON);
530 if (strcmp(dirp->d_name, idesc->id_name) == 0 &&
531 dirp->d_ino >= ULFS_ROOTINO && dirp->d_ino < maxino) {
532 idesc->id_parent = dirp->d_ino;
533 return (STOP | FOUND);
534 }
535 return (KEEPON);
536 }
537
538 void
539 pinode(ino_t ino)
540 {
541 union lfs_dinode *dp;
542 struct passwd *pw;
543
544 printf(" I=%llu ", (unsigned long long)ino);
545 if (ino < ULFS_ROOTINO || ino >= maxino)
546 return;
547 dp = ginode(ino);
548 if (dp) {
549 printf(" OWNER=");
550 #ifndef SMALL
551 if (Uflag && (pw = getpwuid(lfs_dino_getuid(fs, dp))) != 0)
552 printf("%s ", pw->pw_name);
553 else
554 #endif
555 printf("%u ", (unsigned)lfs_dino_getuid(fs, dp));
556 printf("MODE=%o\n", lfs_dino_getmode(fs, dp));
557 if (preen)
558 printf("%s: ", cdevname());
559 printf("SIZE=%ju ", (uintmax_t) lfs_dino_getsize(fs, dp));
560 printf("MTIME=%s ", print_mtime(lfs_dino_getmtime(fs, dp)));
561 }
562 }
563
564 void
565 blkerror(ino_t ino, const char *type, daddr_t blk)
566 {
567
568 pfatal("%lld %s I=%llu", (long long) blk, type,
569 (unsigned long long)ino);
570 printf("\n");
571 if (exitonfail)
572 exit(1);
573 switch (statemap[ino]) {
574
575 case FSTATE:
576 statemap[ino] = FCLEAR;
577 return;
578
579 case DSTATE:
580 statemap[ino] = DCLEAR;
581 return;
582
583 case FCLEAR:
584 case DCLEAR:
585 return;
586
587 default:
588 err(EEXIT, "BAD STATE %d TO BLKERR", statemap[ino]);
589 /* NOTREACHED */
590 }
591 }
592
593 /*
594 * allocate an unused inode
595 */
596 ino_t
597 allocino(ino_t request, int type)
598 {
599 ino_t ino;
600 union lfs_dinode *dp;
601 time_t t;
602 struct uvnode *vp;
603 struct ubuf *bp;
604
605 if (request == 0)
606 request = ULFS_ROOTINO;
607 else if (statemap[request] != USTATE)
608 return (0);
609 for (ino = request; ino < maxino; ino++)
610 if (statemap[ino] == USTATE)
611 break;
612 if (ino == maxino)
613 extend_ifile(fs);
614
615 switch (type & LFS_IFMT) {
616 case LFS_IFDIR:
617 statemap[ino] = DSTATE;
618 break;
619 case LFS_IFREG:
620 case LFS_IFLNK:
621 statemap[ino] = FSTATE;
622 break;
623 default:
624 return (0);
625 }
626 vp = lfs_valloc(fs, ino);
627 if (vp == NULL)
628 return (0);
629 dp = VTOI(vp)->i_din;
630 bp = getblk(vp, 0, lfs_sb_getfsize(fs));
631 VOP_BWRITE(bp);
632 lfs_dino_setmode(fs, dp, type);
633 (void) time(&t);
634 lfs_dino_setatime(fs, dp, t);
635 lfs_dino_setctime(fs, dp, t);
636 lfs_dino_setmtime(fs, dp, t);
637 lfs_dino_setsize(fs, dp, lfs_sb_getfsize(fs));
638 lfs_dino_setblocks(fs, dp, lfs_btofsb(fs, lfs_sb_getfsize(fs)));
639 n_files++;
640 inodirty(VTOI(vp));
641 typemap[ino] = LFS_IFTODT(type);
642 return (ino);
643 }
644
645 /*
646 * deallocate an inode
647 */
648 void
649 freeino(ino_t ino)
650 {
651 struct inodesc idesc;
652 struct uvnode *vp;
653
654 memset(&idesc, 0, sizeof(struct inodesc));
655 idesc.id_type = ADDR;
656 idesc.id_func = pass4check;
657 idesc.id_number = ino;
658 vp = vget(fs, ino);
659 (void) ckinode(VTOD(vp), &idesc);
660 clearinode(ino);
661 statemap[ino] = USTATE;
662 vnode_destroy(vp);
663
664 n_files--;
665 }
666