diff options
| author | Chuck Lever <chuck.lever@oracle.com> | 2008-12-05 19:04:01 -0500 |
|---|---|---|
| committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-01-06 11:53:54 -0500 |
| commit | 92fd91b998a5216a6d6606704e71d541a180216c (patch) | |
| tree | e3c181450d40e3d448a48c560aac858ea0e7aee5 | |
| parent | 8c7378fd2a5f22016542931b887a2ae98d146eaf (diff) | |
NLM: Remove "create" argument from nsm_find()
Clean up: nsm_find() now has only one caller, and that caller
unconditionally sets the @create argument. Thus the @create
argument is no longer needed.
Since nsm_find() now has a more specific purpose, pick a more
appropriate name for it.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
| -rw-r--r-- | fs/lockd/host.c | 4 | ||||
| -rw-r--r-- | fs/lockd/mon.c | 23 | ||||
| -rw-r--r-- | include/linux/lockd/lockd.h | 6 |
3 files changed, 14 insertions, 19 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 230de93fc048..e5a65df4c0cd 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
| @@ -159,8 +159,8 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni) | |||
| 159 | atomic_inc(&nsm->sm_count); | 159 | atomic_inc(&nsm->sm_count); |
| 160 | else { | 160 | else { |
| 161 | host = NULL; | 161 | host = NULL; |
| 162 | nsm = nsm_find(ni->sap, ni->salen, | 162 | nsm = nsm_get_handle(ni->sap, ni->salen, |
| 163 | ni->hostname, ni->hostname_len, 1); | 163 | ni->hostname, ni->hostname_len); |
| 164 | if (!nsm) { | 164 | if (!nsm) { |
| 165 | dprintk("lockd: nlm_lookup_host failed; " | 165 | dprintk("lockd: nlm_lookup_host failed; " |
| 166 | "no nsm handle\n"); | 166 | "no nsm handle\n"); |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index e46903995c99..740702216042 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
| @@ -240,24 +240,22 @@ static void nsm_init_private(struct nsm_handle *nsm) | |||
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | /** | 242 | /** |
| 243 | * nsm_find - Find or create a cached nsm_handle | 243 | * nsm_get_handle - Find or create a cached nsm_handle |
| 244 | * @sap: pointer to socket address of handle to find | 244 | * @sap: pointer to socket address of handle to find |
| 245 | * @salen: length of socket address | 245 | * @salen: length of socket address |
| 246 | * @hostname: pointer to C string containing hostname to find | 246 | * @hostname: pointer to C string containing hostname to find |
| 247 | * @hostname_len: length of C string | 247 | * @hostname_len: length of C string |
| 248 | * @create: one means create new handle if not found in cache | ||
| 249 | * | 248 | * |
| 250 | * Behavior is modulated by the global nsm_use_hostnames variable | 249 | * Behavior is modulated by the global nsm_use_hostnames variable. |
| 251 | * and by the @create argument. | ||
| 252 | * | 250 | * |
| 253 | * Returns a cached nsm_handle after bumping its ref count, or if | 251 | * Returns a cached nsm_handle after bumping its ref count, or |
| 254 | * @create is set, returns a fresh nsm_handle if a handle that | 252 | * returns a fresh nsm_handle if a handle that matches @sap and/or |
| 255 | * matches @sap and/or @hostname cannot be found in the handle cache. | 253 | * @hostname cannot be found in the handle cache. Returns NULL if |
| 256 | * Returns NULL if an error occurs. | 254 | * an error occurs. |
| 257 | */ | 255 | */ |
| 258 | struct nsm_handle *nsm_find(const struct sockaddr *sap, const size_t salen, | 256 | struct nsm_handle *nsm_get_handle(const struct sockaddr *sap, |
| 259 | const char *hostname, const size_t hostname_len, | 257 | const size_t salen, const char *hostname, |
| 260 | const int create) | 258 | const size_t hostname_len) |
| 261 | { | 259 | { |
| 262 | struct nsm_handle *nsm = NULL; | 260 | struct nsm_handle *nsm = NULL; |
| 263 | struct nsm_handle *pos; | 261 | struct nsm_handle *pos; |
| @@ -297,9 +295,6 @@ retry: | |||
| 297 | } | 295 | } |
| 298 | spin_unlock(&nsm_lock); | 296 | spin_unlock(&nsm_lock); |
| 299 | 297 | ||
| 300 | if (!create) | ||
| 301 | return NULL; | ||
| 302 | |||
| 303 | nsm = kzalloc(sizeof(*nsm) + hostname_len + 1, GFP_KERNEL); | 298 | nsm = kzalloc(sizeof(*nsm) + hostname_len + 1, GFP_KERNEL); |
| 304 | if (nsm == NULL) | 299 | if (nsm == NULL) |
| 305 | return NULL; | 300 | return NULL; |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 5e3ad926de89..1ccd49e97a7f 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
| @@ -247,10 +247,10 @@ void nlm_host_rebooted(const struct nlm_reboot *); | |||
| 247 | int nsm_monitor(const struct nlm_host *host); | 247 | int nsm_monitor(const struct nlm_host *host); |
| 248 | void nsm_unmonitor(const struct nlm_host *host); | 248 | void nsm_unmonitor(const struct nlm_host *host); |
| 249 | 249 | ||
| 250 | struct nsm_handle *nsm_find(const struct sockaddr *sap, const size_t salen, | 250 | struct nsm_handle *nsm_get_handle(const struct sockaddr *sap, |
| 251 | const size_t salen, | ||
| 251 | const char *hostname, | 252 | const char *hostname, |
| 252 | const size_t hostname_len, | 253 | const size_t hostname_len); |
| 253 | const int create); | ||
| 254 | struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info); | 254 | struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info); |
| 255 | void nsm_release(struct nsm_handle *nsm); | 255 | void nsm_release(struct nsm_handle *nsm); |
| 256 | 256 | ||
