staging/lustre/lnet: remove kiblnd_debug_conn/rx/tx
PATCH 1/6 staging/lustre/lnet: remove kiblnd_debug_conn/rx/tx
They are not called by anyone and cause gcc warning:drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:609: warning: ‘kiblnd_debug_conn’ defined but not used drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:589: warning: ‘kiblnd_debug_rx’ defined but not used drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:597: warning: ‘kiblnd_debug_tx’ defined but not used
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 68 -------------------- 1 files changed, 0 insertions(+), 68 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +0 -68
@@ -584,74 +584,6 @@ kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index)return NULL ; } -static void -kiblnd_debug_rx (kib_rx_t *rx) -{ -CDEBUG (D_CONSOLE ," %p status %d msg_type %x cred %d\n" , - rx, rx->rx_status, rx->rx_msg->ibm_type, - rx->rx_msg->ibm_credits); -} - -static void -kiblnd_debug_tx (kib_tx_t *tx) -{ -CDEBUG (D_CONSOLE ," %p snd %d q %d w %d rc %d dl %lx " -"cookie " LPX64 " msg %s%s type %x cred %d\n" , - tx, tx->tx_sending, tx->tx_queued, tx->tx_waiting, - tx->tx_status, tx->tx_deadline, tx->tx_cookie, - tx->tx_lntmsg[0 ] ==NULL ?"-" :"!" , - tx->tx_lntmsg[1 ] ==NULL ?"-" :"!" , - tx->tx_msg->ibm_type, tx->tx_msg->ibm_credits); -} - -static void -kiblnd_debug_conn (kib_conn_t *conn) -{ -struct list_head *tmp; -int i; - -spin_lock (&conn->ibc_lock); - -CDEBUG (D_CONSOLE ,"conn[%d] %p [version %x] -> %s: \n" , -atomic_read (&conn->ibc_refcount), conn, - conn->ibc_version,libcfs_nid2str (conn->ibc_peer->ibp_nid)); -CDEBUG (D_CONSOLE ," state %d nposted %d/%d cred %d o_cred %d r_cred %d\n" , - conn->ibc_state, conn->ibc_noops_posted, - conn->ibc_nsends_posted, conn->ibc_credits, - conn->ibc_outstanding_credits, conn->ibc_reserved_credits); -CDEBUG (D_CONSOLE ," comms_err %d\n" , conn->ibc_comms_error); - -CDEBUG (D_CONSOLE ," early_rxs:\n" ); -list_for_each (tmp, &conn->ibc_early_rxs) -kiblnd_debug_rx (list_entry (tmp, kib_rx_t, rx_list)); - -CDEBUG (D_CONSOLE ," tx_noops:\n" ); -list_for_each (tmp, &conn->ibc_tx_noops) -kiblnd_debug_tx (list_entry (tmp, kib_tx_t, tx_list)); - -CDEBUG (D_CONSOLE ," tx_queue_nocred:\n" ); -list_for_each (tmp, &conn->ibc_tx_queue_nocred) -kiblnd_debug_tx (list_entry (tmp, kib_tx_t, tx_list)); - -CDEBUG (D_CONSOLE ," tx_queue_rsrvd:\n" ); -list_for_each (tmp, &conn->ibc_tx_queue_rsrvd) -kiblnd_debug_tx (list_entry (tmp, kib_tx_t, tx_list)); - -CDEBUG (D_CONSOLE ," tx_queue:\n" ); -list_for_each (tmp, &conn->ibc_tx_queue) -kiblnd_debug_tx (list_entry (tmp, kib_tx_t, tx_list)); - -CDEBUG (D_CONSOLE ," active_txs:\n" ); -list_for_each (tmp, &conn->ibc_active_txs) -kiblnd_debug_tx (list_entry (tmp, kib_tx_t, tx_list)); - -CDEBUG (D_CONSOLE ," rxs:\n" ); -for (i =0 ; i <IBLND_RX_MSGS (conn->ibc_version); i++) -kiblnd_debug_rx (&conn->ibc_rxs[i]); - -spin_unlock (&conn->ibc_lock); -} -int kiblnd_translate_mtu (int value) {
Signature · 1 line
1.7.7.6
PATCH 2/6 staging/lustre/libcfs: remove cfs_strncasecmp
The only difference against generic strncasecmp() is that cfs_strncasecmp() check NULL pointers and zero length parameter, which all callers have already taken care of.
--- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 +- .../staging/lustre/lustre/libcfs/libcfs_string.c | 24 +------------------ 2 files changed, 4 insertions(+), 24 deletions(-)
drivers/staging/lustre/lnet/lnet/router_proc.c +2 -2
@@ -837,8 +837,8 @@ static int __proc_lnet_portal_rotor(void *data, int write, rc = -EINVAL ;lnet_res_lock (0 );for (i =0 ; portal_rotors[i].pr_name !=NULL ; i++) { -if (cfs_strncasecmp (portal_rotors[i].pr_name, tmp, -strlen (portal_rotors[i].pr_name)) ==0 ) { +if (strncasecmp (portal_rotors[i].pr_name, tmp, +strlen (portal_rotors[i].pr_name)) ==0 ) { portal_rotor = portal_rotors[i].pr_value; rc =0 ;break ;
drivers/staging/lustre/lustre/libcfs/libcfs_string.c +2 -22
@@ -42,26 +42,6 @@#include <linux/libcfs/libcfs.h> -/* non-0 = don't match */ -int cfs_strncasecmp (const char *s1,const char *s2,size_t n) -{ -if (s1 ==NULL || s2 ==NULL ) -return 1 ; - -if (n ==0 ) -return 0 ; - -while (n-- !=0 &&tolower (*s1) ==tolower (*s2)) { -if (n ==0 || *s1 =='\0' || *s2 =='\0' ) -break ; - s1++; - s2++; - } - -return tolower (*(unsigned char *)s1) -tolower (*(unsigned char *)s2); -} -EXPORT_SYMBOL (cfs_strncasecmp); -/* Convert a text string to a bitmask */ int cfs_str2mask (const char *str,const char *(*bit2str)(int bit),int *oldmask,int minmask,int allmask)
@@ -101,7 +81,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), debugstr =bit2str (i);if (debugstr !=NULL &&strlen (debugstr) == len && -cfs_strncasecmp (str, debugstr, len) ==0 ) { +strncasecmp (str, debugstr, len) ==0 ) {if (op =='-' ) newmask &= ~(1 << i);else
@@ -111,7 +91,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), } }if (!found && len ==3 && - (cfs_strncasecmp (str,"ALL" , len) ==0 )) { + (strncasecmp (str,"ALL" , len) ==0 )) {if (op =='-' ) newmask = minmask;else
Signature · 1 line
1.7.7.6
PATCH 3/6 staging/lustre/libcfs_string.h: don't export internal functions
cfs_expr_list_print is removed due to no callers. Other internal functions are held unexported.
--- .../lustre/include/linux/libcfs/libcfs_string.h | 3 --- .../staging/lustre/lustre/libcfs/libcfs_string.c | 20 +------------------- 2 files changed, 1 insertions(+), 22 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +0 -3
@@ -109,8 +109,6 @@ char *cfs_trimwhite(char *str);int cfs_gettok (struct cfs_lstr *next,char delim,struct cfs_lstr *res);int cfs_str2num_check (char *str,int nob,unsigned *num,unsigned min,unsigned max); -int cfs_range_expr_parse (struct cfs_lstr *src,unsigned min,unsigned max, -int single_tok,struct cfs_range_expr **expr);int cfs_expr_list_match (__u32 value,struct cfs_expr_list *expr_list);int cfs_expr_list_values (struct cfs_expr_list *expr_list,int max,__u32 **values);
@@ -124,7 +122,6 @@ cfs_expr_list_values_free(__u32 *values, int num) }void cfs_expr_list_free (struct cfs_expr_list *expr_list); -void cfs_expr_list_print (struct cfs_expr_list *expr_list);int cfs_expr_list_parse (char *str,int len,unsigned min,unsigned max,struct cfs_expr_list **elpp);void cfs_expr_list_free_list (struct list_head *list);
drivers/staging/lustre/lustre/libcfs/libcfs_string.c +1 -19
@@ -109,7 +109,6 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), *oldmask = newmask;return 0 ; } -EXPORT_SYMBOL (cfs_str2mask);/* get the first string out of @str */ char *cfs_firststr (char *str,size_t size)
@@ -213,7 +212,6 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) res->ls_len = end - res->ls_str +1 ;return 1 ; } -EXPORT_SYMBOL (cfs_gettok);/** * Converts string to integer.
@@ -242,7 +240,6 @@ cfs_str2num_check(char *str, int nob, unsigned *num,return (*num >= min && *num <= max); } -EXPORT_SYMBOL (cfs_str2num_check);/** * Parses \<range_expr\> token of the syntax. If \a bracketed is false,
@@ -257,7 +254,7 @@ EXPORT_SYMBOL(cfs_str2num_check);* \retval 0 will be returned if it can be parsed, otherwise -EINVAL or * -ENOMEM will be returned. */ -int +static int cfs_range_expr_parse (struct cfs_lstr *src,unsigned min,unsigned max,int bracketed,struct cfs_range_expr **expr) {
@@ -320,7 +317,6 @@ cfs_range_expr_parse(struct cfs_lstr *src, unsigned min, unsigned max,LIBCFS_FREE (re,sizeof (*re));return -EINVAL ; } -EXPORT_SYMBOL (cfs_range_expr_parse);/** * Matches value (\a value) against ranges expression list \a expr_list.
@@ -341,7 +337,6 @@ cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list)return 0 ; } -EXPORT_SYMBOL (cfs_expr_list_match);/** * Convert express list (\a expr_list) to an array of all matched values
@@ -412,18 +407,6 @@ cfs_expr_list_free(struct cfs_expr_list *expr_list) }EXPORT_SYMBOL (cfs_expr_list_free); -void -cfs_expr_list_print (struct cfs_expr_list *expr_list) -{ -struct cfs_range_expr *expr; - -list_for_each_entry (expr, &expr_list->el_exprs, re_link) { -CDEBUG (D_WARNING ,"%d-%d/%d\n" , - expr->re_lo, expr->re_hi, expr->re_stride); - } -} -EXPORT_SYMBOL (cfs_expr_list_print); -/** * Parses \<cfs_expr_list\> token of the syntax. *
@@ -506,7 +489,6 @@ cfs_expr_list_free_list(struct list_head *list)cfs_expr_list_free (el); } } -EXPORT_SYMBOL (cfs_expr_list_free_list);int cfs_ip_addr_parse (char *str,int len,struct list_head *list)
Signature · 1 line
1.7.7.6
PATCH 4/6 staging/lustre/libcfs: remove cfs_iswhite
Kernel provides isspace().
--- .../lustre/include/linux/libcfs/libcfs_string.h | 15 --------------- drivers/staging/lustre/lnet/lnet/config.c | 12 ++++++------ .../staging/lustre/lustre/libcfs/libcfs_string.c | 10 +++++----- 3 files changed, 11 insertions(+), 26 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +0 -15
@@ -90,21 +90,6 @@ struct cfs_expr_list {struct list_head el_exprs; }; -static inline int -cfs_iswhite (char c) -{ -switch (c) { -case ' ' : -case '\t' : -case '\n' : -case '\r' : -return 1 ; -default : -break ; - } -return 0 ; -} -char *cfs_trimwhite (char *str);int cfs_gettok (struct cfs_lstr *next,char delim,struct cfs_lstr *res); int cfs_str2num_check(char *str, int nob, unsigned *num,
drivers/staging/lustre/lnet/lnet/config.c +6 -6
@@ -443,7 +443,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)/* Split 'str' into separate commands */ for (;;) {/* skip leading whitespace */ -while (cfs_iswhite (*str)) +while (isspace (*str)) str++;/* scan for separator or comment */
@@ -460,7 +460,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str) }for (i =0 ; i < nob; i++) -if (cfs_iswhite (str[i])) +if (isspace (str[i])) ltb->ltb_text[i] =' ' ;else ltb->ltb_text[i] = str[i];
@@ -667,7 +667,7 @@ lnet_parse_route(char *str, int *im_a_router) sep = str;for (;;) {/* scan for token start */ -while (cfs_iswhite (*sep)) +while (isspace (*sep)) sep++;if (*sep ==0 ) {if (ntokens < (got_hops ?3 :2 ))
@@ -679,7 +679,7 @@ lnet_parse_route(char *str, int *im_a_router) token = sep++;/* scan for token end */ -while (*sep !=0 && !cfs_iswhite (*sep)) +while (*sep !=0 && !isspace (*sep)) sep++;if (*sep !=0 ) *sep++ =0 ;
@@ -858,7 +858,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) sep = tokens;for (;;) {/* scan for token start */ -while (cfs_iswhite (*sep)) +while (isspace (*sep)) sep++;if (*sep ==0 )break ;
@@ -866,7 +866,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) token = sep++;/* scan for token end */ -while (*sep !=0 && !cfs_iswhite (*sep)) +while (*sep !=0 && !isspace (*sep)) sep++;if (*sep !=0 ) *sep++ =0 ;
drivers/staging/lustre/lustre/libcfs/libcfs_string.c +5 -5
@@ -143,12 +143,12 @@ cfs_trimwhite(char *str) {char *end; -while (cfs_iswhite (*str)) +while (isspace (*str)) str++; end = str +strlen (str);while (end > str) { -if (!cfs_iswhite (end[-1 ])) +if (!isspace (end[-1 ]))break ; end--; }
@@ -178,7 +178,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)/* skip leading white spaces */ while (next->ls_len) { -if (!cfs_iswhite (*next->ls_str)) +if (!isspace (*next->ls_str))break ; next->ls_str++; next->ls_len--;
@@ -205,7 +205,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)/* skip ending whitespaces */ while (--end != res->ls_str) { -if (!cfs_iswhite (*end)) +if (!isspace (*end))break ; }
@@ -234,7 +234,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num,return 0 ;for (; endp < str + nob; endp++) { -if (!cfs_iswhite (*endp)) +if (!isspace (*endp))return 0 ; }
Signature · 1 line
1.7.7.6
PATCH 5/6 staging/lustre/libcfs: remove obsolete function declaration
--- .../lustre/include/linux/libcfs/libcfs_string.h | 12 ------------ 1 files changed, 0 insertions(+), 12 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +0 -12
@@ -49,18 +49,6 @@ int cfs_strncasecmp(const char *s1, const char *s2, size_t n);/* Convert a text string to a bitmask */ int cfs_str2mask (const char *str,const char *(*bit2str)(int bit),int *oldmask,int minmask,int allmask); - -/* Allocate space for and copy an existing string. -* Must free with kfree(). -*/ -char *cfs_strdup (const char *str,u_int32_t flags); - -/* safe vsnprintf */ -int cfs_vsnprintf (char *buf,size_t size,const char *fmt,va_list args); - -/* safe snprintf */ -int cfs_snprintf (char *buf,size_t size,const char *fmt, ...); -/* trim leading and trailing space characters */ char *cfs_firststr (char *str,size_t size);
Signature · 1 line
1.7.7.6
PATCH 6/6 staging/lustre/libcfs: remove NIDSTR_LOCK/UNLOCK
--- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/libcfs/nidstrings.c +2 -5
@@ -65,23 +65,20 @@ void libcfs_init_nidstrings(void)spin_lock_init (&libcfs_nidstring_lock); } -# define NIDSTR_LOCK (f) spin_lock_irqsave(&libcfs_nidstring_lock, f) -# define NIDSTR_UNLOCK (f) spin_unlock_irqrestore(&libcfs_nidstring_lock, f) -static char *libcfs_next_nidstring (void ) {char *str;unsigned long flags; -NIDSTR_LOCK (flags); +spin_lock_irqsave (&libcfs_nidstring_lock, flags); str = libcfs_nidstrings[libcfs_nidstring_idx++];if (libcfs_nidstring_idx ==sizeof (libcfs_nidstrings)/sizeof (libcfs_nidstrings[0 ])) libcfs_nidstring_idx =0 ; -NIDSTR_UNLOCK (flags); +spin_unlock_irqrestore (&libcfs_nidstring_lock, flags);return str; }
Signature · 1 line
1.7.7.6
Greg KH
maintainerQuoted 7 lines · Peng Tao
They are not called by anyone and cause gcc warning:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:609: warning: ‘kiblnd_debug_conn’ defined but not useddrivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:589: warning: ‘kiblnd_debug_rx’ defined but not useddrivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:597: warning: ‘kiblnd_debug_tx’ defined but not used
Don't wrap error messages, it's not needed.