aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/host.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-26 04:37:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:55 -0500
commit353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (patch)
treebffabd9a5a493ffd2b41dd825e71e848ca6ba6d7 /fs/lockd/host.c
parente655a250d5fc12b6dfe0d436180ba4a3bfffdc9f (diff)
[PATCH] sem2mutex: fs/
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org> Cc: Robert Love <rml@tech9.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Neil Brown <neilb@cse.unsw.edu.au> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/lockd/host.c')
-rw-r--r--fs/lockd/host.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 112ebf8b8dfe..729ac427d359 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -16,6 +16,7 @@
16#include <linux/sunrpc/svc.h> 16#include <linux/sunrpc/svc.h>
17#include <linux/lockd/lockd.h> 17#include <linux/lockd/lockd.h>
18#include <linux/lockd/sm_inter.h> 18#include <linux/lockd/sm_inter.h>
19#include <linux/mutex.h>
19 20
20 21
21#define NLMDBG_FACILITY NLMDBG_HOSTCACHE 22#define NLMDBG_FACILITY NLMDBG_HOSTCACHE
@@ -30,7 +31,7 @@
30static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH]; 31static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH];
31static unsigned long next_gc; 32static unsigned long next_gc;
32static int nrhosts; 33static int nrhosts;
33static DECLARE_MUTEX(nlm_host_sema); 34static DEFINE_MUTEX(nlm_host_mutex);
34 35
35 36
36static void nlm_gc_hosts(void); 37static void nlm_gc_hosts(void);
@@ -71,7 +72,7 @@ nlm_lookup_host(int server, struct sockaddr_in *sin,
71 hash = NLM_ADDRHASH(sin->sin_addr.s_addr); 72 hash = NLM_ADDRHASH(sin->sin_addr.s_addr);
72 73
73 /* Lock hash table */ 74 /* Lock hash table */
74 down(&nlm_host_sema); 75 mutex_lock(&nlm_host_mutex);
75 76
76 if (time_after_eq(jiffies, next_gc)) 77 if (time_after_eq(jiffies, next_gc))
77 nlm_gc_hosts(); 78 nlm_gc_hosts();
@@ -91,7 +92,7 @@ nlm_lookup_host(int server, struct sockaddr_in *sin,
91 nlm_hosts[hash] = host; 92 nlm_hosts[hash] = host;
92 } 93 }
93 nlm_get_host(host); 94 nlm_get_host(host);
94 up(&nlm_host_sema); 95 mutex_unlock(&nlm_host_mutex);
95 return host; 96 return host;
96 } 97 }
97 } 98 }
@@ -130,7 +131,7 @@ nlm_lookup_host(int server, struct sockaddr_in *sin,
130 next_gc = 0; 131 next_gc = 0;
131 132
132nohost: 133nohost:
133 up(&nlm_host_sema); 134 mutex_unlock(&nlm_host_mutex);
134 return host; 135 return host;
135} 136}
136 137
@@ -141,19 +142,19 @@ nlm_find_client(void)
141 * and return it 142 * and return it
142 */ 143 */
143 int hash; 144 int hash;
144 down(&nlm_host_sema); 145 mutex_lock(&nlm_host_mutex);
145 for (hash = 0 ; hash < NLM_HOST_NRHASH; hash++) { 146 for (hash = 0 ; hash < NLM_HOST_NRHASH; hash++) {
146 struct nlm_host *host, **hp; 147 struct nlm_host *host, **hp;
147 for (hp = &nlm_hosts[hash]; (host = *hp) != 0; hp = &host->h_next) { 148 for (hp = &nlm_hosts[hash]; (host = *hp) != 0; hp = &host->h_next) {
148 if (host->h_server && 149 if (host->h_server &&
149 host->h_killed == 0) { 150 host->h_killed == 0) {
150 nlm_get_host(host); 151 nlm_get_host(host);
151 up(&nlm_host_sema); 152 mutex_unlock(&nlm_host_mutex);
152 return host; 153 return host;
153 } 154 }
154 } 155 }
155 } 156 }
156 up(&nlm_host_sema); 157 mutex_unlock(&nlm_host_mutex);
157 return NULL; 158 return NULL;
158} 159}
159 160
@@ -265,7 +266,7 @@ nlm_shutdown_hosts(void)
265 int i; 266 int i;
266 267
267 dprintk("lockd: shutting down host module\n"); 268 dprintk("lockd: shutting down host module\n");
268 down(&nlm_host_sema); 269 mutex_lock(&nlm_host_mutex);
269 270
270 /* First, make all hosts eligible for gc */ 271 /* First, make all hosts eligible for gc */
271 dprintk("lockd: nuking all hosts...\n"); 272 dprintk("lockd: nuking all hosts...\n");
@@ -276,7 +277,7 @@ nlm_shutdown_hosts(void)
276 277
277 /* Then, perform a garbage collection pass */ 278 /* Then, perform a garbage collection pass */
278 nlm_gc_hosts(); 279 nlm_gc_hosts();
279 up(&nlm_host_sema); 280 mutex_unlock(&nlm_host_mutex);
280 281
281 /* complain if any hosts are left */ 282 /* complain if any hosts are left */
282 if (nrhosts) { 283 if (nrhosts) {