summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2002-10-11 05:39:46 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-10-11 05:39:46 -0700
commit85d183651e2ddd580e8d688879826744467883dd (patch)
tree3ffa3c7c10b70e252a4c45eddd55cdfd7255b8c7 /include/linux
parentdf821d2c2d61521b0f8805b7972ed2ff9af8add4 (diff)
[PATCH] kNFSd: Convert export-table to use new cache code
This introduces two caches, svc_export_cache (nfsd.exports) and svc_expkey_cache (nfsd.fh). nfsd.exports maps client+directory -> export options. nfsd.fh maps client + filehandle-fragment -> directory. A major part of this change is that export entries are now reference counted, so we have to be careful to keep those counts correct.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/nfsd/export.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 9c2802c121c4..8e658be46c87 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -46,7 +46,7 @@
#ifdef __KERNEL__
struct svc_export {
- struct list_head ex_hash;
+ struct cache_head h;
struct auth_domain * ex_client;
int ex_flags;
struct vfsmount * ex_mnt;
@@ -61,7 +61,7 @@ struct svc_export {
* for type 0 (dev/ino), one for type 1 (fsid)
*/
struct svc_expkey {
- struct list_head ek_hash;
+ struct cache_head h;
struct auth_domain * ek_client;
int ek_fsidtype;
@@ -98,14 +98,30 @@ int exp_rootfh(struct auth_domain *,
int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp);
int nfserrno(int errno);
+extern void expkey_put(struct cache_head *item, struct cache_detail *cd);
+extern void svc_export_put(struct cache_head *item, struct cache_detail *cd);
+extern struct cache_detail svc_export_cache, svc_expkey_cache;
+
+static inline void exp_put(struct svc_export *exp)
+{
+ svc_export_put(&exp->h, &svc_export_cache);
+}
+
static inline struct svc_export *
exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv)
{
struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv);
- if (ek)
- return ek->ek_export;
- else
- return NULL;
+ if (ek && !IS_ERR(ek)) {
+ struct svc_export *exp = ek->ek_export;
+ int err;
+ cache_get(&exp->h);
+ expkey_put(&ek->h, &svc_expkey_cache);
+ if (exp &&
+ (err = cache_check(&svc_export_cache, &exp->h)))
+ exp = ERR_PTR(err);
+ return exp;
+ } else
+ return ERR_PTR(PTR_ERR(ek));
}
#endif /* __KERNEL__ */