Browse Source

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>
Chuck Lever 16 years ago
parent
commit
92fd91b998
3 changed files with 14 additions and 19 deletions
  1. 2 2
      fs/lockd/host.c
  2. 9 14
      fs/lockd/mon.c
  3. 3 3
      include/linux/lockd/lockd.h

+ 2 - 2
fs/lockd/host.c

@@ -159,8 +159,8 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
 		atomic_inc(&nsm->sm_count);
 		atomic_inc(&nsm->sm_count);
 	else {
 	else {
 		host = NULL;
 		host = NULL;
-		nsm = nsm_find(ni->sap, ni->salen,
-				ni->hostname, ni->hostname_len, 1);
+		nsm = nsm_get_handle(ni->sap, ni->salen,
+					ni->hostname, ni->hostname_len);
 		if (!nsm) {
 		if (!nsm) {
 			dprintk("lockd: nlm_lookup_host failed; "
 			dprintk("lockd: nlm_lookup_host failed; "
 				"no nsm handle\n");
 				"no nsm handle\n");

+ 9 - 14
fs/lockd/mon.c

@@ -240,24 +240,22 @@ static void nsm_init_private(struct nsm_handle *nsm)
 }
 }
 
 
 /**
 /**
- * nsm_find - Find or create a cached nsm_handle
+ * nsm_get_handle - Find or create a cached nsm_handle
  * @sap: pointer to socket address of handle to find
  * @sap: pointer to socket address of handle to find
  * @salen: length of socket address
  * @salen: length of socket address
  * @hostname: pointer to C string containing hostname to find
  * @hostname: pointer to C string containing hostname to find
  * @hostname_len: length of C string
  * @hostname_len: length of C string
- * @create: one means create new handle if not found in cache
  *
  *
- * Behavior is modulated by the global nsm_use_hostnames variable
- * and by the @create argument.
+ * Behavior is modulated by the global nsm_use_hostnames variable.
  *
  *
- * Returns a cached nsm_handle after bumping its ref count, or if
- * @create is set, returns a fresh nsm_handle if a handle that
- * matches @sap and/or @hostname cannot be found in the handle cache.
- * Returns NULL if an error occurs.
+ * Returns a cached nsm_handle after bumping its ref count, or
+ * returns a fresh nsm_handle if a handle that matches @sap and/or
+ * @hostname cannot be found in the handle cache.  Returns NULL if
+ * an error occurs.
  */
  */
-struct nsm_handle *nsm_find(const struct sockaddr *sap, const size_t salen,
-			    const char *hostname, const size_t hostname_len,
-			    const int create)
+struct nsm_handle *nsm_get_handle(const struct sockaddr *sap,
+				  const size_t salen, const char *hostname,
+				  const size_t hostname_len)
 {
 {
 	struct nsm_handle *nsm = NULL;
 	struct nsm_handle *nsm = NULL;
 	struct nsm_handle *pos;
 	struct nsm_handle *pos;
@@ -297,9 +295,6 @@ retry:
 	}
 	}
 	spin_unlock(&nsm_lock);
 	spin_unlock(&nsm_lock);
 
 
-	if (!create)
-		return NULL;
-
 	nsm = kzalloc(sizeof(*nsm) + hostname_len + 1, GFP_KERNEL);
 	nsm = kzalloc(sizeof(*nsm) + hostname_len + 1, GFP_KERNEL);
 	if (nsm == NULL)
 	if (nsm == NULL)
 		return NULL;
 		return NULL;

+ 3 - 3
include/linux/lockd/lockd.h

@@ -247,10 +247,10 @@ void		  nlm_host_rebooted(const struct nlm_reboot *);
 int		  nsm_monitor(const struct nlm_host *host);
 int		  nsm_monitor(const struct nlm_host *host);
 void		  nsm_unmonitor(const struct nlm_host *host);
 void		  nsm_unmonitor(const struct nlm_host *host);
 
 
-struct nsm_handle *nsm_find(const struct sockaddr *sap, const size_t salen,
+struct nsm_handle *nsm_get_handle(const struct sockaddr *sap,
+					const size_t salen,
 					const char *hostname,
 					const char *hostname,
-					const size_t hostname_len,
-					const int create);
+					const size_t hostname_len);
 struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info);
 struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info);
 void		  nsm_release(struct nsm_handle *nsm);
 void		  nsm_release(struct nsm_handle *nsm);