Deleted Added
full compact
35d34
< #if 0
37,39d35
< #endif
< static const char rcsid[] =
< "$Id: pass1.c,v 1.11 1998/06/15 07:07:16 charnier Exp $";
42a39
> #include <sys/time.h>
54a52
> static ino_t lastino; /* last inode in use */
60a59
> u_int8_t *cp;
62c61,62
< int c, i, cgd;
---
> int c, i, cgd, inosused;
> struct inostat *info;
84d83
< inumber = 0;
86d84
< resetinodebuf();
88,89c86,132
< for (i = 0; i < sblock.fs_ipg; i++, inumber++) {
< if (inumber < ROOTINO)
---
> inumber = c * sblock.fs_ipg;
> setinodebuf(inumber);
> inosused = sblock.fs_ipg;
> /*
> * If we are using soft updates, then we can trust the
> * cylinder group inode allocation maps to tell us which
> * inodes are allocated. We will scan the used inode map
> * to find the inodes that are really in use, and then
> * read only those inodes in from disk.
> */
> if (preen && usedsoftdep) {
> getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
> if (!cg_chkmagic(&cgrp))
> pfatal("CG %d: BAD MAGIC NUMBER\n", c);
> cp = &cg_inosused(&cgrp)[(sblock.fs_ipg - 1) / NBBY];
> for ( ; inosused > 0; inosused -= NBBY, cp--) {
> if (*cp == 0)
> continue;
> for (i = 1 << (NBBY - 1); i > 0; i >>= 1) {
> if (*cp & i)
> break;
> inosused--;
> }
> break;
> }
> if (inosused < 0)
> inosused = 0;
> }
> /*
> * Allocate inoinfo structures for the allocated inodes.
> */
> inostathead[c].il_numalloced = inosused;
> if (inosused == 0) {
> inostathead[c].il_stat = 0;
> continue;
> }
> info = calloc((unsigned)inosused, sizeof(struct inostat));
> if (info == NULL)
> pfatal("cannot alloc %u bytes for inoinfo\n",
> (unsigned)(sizeof(struct inostat) * inosused));
> inostathead[c].il_stat = info;
> /*
> * Scan the allocated inodes.
> */
> for (i = 0; i < inosused; i++, inumber++) {
> if (inumber < ROOTINO) {
> (void)getnextinode(inumber);
90a134
> }
92a137,161
> lastino += 1;
> if (inosused < sblock.fs_ipg || inumber == lastino)
> continue;
> /*
> * If we were not able to determine in advance which inodes
> * were in use, then reduce the size of the inoinfo structure
> * to the size necessary to describe the inodes that we
> * really found.
> */
> inosused = lastino - (c * sblock.fs_ipg);
> if (inosused < 0)
> inosused = 0;
> inostathead[c].il_numalloced = inosused;
> if (inosused == 0) {
> free(inostathead[c].il_stat);
> inostathead[c].il_stat = 0;
> continue;
> }
> info = calloc((unsigned)inosused, sizeof(struct inostat));
> if (info == NULL)
> pfatal("cannot alloc %u bytes for inoinfo\n",
> (unsigned)(sizeof(struct inostat) * inosused));
> memmove(info, inostathead[c].il_stat, inosused * sizeof(*info));
> free(inostathead[c].il_stat);
> inostathead[c].il_stat = info;
123c192
< statemap[inumber] = USTATE;
---
> inoinfo(inumber)->ino_state = USTATE;
161,162c230
< (u_long)inumber, symbuf,
< (long)dp->di_size);
---
> (u_long)inumber, symbuf, (long)dp->di_size);
173,174c241
< if (dp->di_size < sblock.fs_maxsymlinklen ||
< dp->di_blocks == 0) {
---
> if (dp->di_size < sblock.fs_maxsymlinklen) {
203c270
< lncntp[inumber] = dp->di_nlink;
---
> inoinfo(inumber)->ino_linkcnt = dp->di_nlink;
220c287
< statemap[inumber] = DCLEAR;
---
> inoinfo(inumber)->ino_state = DCLEAR;
222c289
< statemap[inumber] = DSTATE;
---
> inoinfo(inumber)->ino_state = DSTATE;
223a291
> countdirs++;
225,226c293,294
< statemap[inumber] = FSTATE;
< typemap[inumber] = IFTODT(mode);
---
> inoinfo(inumber)->ino_state = FSTATE;
> inoinfo(inumber)->ino_type = IFTODT(mode);
254c322
< statemap[inumber] = FCLEAR;
---
> inoinfo(inumber)->ino_state = FCLEAR;
256c324
< statemap[inumber] = USTATE;
---
> inoinfo(inumber)->ino_state = USTATE;