From 6d0f7b032671093abcfbecca145e0152cb2e6bb3 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 12 Sep 2002 01:42:43 -0700 Subject: [PATCH] kNFSd 13: Separate out the multiple keys in the export hash table. Currently each entry in the export table had two hash chains going through it, one for hash-by-dev/ino, One for hash-by-fsid. This is contrary to the goal of a simple hash table structure. The two hash-tables per client are replace by one which stores 'exp_key's which contain the key (as a file handle fragment) and a pointer to the real export entry. The export entries are then all stored in a single hash table indexed by client+vfsmount+dentry; --- include/linux/nfsd/export.h | 16 ++++++++++++++-- include/linux/nfsd/nfsfh.h | 13 +++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index d3bd2a796716..97592dbe9a4b 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h @@ -52,13 +52,11 @@ struct svc_client { struct svc_client * cl_next; char cl_ident[NFSCLNT_IDMAX]; struct list_head cl_export[NFSCLNT_EXPMAX]; - struct list_head cl_expfsid[NFSCLNT_EXPMAX]; struct list_head cl_list; }; struct svc_export { struct list_head ex_hash; - struct list_head ex_fsid_hash; struct list_head ex_list; struct svc_client * ex_client; int ex_flags; @@ -69,6 +67,20 @@ struct svc_export { int ex_fsid; }; +/* an "export key" (expkey) maps a filehandlefragement to an + * svc_export for a given client. There can be two per export, one + * for type 0 (dev/ino), one for type 1 (fsid) + */ +struct svc_expkey { + struct list_head ek_hash; + + struct svc_client *ek_client; + int ek_fsidtype; + u32 ek_fsid[2]; + + struct svc_export *ek_export; +}; + #define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) #define EX_RDONLY(exp) ((exp)->ex_flags & NFSEXP_READONLY) diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index 53f55cc17a50..af0b03c0ce83 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h @@ -199,6 +199,19 @@ typedef struct svc_fh { } svc_fh; +static inline void mk_fsid_v0(u32 *fsidv, dev_t dev, ino_t ino) +{ + fsidv[0] = htonl((MAJOR(dev)<<16) | + MINOR(dev)); + fsidv[1] = ino_t_to_u32(ino); +} + +static inline void mk_fsid_v1(u32 *fsidv, u32 fsid) +{ + fsidv[0] = fsid; +} + + /* * Shorthand for dprintk()'s */ -- cgit v1.2.3