[PATCH] knfsd: Get rid of 'inplace' sunrpc caches
authorNeilBrown <neilb@suse.de>
Mon, 27 Mar 2006 09:15:01 +0000 (01:15 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 27 Mar 2006 16:44:41 +0000 (08:44 -0800)
These were an unnecessary wart.  Also only have one 'DefineSimpleCache..'
instead of two.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/nfsd/export.c
fs/nfsd/nfs4idmap.c
include/linux/sunrpc/cache.h
net/sunrpc/auth_gss/svcauth_gss.c
net/sunrpc/svcauth_unix.c

index 587829ed651ccddac13b78a14a225b300b620982..c591761a1ad60bb31984c77b721feebe84e749c7 100644 (file)
@@ -250,7 +250,7 @@ static inline void svc_expkey_update(struct svc_expkey *new, struct svc_expkey *
        new->ek_dentry = dget(item->ek_dentry);
 }
 
-static DefineSimpleCacheLookup(svc_expkey,0) /* no inplace updates */
+static DefineSimpleCacheLookup(svc_expkey, svc_expkey)
 
 #define        EXPORT_HASHBITS         8
 #define        EXPORT_HASHMAX          (1<< EXPORT_HASHBITS)
@@ -482,7 +482,7 @@ static inline void svc_export_update(struct svc_export *new, struct svc_export *
        new->ex_fsid = item->ex_fsid;
 }
 
-static DefineSimpleCacheLookup(svc_export,1) /* allow inplace updates */
+static DefineSimpleCacheLookup(svc_export, svc_export)
 
 
 struct svc_expkey *
index 13369650cdf9b8db38f2af1a456db8e7cff5a645..dea690aa8bb5f5651b856ffb00e15fa8fbfd1e33 100644 (file)
@@ -76,12 +76,6 @@ struct ent {
        char              authname[IDMAP_NAMESZ];
 };
 
-#define DefineSimpleCacheLookupMap(STRUCT, FUNC)                       \
-        DefineCacheLookup(struct STRUCT, h, FUNC##_lookup,             \
-        (struct STRUCT *item, int set), /*no setup */,                 \
-       & FUNC##_cache, FUNC##_hash(item), FUNC##_match(item, tmp),     \
-       STRUCT##_init(new, item), STRUCT##_update(tmp, item), 0)
-
 /* Common entry handling */
 
 #define ENT_HASHBITS          8
@@ -264,7 +258,7 @@ out:
        return error;
 }
 
-static DefineSimpleCacheLookupMap(ent, idtoname);
+static DefineSimpleCacheLookup(ent, idtoname);
 
 /*
  * Name -> ID cache
@@ -390,7 +384,7 @@ out:
        return (error);
 }
 
-static DefineSimpleCacheLookupMap(ent, nametoid);
+static DefineSimpleCacheLookup(ent, nametoid);
 
 /*
  * Exported API
index c4e3ea7cf1545e5da79e504c8fabddbc1f4a8d87..405ac14e509aeaca80c05ebf8d6222651efb6bb1 100644 (file)
@@ -133,14 +133,11 @@ struct cache_deferred_req {
  * If "set" == 0 :
  *    If an entry is found, it is returned
  *    If no entry is found, a new non-VALID entry is created.
- * If "set" == 1 and INPLACE == 0 :
+ * If "set" == 1 :
  *    If no entry is found a new one is inserted with data from "template"
  *    If a non-CACHE_VALID entry is found, it is updated from template using UPDATE
  *    If a CACHE_VALID entry is found, a new entry is swapped in with data
  *       from "template"
- * If set == 1, and INPLACE == 1 :
- *    As above, except that if a CACHE_VALID entry is found, we UPDATE in place
- *       instead of swapping in a new entry.
  *
  * If the passed handle has the CACHE_NEGATIVE flag set, then UPDATE is not
  * run but insteead CACHE_NEGATIVE is set in any new item.
@@ -159,13 +156,8 @@ struct cache_deferred_req {
  * TEST  tests if "tmp" matches "item"
  * INIT copies key information from "item" to "new"
  * UPDATE copies content information from "item" to "tmp"
- * INPLACE is true if updates can happen inplace rather than allocating a new structure
- *
- * WARNING: any substantial changes to this must be reflected in
- *   net/sunrpc/svcauth.c(auth_domain_lookup)
- *  which is a similar routine that is open-coded.
  */
-#define DefineCacheLookup(RTN,MEMBER,FNAME,ARGS,SETUP,DETAIL,HASHFN,TEST,INIT,UPDATE,INPLACE)  \
+#define DefineCacheLookup(RTN,MEMBER,FNAME,ARGS,SETUP,DETAIL,HASHFN,TEST,INIT,UPDATE)  \
 RTN *FNAME ARGS                                                                                \
 {                                                                                      \
        RTN *tmp, *new=NULL;                                                            \
@@ -179,13 +171,13 @@ RTN *FNAME ARGS                                                                           \
                tmp = container_of(*hp, RTN, MEMBER);                                   \
                if (TEST) { /* found a match */                                         \
                                                                                        \
-                       if (set && !INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags) && !new) \
+                       if (set && test_bit(CACHE_VALID, &tmp->MEMBER.flags) && !new)   \
                                break;                                                  \
                                                                                        \
                        if (new)                                                        \
                                {INIT;}                                                 \
                        if (set) {                                                      \
-                               if (!INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags))\
+                               if (test_bit(CACHE_VALID, &tmp->MEMBER.flags))\
                                { /* need to swap in new */                             \
                                        RTN *t2;                                        \
                                                                                        \
@@ -206,7 +198,7 @@ RTN *FNAME ARGS                                                                             \
                        else read_unlock(&(DETAIL)->hash_lock);                         \
                        if (set)                                                        \
                                cache_fresh(DETAIL, &tmp->MEMBER, item->MEMBER.expiry_time); \
-                       if (set && !INPLACE && new) cache_fresh(DETAIL, &new->MEMBER, 0);       \
+                       if (set && new) cache_fresh(DETAIL, &new->MEMBER, 0);   \
                        if (new) (DETAIL)->cache_put(&new->MEMBER, DETAIL);             \
                        return tmp;                                                     \
                }                                                                       \
@@ -239,10 +231,12 @@ RTN *FNAME ARGS                                                                           \
        return NULL;                                                                    \
 }
 
-#define DefineSimpleCacheLookup(STRUCT,INPLACE)        \
-       DefineCacheLookup(struct STRUCT, h, STRUCT##_lookup, (struct STRUCT *item, int set), /*no setup */,     \
-                         & STRUCT##_cache, STRUCT##_hash(item), STRUCT##_match(item, tmp),\
-                         STRUCT##_init(new, item), STRUCT##_update(tmp, item),INPLACE)
+#define DefineSimpleCacheLookup(STRUCT, FUNC)                          \
+        DefineCacheLookup(struct STRUCT, h, FUNC##_lookup,             \
+        (struct STRUCT *item, int set), /*no setup */,                 \
+       & FUNC##_cache, FUNC##_hash(item), FUNC##_match(item, tmp),     \
+       STRUCT##_init(new, item), STRUCT##_update(tmp, item))
+
 
 #define cache_for_each(pos, detail, index, member)                                             \
        for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ;                \
index 6b073c2e693037ac6c7c470cdde8b312a9bb9214..aadb4e8d6aa7ca1a2da41dd2680840708d40bb8a 100644 (file)
@@ -259,7 +259,7 @@ static struct cache_detail rsi_cache = {
        .cache_parse    = rsi_parse,
 };
 
-static DefineSimpleCacheLookup(rsi, 0)
+static DefineSimpleCacheLookup(rsi, rsi)
 
 /*
  * The rpcsec_context cache is used to store a context that is
@@ -446,7 +446,7 @@ static struct cache_detail rsc_cache = {
        .cache_parse    = rsc_parse,
 };
 
-static DefineSimpleCacheLookup(rsc, 0);
+static DefineSimpleCacheLookup(rsc, rsc);
 
 static struct rsc *
 gss_svc_searchbyctx(struct xdr_netobj *handle)
index 17e8b2a3130c1b1f8373ab92c12dd34f5cb8356d..7ddf068b5b258282b09a70327c55a62e4a29a8dc 100644 (file)
@@ -258,7 +258,7 @@ struct cache_detail ip_map_cache = {
        .cache_show     = ip_map_show,
 };
 
-static DefineSimpleCacheLookup(ip_map, 0)
+static DefineSimpleCacheLookup(ip_map, ip_map)
 
 
 int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom)