diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-03-19 17:58:11 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-03-19 17:58:11 +0000 |
commit | b6724432098709311f2cc2867c7734b41abe105a (patch) | |
tree | e25c3a534e2603029a58ab3d12544ed8a75c860d /nfs/cache.c | |
parent | bc9f5db2d23a3cc18dc5b52cbc6ef1fa09d6e8e4 (diff) |
entered into RCS
Diffstat (limited to 'nfs/cache.c')
-rw-r--r-- | nfs/cache.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/nfs/cache.c b/nfs/cache.c index aac16836..65b46575 100644 --- a/nfs/cache.c +++ b/nfs/cache.c @@ -1,4 +1,4 @@ -/* +/* Node cache management for NFS client implementation Copyright (C) 1995, 1996 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. @@ -22,10 +22,11 @@ #include <string.h> +/* Hash table containing all the nodes currently active. */ #define CACHESIZE 512 - static struct node *nodehash [CACHESIZE]; +/* Compute and return a hash key for NFS file handle FHANDLE. */ static inline int hash (void *fhandle) { @@ -38,6 +39,10 @@ hash (void *fhandle) return h % CACHESIZE; } +/* Lookup the specified file handle FHANDLE in the hash table. If it + is not present, initialize a new node structure and insert it into + the hash table. Whichever course, a new reference is generated and + the node is returned. */ struct node * lookup_fhandle (void *fhandle) { @@ -61,6 +66,8 @@ lookup_fhandle (void *fhandle) bcopy (fhandle, nn->handle, NFS_FHSIZE); nn->stat_updated = 0; nn->dtrans = NOT_POSSIBLE; + nn->dead_dir = 0; + nn->dead_name = 0; np = netfs_make_node (nn); mutex_lock (&np->lock); @@ -68,12 +75,16 @@ lookup_fhandle (void *fhandle) if (nn->hnext) nn->hnext->nn->hprevp = &nn->hnext; nn->hprevp = &nodehash[h]; + nodehash[h] = np; spin_unlock (&netfs_node_refcnt_lock); return np; } +/* Called by libnetfs when node NP has no more references. (See + <hurd/libnetfs.h> for details. Just clear local state and remove + from the hash table. */ void netfs_node_norefs (struct node *np) { @@ -112,6 +123,8 @@ netfs_node_norefs (struct node *np) } } +/* Change the file handle used for node NP to be HANDLE. Make sure the + hash table stays up to date. */ void recache_handle (struct node *np, void *handle) { |