Update of /cvsroot/libsysio/libsysio/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8449
Modified Files:
inode.h fs.h
Log Message:
The file system record now maintains the list of associated i-nodes as
a tree. This speeds up _sysio_i_find greatly when the names table cache
is allowed to become large.
In struct inode, moved the file ID pointer and tree-node pointer to
the top of the record.
Removed definitions relative to the old per-FS i-nodes hashes.
Index: inode.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -w -b -B -p -r1.42 -r1.43
--- inode.h 14 Jul 2008 19:14:07 -0000 1.42
+++ inode.h 26 Jul 2008 01:33:14 -0000 1.43
@@ -128,7 +128,8 @@ struct inode_ops {
* An i-node record is maintained for each file object in the system.
*/
struct inode {
- LIST_ENTRY(inode) i_link; /* FS i-nodes link */
+ struct file_identifier *i_fid; /* file ident */
+ struct tree_node i_tnode; /* cache tnode record */
mutex_t i_mutex; /* record mutex */
unsigned i_lckcnt; /* # recursive locks */
unsigned
@@ -138,7 +139,6 @@ struct inode {
struct inode_ops i_ops; /* operations */
struct intnl_stat i_stbuf; /* attrs */
struct filesys *i_fs; /* file system ptr */
- struct file_identifier *i_fid; /* file ident */
void *i_private; /* driver data */
TAILQ_ENTRY(inode) i_nodes; /* all i-nodes link */
};
@@ -148,6 +148,9 @@ struct inode {
*/
#define I_INIT(ino, fs, stat, ops, fid, immunity, private) \
do { \
+ (ino)->i_fid = (fid); \
+ (ino)->i_tnode.tn_key = (fid); \
+ (ino)->i_tnode.tn_left = (ino)->i_tnode.tn_right = NULL; \
mutex_init(&(ino)->i_mutex, MUTEX_RECURSIVE); \
(ino)->i_lckcnt = 0; \
(ino)->i_immune = (immunity) ? 1 : 0; \
@@ -156,7 +159,6 @@ struct inode {
(ino)->i_ops = *(ops); \
(ino)->i_stbuf = *(stat); \
(ino)->i_fs = (fs); \
- (ino)->i_fid = (fid); \
(ino)->i_private = (private); \
} while (0)
Index: fs.h
===================================================================
RCS file: /cvsroot/libsysio/libsysio/include/fs.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -b -B -p -r1.8 -r1.9
--- fs.h 30 Nov 2007 18:12:52 -0000 1.8
+++ fs.h 26 Jul 2008 01:33:14 -0000 1.9
@@ -92,21 +92,6 @@ struct filesys_ops {
};
/*
- * Define the desired size of the file system record's inode table. This should
- * probably be something fancy that tries to use up a system page, or the
- * like. I'm not feeling adventurous right now though. It is prime though.
- * That should help out the hash.
- */
-#ifndef FS_ITBLSIZ
-#define FS_ITBLSIZ 503
-#endif
-
-/*
- * Inode list head record.
- */
-LIST_HEAD(itable_entry, inode);
-
-/*
* A filesys record is maintained for each active file system or volume.
*/
struct filesys {
@@ -115,7 +100,7 @@ struct filesys {
unsigned fs_flags; /* flags (see below) */
struct filesys_ops fs_ops; /* operations */
void *fs_private; /* driver data */
- struct itable_entry fs_itbl[FS_ITBLSIZ]; /* inodes hash */
+ struct tree_node *fs_icache; /* inodes cache */
unsigned long fs_id; /* ID */
size_t fs_bsize; /* DEPRECATED */
};
@@ -130,19 +115,11 @@ struct filesys {
*/
#define FS_INIT(fs, flags, ops, private) \
do { \
- size_t __i; \
- struct itable_entry *__head; \
- \
(fs)->fs_ref = 1; \
(fs)->fs_flags = (flags); \
(fs)->fs_ops = *(ops); \
(fs)->fs_private = (private); \
- __i = FS_ITBLSIZ; \
- __head = (fs)->fs_itbl; \
- do { \
- LIST_INIT(__head); \
- __head++; \
- } while (--__i); \
+ (fs)->fs_icache = NULL; \
(fs)->fs_id = 0; \
} while (0)
|