summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/pass4.c
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2004-10-08 20:44:47 +0000
committertruckman <truckman@FreeBSD.org>2004-10-08 20:44:47 +0000
commit78abfd32f0f68e14f413541b1f360e4c166045a5 (patch)
treeaf6db7840e73d182ffa04c61044510d44fa56004 /sbin/fsck_ffs/pass4.c
parentf5ef5456b3860f6305fc2281c6ccdd143a02cf56 (diff)
downloadFreeBSD-src-78abfd32f0f68e14f413541b1f360e4c166045a5.zip
FreeBSD-src-78abfd32f0f68e14f413541b1f360e4c166045a5.tar.gz
Eliminate linked list used to track inodes with an initial link
count of zero and instead encode this information in the inode state. Pass 4 performed a linear search of this list for each inode in the file system, which performs poorly if the list is long. Reviewed by: sam & keramida (an earlier version of the patch), mckusick MFC after: 1 month
Diffstat (limited to 'sbin/fsck_ffs/pass4.c')
-rw-r--r--sbin/fsck_ffs/pass4.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sbin/fsck_ffs/pass4.c b/sbin/fsck_ffs/pass4.c
index 411f3bd..8a426ea 100644
--- a/sbin/fsck_ffs/pass4.c
+++ b/sbin/fsck_ffs/pass4.c
@@ -49,7 +49,6 @@ void
pass4(void)
{
ino_t inumber;
- struct zlncnt *zlnp;
union dinode *dp;
struct inodesc idesc;
int i, n, cg;
@@ -76,6 +75,14 @@ pass4(void)
idesc.id_number = inumber;
switch (inoinfo(inumber)->ino_state) {
+ case FZLINK:
+ case DZLINK:
+ if (inoinfo(inumber)->ino_linkcnt == 0) {
+ clri(&idesc, "UNREF", 1);
+ break;
+ }
+ /* fall through */
+
case FSTATE:
case DFOUND:
n = inoinfo(inumber)->ino_linkcnt;
@@ -83,16 +90,6 @@ pass4(void)
adjust(&idesc, (short)n);
break;
}
- for (zlnp = zlnhead; zlnp; zlnp = zlnp->next) {
- if (zlnp->zlncnt == inumber) {
- zlnp->zlncnt = zlnhead->zlncnt;
- zlnp = zlnhead;
- zlnhead = zlnhead->next;
- free((char *)zlnp);
- clri(&idesc, "UNREF", 1);
- break;
- }
- }
break;
case DSTATE:
OpenPOWER on IntegriCloud