diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-03-14 21:44:36 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-03-14 21:44:36 +0000 |
commit | 199f823c0fe13957a4dca46fafe9ff989667c162 (patch) | |
tree | 01b6553cb63712a6b466b6f63e9a2c8276235a93 /nfs | |
parent | 389c9b61ab3043d7c1933b5cf7190fa09516fd67 (diff) |
Formerly cache.c.~8~
Diffstat (limited to 'nfs')
-rw-r--r-- | nfs/cache.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/nfs/cache.c b/nfs/cache.c index 7839e9e7..aac16836 100644 --- a/nfs/cache.c +++ b/nfs/cache.c @@ -39,7 +39,7 @@ hash (void *fhandle) } struct node * -lookup_fhandle (void *fhandle, struct node *dir) +lookup_fhandle (void *fhandle) { struct node *np; struct netnode *nn; @@ -60,9 +60,7 @@ lookup_fhandle (void *fhandle, struct node *dir) nn = malloc (sizeof (struct netnode)); bcopy (fhandle, nn->handle, NFS_FHSIZE); nn->stat_updated = 0; - if (dir) - dir->references++; - nn->dir = dir; + nn->dtrans = NOT_POSSIBLE; np = netfs_make_node (nn); mutex_lock (&np->lock); @@ -79,7 +77,6 @@ lookup_fhandle (void *fhandle, struct node *dir) void netfs_node_norefs (struct node *np) { - struct node *dir; if (np->nn->dead_dir) { struct node *dir; @@ -105,15 +102,35 @@ netfs_node_norefs (struct node *np) } else { - dir = np->nn->dir; *np->nn->hprevp = np->nn->hnext; if (np->nn->hnext) np->nn->hnext->nn->hprevp = np->nn->hprevp; + if (np->nn->dtrans == SYMLINK) + free (np->nn->transarg.name); free (np->nn); free (np); - - spin_unlock (&netfs_node_refcnt_lock); - netfs_nrele (dir); - spin_lock (&netfs_node_refcnt_lock); } } + +void +recache_handle (struct node *np, void *handle) +{ + int h; + + spin_lock (&netfs_node_refcnt_lock); + *np->nn->hprevp = np->nn->hnext; + if (np->nn->hnext) + np->nn->hnext->nn->hprevp = np->nn->hprevp; + + bcopy (handle, np->nn->handle, NFS_FHSIZE); + + h = hash (handle); + np->nn->hnext = nodehash[h]; + if (np->nn->hnext) + np->nn->hnext->nn->hprevp = &np->nn->hnext; + np->nn->hprevp = &nodehash[h]; + + spin_unlock (&netfs_node_refcnt_lock); +} + + |