2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 1980, 1986, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
37 #include <sys/cdefs.h>
38 __FBSDID("$FreeBSD$");
40 #include <sys/param.h>
42 #include <sys/types.h>
43 #include <sys/sysctl.h>
45 #include <ufs/ufs/dinode.h>
46 #include <ufs/ufs/dir.h>
47 #include <ufs/ffs/fs.h>
54 static struct dirtemplate emptydir = {
55 0, DIRBLKSIZ, DT_UNKNOWN, 0, "",
56 0, 0, DT_UNKNOWN, 0, ""
58 static struct dirtemplate dirhead = {
59 0, 12, DT_DIR, 1, ".",
60 0, DIRBLKSIZ - 12, DT_DIR, 2, ".."
63 static int chgino(struct inodesc *);
64 static int dircheck(struct inodesc *, struct bufarea *, struct direct *);
65 static int expanddir(struct inode *ip, char *name);
66 static void freedir(ino_t ino, ino_t parent);
67 static struct direct *fsck_readdir(struct inodesc *);
68 static struct bufarea *getdirblk(ufs2_daddr_t blkno, long size);
69 static int lftempname(char *bufp, ino_t ino);
70 static int mkentry(struct inodesc *);
73 * Propagate connected state through the tree.
78 struct inoinfo **inpp, *inp;
79 struct inoinfo **inpend;
82 inpend = &inpsort[inplast];
85 for (inpp = inpsort; inpp < inpend; inpp++) {
87 if (inp->i_parent == 0)
89 if (inoinfo(inp->i_parent)->ino_state == DFOUND &&
90 INO_IS_DUNFOUND(inp->i_number)) {
91 inoinfo(inp->i_number)->ino_state = DFOUND;
99 * Scan each entry in a directory block.
102 dirscan(struct inodesc *idesc)
108 char dbuf[DIRBLKSIZ];
110 if (idesc->id_type != DATA)
111 errx(EEXIT, "wrong type to dirscan %d", idesc->id_type);
112 if (idesc->id_entryno == 0 &&
113 (idesc->id_filesize & (DIRBLKSIZ - 1)) != 0)
114 idesc->id_filesize = roundup(idesc->id_filesize, DIRBLKSIZ);
115 blksiz = idesc->id_numfrags * sblock.fs_fsize;
116 if (chkrange(idesc->id_blkno, idesc->id_numfrags)) {
117 idesc->id_filesize -= blksiz;
121 for (dp = fsck_readdir(idesc); dp != NULL; dp = fsck_readdir(idesc)) {
122 dsize = dp->d_reclen;
123 if (dsize > sizeof(dbuf))
124 dsize = sizeof(dbuf);
125 memmove(dbuf, dp, (size_t)dsize);
126 idesc->id_dirp = (struct direct *)dbuf;
127 if ((n = (*idesc->id_func)(idesc)) & ALTERED) {
128 bp = getdirblk(idesc->id_blkno, blksiz);
131 memmove(bp->b_un.b_buf + idesc->id_loc - dsize, dbuf,
139 return (idesc->id_filesize > 0 ? KEEPON : STOP);
143 * Get and verify the next entry in a directory.
144 * We also verify that if there is another entry in the block that it is
145 * valid, so if it is not valid it can be subsumed into the current entry.
147 static struct direct *
148 fsck_readdir(struct inodesc *idesc)
150 struct direct *dp, *ndp;
152 long size, blksiz, subsume_ndp;
155 blksiz = idesc->id_numfrags * sblock.fs_fsize;
156 if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz)
158 bp = getdirblk(idesc->id_blkno, blksiz);
161 dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc);
163 * Only need to check current entry if it is the first in the
164 * the block, as later entries will have been checked in the
165 * previous call to this function.
167 if (idesc->id_loc % DIRBLKSIZ != 0 || dircheck(idesc, bp, dp) != 0) {
169 * Current entry is good, update to point at next.
171 idesc->id_loc += dp->d_reclen;
172 idesc->id_filesize -= dp->d_reclen;
174 * If at end of directory block, just return this entry.
176 if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz ||
177 idesc->id_loc % DIRBLKSIZ == 0)
180 * If the next entry good, return this entry.
182 ndp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc);
183 if (dircheck(idesc, bp, ndp) != 0)
186 * The next entry is bad, so subsume it and the remainder
187 * of this directory block into this entry.
192 * Current or next entry is bad. Zap current entry or
193 * subsume next entry into current entry as appropriate.
195 size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
196 idesc->id_loc += size;
197 idesc->id_filesize -= size;
198 if (idesc->id_fix == IGNORE)
201 memset(ndp, 0, size);
202 dp->d_reclen += size;
207 if (dofix(idesc, "DIRECTORY CORRUPTED"))
213 * Verify that a directory entry is valid.
214 * This is a superset of the checks made in the kernel.
215 * Also optionally clears padding and unused directory space.
217 * Returns 0 if the entry is bad, 1 if the entry is good.
220 dircheck(struct inodesc *idesc, struct bufarea *bp, struct direct *dp)
225 int spaceleft, modified, unused;
227 spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
228 size = DIRSIZ(0, dp);
229 if (dp->d_reclen == 0 ||
230 dp->d_reclen > spaceleft ||
231 dp->d_reclen < size ||
232 idesc->id_filesize < size ||
233 (dp->d_reclen & (DIR_ROUNDUP - 1)) != 0)
236 if (dp->d_ino == 0) {
237 if (!zflag || fswritefd < 0)
240 * Special case of an unused directory entry. Normally only
241 * occurs at the beginning of a directory block when the block
242 * contains no entries. Other than the first entry in a
243 * directory block, the kernel coalesces unused space with
244 * the previous entry by extending its d_reclen. However,
245 * when cleaning up a directory, fsck may set d_ino to zero
246 * in the middle of a directory block. If we're clearing out
247 * directory cruft (-z flag), then make sure that all directory
248 * space in entries with d_ino == 0 gets fully cleared.
250 if (dp->d_type != 0) {
254 if (dp->d_namlen != 0) {
258 unused = dp->d_reclen - __offsetof(struct direct, d_name);
259 for (cp = dp->d_name; unused > 0; unused--, cp++) {
270 * The d_type field should not be tested here. A bad type is an error
271 * in the entry itself but is not a corruption of the directory
272 * structure itself. So blowing away all the remaining entries in the
273 * directory block is inappropriate. Rather the type error should be
274 * checked in pass1 and fixed there.
276 * The name validation should also be done in pass1 although the
277 * check to see if the name is longer than fits in the space
278 * allocated for it (i.e., the *cp != '\0' fails after exiting the
279 * loop below) then it really is a structural error that requires
280 * the stronger action taken here.
282 namlen = dp->d_namlen;
283 if (namlen == 0 || dp->d_type > 15)
285 for (cp = dp->d_name, size = 0; size < namlen; size++) {
286 if (*cp == '\0' || *cp++ == '/')
291 if (zflag && fswritefd >= 0) {
293 * Clear unused directory entry space, including the d_name
296 /* First figure the number of pad bytes. */
297 unused = roundup2(namlen + 1, DIR_ROUNDUP) - (namlen + 1);
299 /* Add in the free space to the end of the record. */
300 unused += dp->d_reclen - DIRSIZ(0, dp);
303 * Now clear out the unused space, keeping track if we actually
306 for (cp = &dp->d_name[namlen + 1]; unused > 0; unused--, cp++) {
320 printf("Bad dir: ino %d reclen %d namlen %d type %d name %s\n",
321 dp->d_ino, dp->d_reclen, dp->d_namlen, dp->d_type,
327 direrror(ino_t ino, const char *errmesg)
330 fileerror(ino, ino, errmesg);
334 fileerror(ino_t cwd, ino_t ino, const char *errmesg)
338 char pathbuf[MAXPATHLEN + 1];
340 pwarn("%s ", errmesg);
341 if (ino < UFS_ROOTINO || ino > maxino) {
342 pfatal("out-of-range inode number %ju", (uintmax_t)ino);
349 getpathname(pathbuf, cwd, ino);
352 (DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE",
355 pfatal("NAME=%s\n", pathbuf);
360 adjust(struct inodesc *idesc, int lcnt)
366 ginode(idesc->id_number, &ip);
368 if (DIP(dp, di_nlink) == lcnt) {
370 * If we have not hit any unresolved problems, are running
371 * in preen mode, and are on a file system using soft updates,
372 * then just toss any partially allocated files.
374 if (resolved && (preen || bkgrdflag) && usedsoftdep) {
375 clri(idesc, "UNREF", 1);
380 * The file system can be marked clean even if
381 * a file is not linked up, but is cleared.
382 * Hence, resolved should not be cleared when
383 * linkup is answered no, but clri is answered yes.
385 saveresolved = resolved;
386 if (linkup(idesc->id_number, (ino_t)0, NULL) == 0) {
387 resolved = saveresolved;
388 clri(idesc, "UNREF", 0);
393 * Account for the new reference created by linkup().
399 pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
400 ((DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE"));
402 printf(" COUNT %d SHOULD BE %d",
403 DIP(dp, di_nlink), DIP(dp, di_nlink) - lcnt);
404 if (preen || usedsoftdep) {
407 pfatal("LINK COUNT INCREASING");
410 printf(" (ADJUSTED)\n");
412 if (preen || reply("ADJUST") == 1) {
413 if (bkgrdflag == 0) {
414 DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - lcnt);
417 cmd.value = idesc->id_number;
420 printf("adjrefcnt ino %ld amt %lld\n",
422 (long long)cmd.size);
423 if (sysctl(adjrefcnt, MIBSIZE, 0, 0,
424 &cmd, sizeof cmd) == -1)
425 rwerror("ADJUST INODE", cmd.value);
433 mkentry(struct inodesc *idesc)
435 struct direct *dirp = idesc->id_dirp;
436 struct direct newent;
439 newent.d_namlen = strlen(idesc->id_name);
440 newlen = DIRSIZ(0, &newent);
441 if (dirp->d_ino != 0)
442 oldlen = DIRSIZ(0, dirp);
445 if (dirp->d_reclen - oldlen < newlen)
447 newent.d_reclen = dirp->d_reclen - oldlen;
448 dirp->d_reclen = oldlen;
449 dirp = (struct direct *)(((char *)dirp) + oldlen);
450 dirp->d_ino = idesc->id_parent; /* ino to be entered is in id_parent */
451 dirp->d_reclen = newent.d_reclen;
452 dirp->d_type = inoinfo(idesc->id_parent)->ino_type;
453 dirp->d_namlen = newent.d_namlen;
454 memmove(dirp->d_name, idesc->id_name, (size_t)newent.d_namlen + 1);
455 return (ALTERED|STOP);
459 chgino(struct inodesc *idesc)
461 struct direct *dirp = idesc->id_dirp;
463 if (memcmp(dirp->d_name, idesc->id_name, (int)dirp->d_namlen + 1))
465 dirp->d_ino = idesc->id_parent;
466 dirp->d_type = inoinfo(idesc->id_parent)->ino_type;
467 return (ALTERED|STOP);
471 linkup(ino_t orphan, ino_t parentdir, char *name)
478 struct inodesc idesc;
479 char tempname[BUFSIZ];
481 memset(&idesc, 0, sizeof(struct inodesc));
484 lostdir = (DIP(dp, di_mode) & IFMT) == IFDIR;
485 pwarn("UNREF %s ", lostdir ? "DIR" : "FILE");
488 if (preen && DIP(dp, di_size) == 0) {
493 if (cursnapshot != 0) {
494 pfatal("FILE LINKUP IN SNAPSHOT");
498 printf(" (RECONNECTED)\n");
499 else if (reply("RECONNECT") == 0)
502 ginode(UFS_ROOTINO, &ip);
503 idesc.id_name = strdup(lfname);
504 idesc.id_type = DATA;
505 idesc.id_func = findino;
506 idesc.id_number = UFS_ROOTINO;
507 if ((ckinode(ip.i_dp, &idesc) & FOUND) != 0) {
508 lfdir = idesc.id_parent;
510 pwarn("NO lost+found DIRECTORY");
511 if (preen || reply("CREATE")) {
512 lfdir = allocdir(UFS_ROOTINO, (ino_t)0, lfmode);
514 if (makeentry(UFS_ROOTINO, lfdir,
518 printf(" (CREATED)\n");
520 freedir(lfdir, UFS_ROOTINO);
530 pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY");
537 if ((DIP(dp, di_mode) & IFMT) != IFDIR) {
538 pfatal("lost+found IS NOT A DIRECTORY");
539 if (reply("REALLOCATE") == 0) {
544 if ((lfdir = allocdir(UFS_ROOTINO, (ino_t)0, lfmode)) == 0) {
545 pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
549 if ((changeino(UFS_ROOTINO, lfname, lfdir) & ALTERED) == 0) {
550 pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
554 idesc.id_type = inoinfo(oldlfdir)->ino_idtype;
555 idesc.id_func = freeblock;
556 idesc.id_number = oldlfdir;
557 adjust(&idesc, inoinfo(oldlfdir)->ino_linkcnt + 1);
558 inoinfo(oldlfdir)->ino_linkcnt = 0;
564 if (inoinfo(lfdir)->ino_state != DFOUND) {
565 pfatal("SORRY. NO lost+found DIRECTORY\n\n");
569 (void)lftempname(tempname, orphan);
570 if (makeentry(lfdir, orphan, (name ? name : tempname)) == 0) {
571 pfatal("SORRY. NO SPACE IN lost+found DIRECTORY");
576 inoinfo(orphan)->ino_linkcnt--;
578 if ((changeino(orphan, "..", lfdir) & ALTERED) == 0 &&
579 parentdir != (ino_t)-1)
580 (void)makeentry(orphan, lfdir, "..");
581 DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
583 inoinfo(lfdir)->ino_linkcnt++;
584 pwarn("DIR I=%lu CONNECTED. ", (u_long)orphan);
585 inp = getinoinfo(parentdir);
586 if (parentdir != (ino_t)-1 && inp != NULL &&
587 (inp->i_flags & INFO_NEW) == 0) {
588 printf("PARENT WAS I=%lu\n", (u_long)parentdir);
590 * If the parent directory did not have to
591 * be replaced then because of the ordering
592 * guarantees, has had the link count incremented
593 * for the child, but no entry was made. This
594 * fixes the parent link count so that fsck does
595 * not need to be rerun.
597 inoinfo(parentdir)->ino_linkcnt++;
607 * fix an entry in a directory.
610 changeino(ino_t dir, const char *name, ino_t newnum)
612 struct inodesc idesc;
616 memset(&idesc, 0, sizeof(struct inodesc));
617 idesc.id_type = DATA;
618 idesc.id_func = chgino;
619 idesc.id_number = dir;
620 idesc.id_fix = DONTKNOW;
621 idesc.id_name = strdup(name);
622 idesc.id_parent = newnum; /* new value for name */
624 error = ckinode(ip.i_dp, &idesc);
630 * make an entry in a directory
633 makeentry(ino_t parent, ino_t ino, const char *name)
637 struct inodesc idesc;
639 char pathbuf[MAXPATHLEN + 1];
641 if (parent < UFS_ROOTINO || parent >= maxino ||
642 ino < UFS_ROOTINO || ino >= maxino)
644 memset(&idesc, 0, sizeof(struct inodesc));
645 idesc.id_type = DATA;
646 idesc.id_func = mkentry;
647 idesc.id_number = parent;
648 idesc.id_parent = ino; /* this is the inode to enter */
649 idesc.id_fix = DONTKNOW;
650 idesc.id_name = strdup(name);
653 if (DIP(dp, di_size) % DIRBLKSIZ) {
654 DIP_SET(dp, di_size, roundup(DIP(dp, di_size), DIRBLKSIZ));
657 if ((ckinode(dp, &idesc) & ALTERED) != 0) {
661 getpathname(pathbuf, parent, parent);
662 if (expanddir(&ip, pathbuf) == 0) {
666 retval = ckinode(dp, &idesc) & ALTERED;
672 * Attempt to expand the size of a directory
675 expanddir(struct inode *ip, char *name)
677 ufs2_daddr_t lastlbn, oldblk, newblk, indirblk;
678 size_t filesize, lastlbnsize;
679 struct bufarea *bp, *nbp;
680 struct inodesc idesc;
686 indiralloced = newblk = indirblk = 0;
687 pwarn("NO SPACE LEFT IN %s", name);
688 if (!preen && reply("EXPAND") == 0)
691 filesize = DIP(dp, di_size);
692 lastlbn = lblkno(&sblock, filesize);
694 * We only expand lost+found to a single indirect block.
696 if ((DIP(dp, di_mode) & IFMT) != IFDIR || filesize == 0 ||
697 lastlbn >= UFS_NDADDR + NINDIR(&sblock))
700 * If last block is a fragment, expand it to a full size block.
702 lastlbnsize = sblksize(&sblock, filesize, lastlbn);
703 if (lastlbnsize > 0 && lastlbnsize < sblock.fs_bsize) {
704 oldblk = DIP(dp, di_db[lastlbn]);
705 bp = getdirblk(oldblk, lastlbnsize);
708 if ((newblk = allocblk(sblock.fs_frag)) == 0)
710 nbp = getdatablk(newblk, sblock.fs_bsize, BT_DIRDATA);
713 DIP_SET(dp, di_db[lastlbn], newblk);
714 DIP_SET(dp, di_size, filesize + sblock.fs_bsize - lastlbnsize);
715 DIP_SET(dp, di_blocks, DIP(dp, di_blocks) +
716 btodb(sblock.fs_bsize - lastlbnsize));
718 memmove(nbp->b_un.b_buf, bp->b_un.b_buf, lastlbnsize);
719 memset(&nbp->b_un.b_buf[lastlbnsize], 0,
720 sblock.fs_bsize - lastlbnsize);
721 for (cp = &nbp->b_un.b_buf[lastlbnsize];
722 cp < &nbp->b_un.b_buf[sblock.fs_bsize];
724 memmove(cp, &emptydir, sizeof emptydir);
727 idesc.id_blkno = oldblk;
728 idesc.id_numfrags = numfrags(&sblock, lastlbnsize);
729 (void)freeblock(&idesc);
731 printf(" (EXPANDED)\n");
734 if ((newblk = allocblk(sblock.fs_frag)) == 0)
736 bp = getdirblk(newblk, sblock.fs_bsize);
739 memset(bp->b_un.b_buf, 0, sblock.fs_bsize);
740 for (cp = bp->b_un.b_buf;
741 cp < &bp->b_un.b_buf[sblock.fs_bsize];
743 memmove(cp, &emptydir, sizeof emptydir);
745 if (lastlbn < UFS_NDADDR) {
746 DIP_SET(dp, di_db[lastlbn], newblk);
749 * Allocate indirect block if needed.
751 if ((indirblk = DIP(dp, di_ib[0])) == 0) {
752 if ((indirblk = allocblk(sblock.fs_frag)) == 0)
756 nbp = getdatablk(indirblk, sblock.fs_bsize, BT_LEVEL1);
760 memset(nbp->b_un.b_buf, 0, sblock.fs_bsize);
761 DIP_SET(dp, di_ib[0], indirblk);
762 DIP_SET(dp, di_blocks,
763 DIP(dp, di_blocks) + btodb(sblock.fs_bsize));
765 IBLK_SET(nbp, lastlbn - UFS_NDADDR, newblk);
769 DIP_SET(dp, di_size, filesize + sblock.fs_bsize);
770 DIP_SET(dp, di_blocks, DIP(dp, di_blocks) + btodb(sblock.fs_bsize));
773 printf(" (EXPANDED)\n");
776 pfatal(" (EXPANSION FAILED)\n");
780 idesc.id_blkno = newblk;
781 idesc.id_numfrags = sblock.fs_frag;
782 (void)freeblock(&idesc);
785 idesc.id_blkno = indirblk;
786 idesc.id_numfrags = sblock.fs_frag;
787 (void)freeblock(&idesc);
793 * allocate a new directory
796 allocdir(ino_t parent, ino_t request, int mode)
804 struct dirtemplate *dirp;
806 ino = allocino(request, IFDIR|mode);
811 dirp->dotdot_ino = parent;
814 bp = getdirblk(DIP(dp, di_db[0]), sblock.fs_fsize);
820 memmove(bp->b_un.b_buf, dirp, sizeof(struct dirtemplate));
821 for (cp = &bp->b_un.b_buf[DIRBLKSIZ];
822 cp < &bp->b_un.b_buf[sblock.fs_fsize];
824 memmove(cp, &emptydir, sizeof emptydir);
826 DIP_SET(dp, di_nlink, 2);
828 if (ino == UFS_ROOTINO) {
829 inoinfo(ino)->ino_linkcnt = DIP(dp, di_nlink);
830 if ((inp = getinoinfo(ino)) == NULL)
831 inp = cacheino(dp, ino);
833 inp->i_flags = INFO_NEW;
834 inp->i_parent = parent;
835 inp->i_dotdot = parent;
839 if (!INO_IS_DVALID(parent)) {
844 inp = cacheino(dp, ino);
845 inp->i_parent = parent;
846 inp->i_dotdot = parent;
847 inoinfo(ino)->ino_state = inoinfo(parent)->ino_state;
848 if (inoinfo(ino)->ino_state == DSTATE) {
849 inoinfo(ino)->ino_linkcnt = DIP(dp, di_nlink);
850 inoinfo(parent)->ino_linkcnt++;
855 DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1);
862 * free a directory inode
865 freedir(ino_t ino, ino_t parent)
873 DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - 1);
881 * generate a temporary name for the lost+found directory.
884 lftempname(char *bufp, ino_t ino)
891 for (in = maxino; in > 0; in /= 10)
897 *--cp = (in % 10) + '0';
905 * Get a directory block.
906 * Insure that it is held until another is requested.
908 static struct bufarea *
909 getdirblk(ufs2_daddr_t blkno, long size)
912 if (pdirbp != NULL && pdirbp->b_errs == 0)
914 pdirbp = getdatablk(blkno, size, BT_DIRDATA);