summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/fsck.h
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/fsck.h
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/fsck.h')
-rw-r--r--sbin/fsck_ffs/fsck.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h
index b654249..a2da788 100644
--- a/sbin/fsck_ffs/fsck.h
+++ b/sbin/fsck_ffs/fsck.h
@@ -78,12 +78,21 @@ struct inostat {
/*
* Inode states.
*/
-#define USTATE 01 /* inode not allocated */
-#define FSTATE 02 /* inode is file */
-#define DSTATE 03 /* inode is directory */
-#define DFOUND 04 /* directory found during descent */
-#define DCLEAR 05 /* directory is to be cleared */
-#define FCLEAR 06 /* file is to be cleared */
+#define USTATE 0x1 /* inode not allocated */
+#define FSTATE 0x2 /* inode is file */
+#define FZLINK 0x3 /* inode is file with a link count of zero */
+#define DSTATE 0x4 /* inode is directory */
+#define DZLINK 0x5 /* inode is directory with a zero link count */
+#define DFOUND 0x6 /* directory found during descent */
+/* 0x7 UNUSED - see S_IS_DVALID() definition */
+#define DCLEAR 0x8 /* directory is to be cleared */
+#define FCLEAR 0x9 /* file is to be cleared */
+/* DUNFOUND === (state == DSTATE || state == DZLINK) */
+#define S_IS_DUNFOUND(state) (((state) & ~0x1) == DSTATE)
+/* DVALID === (state == DSTATE || state == DZLINK || state == DFOUND) */
+#define S_IS_DVALID(state) (((state) & ~0x3) == DSTATE)
+#define INO_IS_DUNFOUND(ino) S_IS_DUNFOUND(inoinfo(ino)->ino_state)
+#define INO_IS_DVALID(ino) S_IS_DVALID(inoinfo(ino)->ino_state)
/*
* Inode state information is contained on per cylinder group lists
* which are described by the following structure.
@@ -205,15 +214,6 @@ struct dups *duplist; /* head of dup list */
struct dups *muldup; /* end of unique duplicate dup block numbers */
/*
- * Linked list of inodes with zero link counts.
- */
-struct zlncnt {
- struct zlncnt *next;
- ino_t zlncnt;
-};
-struct zlncnt *zlnhead; /* head of zero link count list */
-
-/*
* Inode cache data structures.
*/
struct inoinfo {
OpenPOWER on IntegriCloud