free dup list and zero link count entries as they are used
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 6 Mar 1986 09:12:40 +0000 (01:12 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 6 Mar 1986 09:12:40 +0000 (01:12 -0800)
reinitialize dup list head and zero link count head to empty after each fs check

SCCS-vsn: sbin/fsck/pass4.c 5.2
SCCS-vsn: sbin/fsck/main.c 5.4

usr/src/sbin/fsck/main.c
usr/src/sbin/fsck/pass4.c

index d83fc70..cf40b90 100644 (file)
@@ -11,7 +11,7 @@ char copyright[] =
 #endif not lint
 
 #ifndef lint
 #endif not lint
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     5.4 (Berkeley) %G%";
 #endif not lint
 
 #include <sys/param.h>
 #endif not lint
 
 #include <sys/param.h>
@@ -141,6 +141,7 @@ checkfilesys(filesys)
 {
        daddr_t n_ffree, n_bfree;
        struct dups *dp;
 {
        daddr_t n_ffree, n_bfree;
        struct dups *dp;
+       struct zlncnt *zlnp;
 
        devname = filesys;
        if (setup(filesys) == 0) {
 
        devname = filesys;
        if (setup(filesys) == 0) {
@@ -221,7 +222,15 @@ checkfilesys(filesys)
                                printf(" %d,", dp->dup);
                        printf("\n");
                }
                                printf(" %d,", dp->dup);
                        printf("\n");
                }
+               if (zlnhead != NULL) {
+                       printf("The following zero link count inodes remain:");
+                       for (zlnp = zlnhead; zlnp; zlnp = zlnp->next)
+                               printf(" %d,", zlnp->zlncnt);
+                       printf("\n");
+               }
        }
        }
+       zlnhead = (struct zlncnt *)0;
+       duplist = (struct dups *)0;
        if (dfile.mod) {
                (void)time(&sblock.fs_time);
                sbdirty();
        if (dfile.mod) {
                (void)time(&sblock.fs_time);
                sbdirty();
index 6375515..99e3382 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)pass4.c    5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)pass4.c    5.2 (Berkeley) %G%";
 #endif not lint
 
 #include <sys/param.h>
 #endif not lint
 
 #include <sys/param.h>
@@ -37,6 +37,10 @@ pass4()
                        else {
                                for (zlnp = zlnhead; zlnp; zlnp = zlnp->next)
                                        if (zlnp->zlncnt == inumber) {
                        else {
                                for (zlnp = zlnhead; zlnp; zlnp = zlnp->next)
                                        if (zlnp->zlncnt == inumber) {
+                                               zlnp->zlncnt = zlnhead->zlncnt;
+                                               zlnp = zlnhead;
+                                               zlnhead = zlnhead->next;
+                                               free(zlnp);
                                                clri(&idesc, "UNREF", 1);
                                                break;
                                        }
                                                clri(&idesc, "UNREF", 1);
                                                break;
                                        }
@@ -72,7 +76,7 @@ pass4check(idesc)
                                dlp->dup = duplist->dup;
                                dlp = duplist;
                                duplist = duplist->next;
                                dlp->dup = duplist->dup;
                                dlp = duplist;
                                duplist = duplist->next;
-                               /* free(dlp); */
+                               free(dlp);
                                break;
                        }
                        if (dlp == 0) {
                                break;
                        }
                        if (dlp == 0) {