Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/fvdl-softdep]: src/sbin Bring in Kirk McKusick's FFS softdep code on a b...
details: https://anonhg.NetBSD.org/src/rev/4920f5390727
branches: fvdl-softdep
changeset: 477502:4920f5390727
user: fvdl <fvdl%NetBSD.org@localhost>
date: Tue Oct 19 13:00:47 1999 +0000
description:
Bring in Kirk McKusick's FFS softdep code on a branch.
diffstat:
sbin/fsck_ffs/dir.c | 18 +++++++++++-------
sbin/fsck_ffs/fsck.h | 4 +++-
sbin/fsck_ffs/inode.c | 16 ++++++++++++++--
sbin/fsck_ffs/main.c | 13 ++++++++++---
sbin/fsck_ffs/pass1.c | 26 +++++++++++++++++++-------
sbin/fsck_ffs/pass2.c | 32 +++++++++++++++++++++++---------
sbin/fsck_ffs/pass5.c | 23 +++++++++++++----------
sbin/fsck_ffs/setup.c | 23 ++++++++++++++++-------
sbin/fsck_ffs/utilities.c | 31 +++++++++++++++++++++++++------
sbin/mount/mount.c | 13 ++++++++++---
10 files changed, 144 insertions(+), 55 deletions(-)
diffs (truncated from 631 to 300 lines):
diff -r 444255ee84b6 -r 4920f5390727 sbin/fsck_ffs/dir.c
--- a/sbin/fsck_ffs/dir.c Tue Oct 19 12:49:58 1999 +0000
+++ b/sbin/fsck_ffs/dir.c Tue Oct 19 13:00:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.25 1998/03/18 17:01:23 bouyer Exp $ */
+/* $NetBSD: dir.c,v 1.25.4.1 1999/10/19 13:01:28 fvdl Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: dir.c,v 1.25 1998/03/18 17:01:23 bouyer Exp $");
+__RCSID("$NetBSD: dir.c,v 1.25.4.1 1999/10/19 13:01:28 fvdl Exp $");
#endif
#endif /* not lint */
@@ -364,16 +364,18 @@
clri(idesc, "UNREF", 0);
} else {
pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
- ((iswap16(dp->di_mode) & IFMT) == IFDIR ? "DIR" : "FILE"));
+ ((iswap16(dp->di_mode) & IFMT) == IFDIR ? "DIR" :
+ "FILE"));
pinode(idesc->id_number);
printf(" COUNT %d SHOULD BE %d",
- iswap16(dp->di_nlink), (iswap16(dp->di_nlink) - lcnt) & 0xffff);
- if (preen) {
+ dp->di_nlink, dp->di_nlink - lcnt);
+ if (preen || usedsoftdep) {
if (lcnt < 0) {
printf("\n");
pfatal("LINK COUNT INCREASING");
}
- printf(" (ADJUSTED)\n");
+ if (preen)
+ printf(" (ADJUSTED)\n");
}
if (preen || reply("ADJUST") == 1) {
dp->di_nlink = iswap16(iswap16(dp->di_nlink) - lcnt);
@@ -462,7 +464,7 @@
lostdir = (iswap16(dp->di_mode) & IFMT) == IFDIR;
pwarn("UNREF %s ", lostdir ? "DIR" : "FILE");
pinode(orphan);
- if (preen && dp->di_size == 0)
+ if ((preen || usedsoftdep) && dp->di_size == 0)
return (0);
if (preen)
printf(" (RECONNECTED)\n");
@@ -471,6 +473,8 @@
markclean = 0;
return (0);
}
+ if (parentdir != 0)
+ lncntp[parentdir]++;
if (lfdir == 0) {
dp = ginode(ROOTINO);
idesc.id_name = lfname;
diff -r 444255ee84b6 -r 4920f5390727 sbin/fsck_ffs/fsck.h
--- a/sbin/fsck_ffs/fsck.h Tue Oct 19 12:49:58 1999 +0000
+++ b/sbin/fsck_ffs/fsck.h Tue Oct 19 13:00:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsck.h,v 1.19 1999/01/15 13:32:06 bouyer Exp $ */
+/* $NetBSD: fsck.h,v 1.19.4.1 1999/10/19 13:01:28 fvdl Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -182,6 +182,7 @@
int doinglevel1; /* converting to new cylinder group format */
int doinglevel2; /* converting to new inode format */
int newinofmt; /* filesystem has new inode format */
+char usedsoftdep; /* just fix soft dependency inconsistencies */
int preen; /* just fix normal inconsistencies */
int doswap; /* convert byte order */
int needswap; /* need to convert byte order in memory */
@@ -195,6 +196,7 @@
int fsreadfd; /* file descriptor for reading file system */
int fswritefd; /* file descriptor for writing file system */
int rerun; /* rerun fsck. Only used in non-preen mode */
+char resolved; /* cleared if unresolved changes => not clean */
ufs_daddr_t maxfsblock; /* number of blocks in the file system */
char *blockmap; /* ptr to primary blk allocation map */
diff -r 444255ee84b6 -r 4920f5390727 sbin/fsck_ffs/inode.c
--- a/sbin/fsck_ffs/inode.c Tue Oct 19 12:49:58 1999 +0000
+++ b/sbin/fsck_ffs/inode.c Tue Oct 19 13:00:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.30 1998/10/23 01:13:33 thorpej Exp $ */
+/* $NetBSD: inode.c,v 1.30.4.1 1999/10/19 13:01:28 fvdl Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: inode.c,v 1.30 1998/10/23 01:13:33 thorpej Exp $");
+__RCSID("$NetBSD: inode.c,v 1.30.4.1 1999/10/19 13:01:28 fvdl Exp $");
#endif
#endif /* not lint */
@@ -49,6 +49,7 @@
#include <ufs/ufs/dir.h>
#include <ufs/ffs/fs.h>
#include <ufs/ffs/ffs_extern.h>
+#include <ufs/ufs/ufs_bswap.h>
#ifndef SMALL
#include <err.h>
@@ -608,6 +609,8 @@
ino_t ino;
struct dinode *dp;
time_t t;
+ struct cg *cgp = cgrp;
+ int cg;
if (request == 0)
request = ROOTINO;
@@ -618,9 +621,16 @@
break;
if (ino == maxino)
return (0);
+ cg = ino_to_cg(sblock, ino);
+ getblk(&cgblk, cgtod(sblock, cg), sblock->fs_cgsize);
+ if (!cg_chkmagic(cgp, 0))
+ pfatal("CG %d: BAD MAGIC NUMBER\n", cg);
+ setbit(cg_inosused(cgp, 0), ino % sblock->fs_ipg);
+ cgp->cg_cs.cs_nifree--;
switch (type & IFMT) {
case IFDIR:
statemap[ino] = DSTATE;
+ cgp->cg_cs.cs_ndir++;
break;
case IFREG:
case IFLNK:
@@ -629,6 +639,7 @@
default:
return (0);
}
+ cgdirty();
dp = ginode(ino);
dp->di_db[0] = iswap32(allocblk((long)1));
if (dp->di_db[0] == 0) {
@@ -636,6 +647,7 @@
return (0);
}
dp->di_mode = iswap16(type);
+ dp->di_flags = 0;
(void)time(&t);
dp->di_atime = iswap32(t);
dp->di_mtime = dp->di_ctime = dp->di_atime;
diff -r 444255ee84b6 -r 4920f5390727 sbin/fsck_ffs/main.c
--- a/sbin/fsck_ffs/main.c Tue Oct 19 12:49:58 1999 +0000
+++ b/sbin/fsck_ffs/main.c Tue Oct 19 13:00:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.33 1998/07/26 20:32:43 mycroft Exp $ */
+/* $NetBSD: main.c,v 1.33.4.1 1999/10/19 13:01:29 fvdl Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
#else
-__RCSID("$NetBSD: main.c,v 1.33 1998/07/26 20:32:43 mycroft Exp $");
+__RCSID("$NetBSD: main.c,v 1.33.4.1 1999/10/19 13:01:29 fvdl Exp $");
#endif
#endif /* not lint */
@@ -221,6 +221,11 @@
return (0);
}
/*
+ * Cleared if any questions answered no. Used to decide if
+ * the superblock should be marked clean.
+ */
+ resolved = 1;
+ /*
* 1: scan inodes tallying blocks used
*/
if (preen == 0) {
@@ -235,7 +240,7 @@
* 1b: locate first references to duplicates, if any
*/
if (duplist) {
- if (preen)
+ if (preen || usedsoftdep)
pfatal("INTERNAL ERROR: dups with -p");
printf("** Phase 1b - Rescan For More DUPS\n");
pass1b();
@@ -318,6 +323,8 @@
bwrite(fswritefd, sblk.b_un.b_buf,
fsbtodb(sblock, cgsblock(sblock, cylno)), SBSIZE);
}
+ if (rerun)
+ markclean = 0;
#if LITE2BORKEN
if (!hotroot()) {
ckfini();
diff -r 444255ee84b6 -r 4920f5390727 sbin/fsck_ffs/pass1.c
--- a/sbin/fsck_ffs/pass1.c Tue Oct 19 12:49:58 1999 +0000
+++ b/sbin/fsck_ffs/pass1.c Tue Oct 19 13:00:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass1.c,v 1.21 1998/03/18 17:01:24 bouyer Exp $ */
+/* $NetBSD: pass1.c,v 1.21.4.1 1999/10/19 13:01:29 fvdl Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: pass1.c,v 1.21 1998/03/18 17:01:24 bouyer Exp $");
+__RCSID("$NetBSD: pass1.c,v 1.21.4.1 1999/10/19 13:01:29 fvdl Exp $");
#endif
#endif /* not lint */
@@ -205,7 +205,8 @@
for (j = ndb; j < NDADDR; j++)
if (dp->di_db[j] != 0) {
if (debug)
- printf("bad direct addr: %d\n", iswap32(dp->di_db[j]));
+ printf("bad direct addr ix %d: %d [ndb %d]\n",
+ j, iswap32(dp->di_db[j]), ndb);
goto unknown;
}
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
@@ -226,8 +227,10 @@
if (zlnp == NULL) {
markclean = 0;
pfatal("LINK COUNT TABLE OVERFLOW");
- if (reply("CONTINUE") == 0)
+ if (reply("CONTINUE") == 0) {
+ ckfini();
exit(EEXIT);
+ }
} else {
zlnp->zlncnt = inumber;
zlnp->next = zlnhead;
@@ -300,8 +303,11 @@
idesc->id_number);
if (preen)
printf(" (SKIPPING)\n");
- else if (reply("CONTINUE") == 0)
+ else if (reply("CONTINUE") == 0) {
+ markclean = 0;
+ ckfini();
exit(EEXIT);
+ }
return (STOP);
}
}
@@ -318,16 +324,22 @@
idesc->id_number);
if (preen)
printf(" (SKIPPING)\n");
- else if (reply("CONTINUE") == 0)
+ else if (reply("CONTINUE") == 0) {
+ markclean = 0;
+ ckfini();
exit(EEXIT);
+ }
return (STOP);
}
new = (struct dups *)malloc(sizeof(struct dups));
if (new == NULL) {
markclean = 0;
pfatal("DUP TABLE OVERFLOW.");
- if (reply("CONTINUE") == 0)
+ if (reply("CONTINUE") == 0) {
+ markclean = 0;
+ ckfini();
exit(EEXIT);
+ }
return (STOP);
}
new->dup = blkno;
diff -r 444255ee84b6 -r 4920f5390727 sbin/fsck_ffs/pass2.c
--- a/sbin/fsck_ffs/pass2.c Tue Oct 19 12:49:58 1999 +0000
+++ b/sbin/fsck_ffs/pass2.c Tue Oct 19 13:00:47 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass2.c,v 1.25 1998/10/23 01:13:33 thorpej Exp $ */
+/* $NetBSD: pass2.c,v 1.25.4.1 1999/10/19 13:01:29 fvdl Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: pass2.c,v 1.25 1998/10/23 01:13:33 thorpej Exp $");
+__RCSID("$NetBSD: pass2.c,v 1.25.4.1 1999/10/19 13:01:29 fvdl Exp $");
#endif
#endif /* not lint */
@@ -77,8 +77,11 @@
case USTATE:
pfatal("ROOT INODE UNALLOCATED");
Home |
Main Index |
Thread Index |
Old Index