]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
knfsd: Remove NLM_HOST_MAX and associated logic.
authorNeilBrown <neilb@suse.de>
Fri, 8 Feb 2008 02:03:37 +0000 (13:03 +1100)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Wed, 23 Apr 2008 20:13:35 +0000 (16:13 -0400)
Lockd caches information about hosts that have recently held locks to
expedite the taking of further locks.

It periodically discards this information for hosts that have not been
used for a few minutes.

lockd currently has a value NLM_HOST_MAX, and changes the 'garbage
collection' behaviour when the number of hosts exceeds this threshold.

However its behaviour is strange, and likely not what was intended.
When the number of hosts exceeds the max, it scans *less* often (every
2 minutes vs every minute) and allows unused host information to
remain around longer (5 minutes instead of 2).

Having this limit is of dubious value anyway, and we have not
suffered from the code not getting the limit right, so remove the
limit altogether.  We go with the larger values (discard 5 minute old
hosts every 2 minutes) as they are probably safer.

Maybe the periodic garbage collection should be replace to with
'shrinker' handler so we just respond to memory pressure....

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
fs/lockd/host.c

index f1ef49fff118ea8aa8322dd4404e0ca65ea3e518..c3f119426d832ea396ebffbcd2820e335477bd8b 100644 (file)
 
 
 #define NLMDBG_FACILITY                NLMDBG_HOSTCACHE
-#define NLM_HOST_MAX           64
 #define NLM_HOST_NRHASH                32
 #define NLM_ADDRHASH(addr)     (ntohl(addr) & (NLM_HOST_NRHASH-1))
 #define NLM_HOST_REBIND                (60 * HZ)
-#define NLM_HOST_EXPIRE                ((nrhosts > NLM_HOST_MAX)? 300 * HZ : 120 * HZ)
-#define NLM_HOST_COLLECT       ((nrhosts > NLM_HOST_MAX)? 120 * HZ :  60 * HZ)
+#define NLM_HOST_EXPIRE                (300 * HZ)
+#define NLM_HOST_COLLECT       (120 * HZ)
 
 static struct hlist_head       nlm_hosts[NLM_HOST_NRHASH];
 static unsigned long           next_gc;
@@ -142,9 +141,7 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
        INIT_LIST_HEAD(&host->h_granted);
        INIT_LIST_HEAD(&host->h_reclaim);
 
-       if (++nrhosts > NLM_HOST_MAX)
-               next_gc = 0;
-
+       nrhosts++;
 out:
        mutex_unlock(&nlm_host_mutex);
        return host;