LNet/libcfs checkpatch and style cleanups
cover LNet/libcfs checkpatch and style cleanups
Sweep of the LNet/libcfs layer to cleanup various
checkpatch issues. Also more cleanups to match
the kernel coding style.
James Simmons (19):
staging: lustre: lnet: don't use bare unsigned
staging: lustre: lnet: resolve trailing */ checkpatch errors
staging: lustre: libcfs: use static const char const * for a suffixes array
staging: lustre: libcfs: remove explict test of NULL variable
staging: lustre: libcfs: fix aligment issue
staging: lustre: lnet: fix misspelled word destroy
staging: lustre: lnet: remove unused lib_me_dump
staging: lustre: lnet: missing blank line after declaration
staging: lustre: lnet: fill in real lnet_md_t
staging: lustre: lnet: replace uninitialized_var
staging: lustre: libcfs: remove != 0 testing
staging: lustre: libcfs: remove == 0 testing
staging: lustre: libcfs: white space cleanup
staging: lustre: libcfs: fix misspelling of descriptor
staging: lustre: libcfs: Make char * array envp static constant
staging: lustre: libcfs: use pr_* instead of printk
staging: lustre: libcfs: remove use of __u* types
staging: lustre: lnet: use BIT macro in LNet selftest
staging: lustre: lnet: cleanup some of the > 80 line issues
.../staging/lustre/lnet/klnds/socklnd/socklnd.c | 31 +++-- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 132 +++++++++++++------- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 40 ++++-- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 26 +++- drivers/staging/lustre/lnet/libcfs/debug.c | 36 +++--- drivers/staging/lustre/lnet/libcfs/fail.c | 4 +- drivers/staging/lustre/lnet/libcfs/hash.c | 117 +++++++++--------- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_lock.c | 20 ++-- drivers/staging/lustre/lnet/libcfs/libcfs_mem.c | 22 ++-- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 58 +++++----- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 132 ++++++++++---------- .../lustre/lnet/libcfs/linux/linux-crypto.c | 32 +++--- .../lustre/lnet/libcfs/linux/linux-crypto.h | 2 +- .../staging/lustre/lnet/libcfs/linux/linux-debug.c | 20 ++-- .../lustre/lnet/libcfs/linux/linux-module.c | 2 +- .../staging/lustre/lnet/libcfs/linux/linux-prim.c | 10 +- .../lustre/lnet/libcfs/linux/linux-tracefile.c | 28 ++-- drivers/staging/lustre/lnet/libcfs/module.c | 18 ++-- drivers/staging/lustre/lnet/libcfs/prng.c | 2 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 108 ++++++++-------- drivers/staging/lustre/lnet/libcfs/tracefile.h | 28 ++-- drivers/staging/lustre/lnet/libcfs/workitem.c | 50 ++++---- drivers/staging/lustre/lnet/lnet/api-ni.c | 8 +- drivers/staging/lustre/lnet/lnet/lib-me.c | 18 --- drivers/staging/lustre/lnet/lnet/lib-move.c | 1 + drivers/staging/lustre/lnet/lnet/nidstrings.c | 4 +- drivers/staging/lustre/lnet/lnet/router.c | 17 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 2 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 28 +++-- drivers/staging/lustre/lnet/selftest/conrpc.h | 23 ++-- drivers/staging/lustre/lnet/selftest/console.c | 27 +++-- drivers/staging/lustre/lnet/selftest/console.h | 25 ++-- drivers/staging/lustre/lnet/selftest/framework.c | 23 ++-- drivers/staging/lustre/lnet/selftest/ping_test.c | 4 +- drivers/staging/lustre/lnet/selftest/rpc.c | 3 +- drivers/staging/lustre/lnet/selftest/rpc.h | 6 +- drivers/staging/lustre/lnet/selftest/selftest.h | 25 +++-- drivers/staging/lustre/lnet/selftest/timer.c | 7 +- 40 files changed, 621 insertions(+), 526 deletions(-)
PATCH 1/19 staging: lustre: lnet: don't use bare unsigned
Turn all bare unsigned to unsigned int that were
detected by checkpatch in the LNet/libcfs layer.
--- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 4 +- drivers/staging/lustre/lnet/libcfs/debug.c | 2 +- drivers/staging/lustre/lnet/libcfs/hash.c | 26 ++++++++++---------- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 8 +++--- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 6 ++-- drivers/staging/lustre/lnet/lnet/nidstrings.c | 2 +- drivers/staging/lustre/lnet/selftest/conctl.c | 2 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 18 +++++++------ drivers/staging/lustre/lnet/selftest/conrpc.h | 20 ++++++++------- drivers/staging/lustre/lnet/selftest/console.c | 10 ++++--- drivers/staging/lustre/lnet/selftest/console.h | 16 ++++++------ drivers/staging/lustre/lnet/selftest/framework.c | 8 +++--- drivers/staging/lustre/lnet/selftest/ping_test.c | 4 +- drivers/staging/lustre/lnet/selftest/selftest.h | 4 +- 14 files changed, 68 insertions(+), 62 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +2 -2
@@ -216,8 +216,8 @@ struct ksock_nal_data {time64_t ksnd_connd_starting_stamp;/* time stamp of the * last starting connd */ -unsigned ksnd_connd_starting;/* # starting connd */ -unsigned ksnd_connd_running;/* # running connd */ +unsigned int ksnd_connd_starting;/* # starting connd */ +unsigned int ksnd_connd_running;/* # running connd */ spinlock_t ksnd_connd_lock;/* serialise */ struct list_head ksnd_idle_noop_txs;/* list head for freed
drivers/staging/lustre/lnet/libcfs/debug.c +1 -1
@@ -57,7 +57,7 @@ static int libcfs_param_debug_mb_set(const char *val, const struct kernel_param *kp) {int rc; -unsigned num; +unsigned int num; rc =kstrtouint (val,0 , &num);if (rc <0 )
drivers/staging/lustre/lnet/libcfs/hash.c +13 -13
@@ -682,7 +682,7 @@ struct hlist_node *static void cfs_hash_multi_bd_lock (struct cfs_hash *hs,struct cfs_hash_bd *bds, -unsigned n,int excl) +unsigned int n,int excl) {struct cfs_hash_bucket *prev =NULL ;int i;
@@ -704,7 +704,7 @@ struct hlist_node *static void cfs_hash_multi_bd_unlock (struct cfs_hash *hs,struct cfs_hash_bd *bds, -unsigned n,int excl) +unsigned int n,int excl) {struct cfs_hash_bucket *prev =NULL ;int i;
@@ -719,10 +719,10 @@ struct hlist_node *static struct hlist_node *cfs_hash_multi_bd_lookup_locked (struct cfs_hash *hs,struct cfs_hash_bd *bds, -unsigned n,const void *key) +unsigned int n,const void *key) {struct hlist_node *ehnode; -unsigned i; +unsigned int i;cfs_hash_for_each_bd (bds, n, i) { ehnode = cfs_hash_bd_lookup_intent(hs, &bds[i], key, NULL,
@@ -735,12 +735,12 @@ struct hlist_node *static struct hlist_node *cfs_hash_multi_bd_findadd_locked (struct cfs_hash *hs,struct cfs_hash_bd *bds, -unsigned n,const void *key, +unsigned int n,const void *key,struct hlist_node *hnode,int noref) {struct hlist_node *ehnode;int intent; -unsigned i; +unsigned int i;LASSERT (hnode); intent = (!noref *CFS_HS_LOOKUP_MASK_REF ) |CFS_HS_LOOKUP_IT_PEEK ;
@@ -766,7 +766,7 @@ struct hlist_node *static struct hlist_node *cfs_hash_multi_bd_finddel_locked (struct cfs_hash *hs,struct cfs_hash_bd *bds, -unsigned n,const void *key, +unsigned int n,const void *key,struct hlist_node *hnode) {struct hlist_node *ehnode;
@@ -992,10 +992,10 @@ static inline void cfs_hash_depth_wi_cancel(struct cfs_hash *hs) {}#endif /* CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 */ struct cfs_hash * -cfs_hash_create (char *name,unsigned cur_bits,unsigned max_bits, -unsigned bkt_bits,unsigned extra_bytes, -unsigned min_theta,unsigned max_theta, -struct cfs_hash_ops *ops,unsigned flags) +cfs_hash_create (char *name,unsigned int cur_bits,unsigned int max_bits, +unsigned int bkt_bits,unsigned int extra_bytes, +unsigned int min_theta,unsigned int max_theta, +struct cfs_hash_ops *ops,unsigned int flags) {struct cfs_hash *hs;int len;
@@ -1664,7 +1664,7 @@ struct cfs_hash_cond_arg { cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, void *data) { - unsigned i = 0; + unsigned int i = 0;if (cfs_hash_with_no_lock (hs))return -EOPNOTSUPP ;
@@ -1684,7 +1684,7 @@ struct cfs_hash_cond_arg {EXPORT_SYMBOL (cfs_hash_for_each_empty);void -cfs_hash_hlist_for_each (struct cfs_hash *hs,unsigned hindex, +cfs_hash_hlist_for_each (struct cfs_hash *hs,unsigned int hindex,cfs_hash_for_each_cb_t func,void *data) {struct hlist_head *hhead;
drivers/staging/lustre/lnet/libcfs/libcfs_string.c +4 -4
@@ -222,8 +222,8 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),* \retval 0 otherwise */ int -cfs_str2num_check (char *str,int nob,unsigned *num, -unsigned min,unsigned max) +cfs_str2num_check (char *str,int nob,unsigned int *num, +unsigned int min,unsigned int max) {bool all_numbers = true;char *endp, cache;
@@ -273,7 +273,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),* -ENOMEM will be returned. */ static int -cfs_range_expr_parse (struct cfs_lstr *src,unsigned min,unsigned max, +cfs_range_expr_parse (struct cfs_lstr *src,unsigned int min,unsigned int max,int bracketed,struct cfs_range_expr **expr) {struct cfs_range_expr *re;
@@ -501,7 +501,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),* \retval -errno otherwise */ int -cfs_expr_list_parse (char *str,int len,unsigned min,unsigned max, +cfs_expr_list_parse (char *str,int len,unsigned int min,unsigned int max,struct cfs_expr_list **elpp) {struct cfs_expr_list *expr_list;
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +3 -3
@@ -678,9 +678,9 @@ struct cfs_cpt_table *static unsigned int cfs_cpt_num_estimate (void ) { -unsigned nnode =num_online_nodes (); -unsigned ncpu =num_online_cpus (); -unsigned ncpt; +unsigned int nnode =num_online_nodes (); +unsigned int ncpu =num_online_cpus (); +unsigned int ncpt;if (ncpu <=CPT_WEIGHT_MIN ) { ncpt =1 ;
drivers/staging/lustre/lnet/lnet/nidstrings.c +1 -1
@@ -193,7 +193,7 @@ struct addrrange {struct netstrfns *nf;struct nidrange *nr;int endlen; -unsigned netnum; +unsigned int netnum;if (src->ls_len >=LNET_NIDSTR_SIZE )return NULL ;
drivers/staging/lustre/lnet/selftest/conctl.c +1 -1
@@ -315,7 +315,7 @@static int lst_nodes_add_ioctl (lstio_group_nodes_args_t *args) { -unsigned feats; +unsigned int feats;int rc;char *name;
drivers/staging/lustre/lnet/selftest/conrpc.c +10 -8
@@ -86,7 +86,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, }static int -lstcon_rpc_init (struct lstcon_node *nd,int service,unsigned feats, +lstcon_rpc_init (struct lstcon_node *nd,int service,unsigned int feats,int bulk_npg,int bulk_len,int embedded,struct lstcon_rpc *crpc) { crpc->crp_rpc = sfw_create_rpc(nd->nd_id, service,
@@ -111,7 +111,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, }static int -lstcon_rpc_prep (struct lstcon_node *nd,int service,unsigned feats, +lstcon_rpc_prep (struct lstcon_node *nd,int service,unsigned int feats,int bulk_npg,int bulk_len,struct lstcon_rpc **crpcpp) {struct lstcon_rpc *crpc =NULL ;
@@ -589,7 +589,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *,int lstcon_sesrpc_prep (struct lstcon_node *nd,int transop, -unsigned feats,struct lstcon_rpc **crpc) +unsigned int feats,struct lstcon_rpc **crpc) {struct srpc_mksn_reqst *msrq;struct srpc_rmsn_reqst *rsrq;
@@ -627,7 +627,8 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, }int -lstcon_dbgrpc_prep (struct lstcon_node *nd,unsigned feats,struct lstcon_rpc **crpc) +lstcon_dbgrpc_prep (struct lstcon_node *nd,unsigned int feats, +struct lstcon_rpc **crpc) {struct srpc_debug_reqst *drq;int rc;
@@ -645,7 +646,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, }int -lstcon_batrpc_prep (struct lstcon_node *nd,int transop,unsigned feats, +lstcon_batrpc_prep (struct lstcon_node *nd,int transop,unsigned int feats,struct lstcon_tsb_hdr *tsb,struct lstcon_rpc **crpc) {struct lstcon_batch *batch;
@@ -678,7 +679,8 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, }int -lstcon_statrpc_prep (struct lstcon_node *nd,unsigned feats,struct lstcon_rpc **crpc) +lstcon_statrpc_prep (struct lstcon_node *nd,unsigned int feats, +struct lstcon_rpc **crpc) {struct srpc_stat_reqst *srq;int rc;
@@ -803,7 +805,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, }int -lstcon_testrpc_prep (struct lstcon_node *nd,int transop,unsigned feats, +lstcon_testrpc_prep (struct lstcon_node *nd,int transop,unsigned int feats,struct lstcon_test *test,struct lstcon_rpc **crpc) {struct lstcon_group *sgrp = test->tes_src_grp;
@@ -1086,7 +1088,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *,struct lstcon_ndlink *ndl;struct lstcon_node *nd;struct lstcon_rpc *rpc; -unsigned feats; +unsigned int feats;int rc;/* Creating session RPG for list of nodes */
drivers/staging/lustre/lnet/selftest/conrpc.h +11 -9
@@ -78,8 +78,8 @@ struct lstcon_rpc_trans {struct list_head tas_olink;/* link chain on owner list */ struct list_head tas_link;/* link chain on global list */ int tas_opc;/* operation code of transaction */ -unsigned tas_feats_updated;/* features mask is uptodate */ -unsigned tas_features;/* test features mask */ +unsigned int tas_feats_updated;/* features mask is uptodate */ +unsigned int tas_features;/* test features mask */ wait_queue_head_t tas_waitq;/* wait queue head */ atomic_t tas_remaining;/* # of un-scheduled rpcs */ struct list_head tas_rpcs_list;/* queued requests */
@@ -106,14 +106,16 @@ typedef int (*lstcon_rpc_readent_func_t)(int, struct srpc_msg *, lstcon_rpc_ent_t __user *);int lstcon_sesrpc_prep (struct lstcon_node *nd,int transop, -unsigned version,struct lstcon_rpc **crpc); +unsigned int version,struct lstcon_rpc **crpc);int lstcon_dbgrpc_prep (struct lstcon_node *nd, -unsigned version,struct lstcon_rpc **crpc); -int lstcon_batrpc_prep (struct lstcon_node *nd,int transop,unsigned version, -struct lstcon_tsb_hdr *tsb,struct lstcon_rpc **crpc); -int lstcon_testrpc_prep (struct lstcon_node *nd,int transop,unsigned version, -struct lstcon_test *test,struct lstcon_rpc **crpc); -int lstcon_statrpc_prep (struct lstcon_node *nd,unsigned version, +unsigned int version,struct lstcon_rpc **crpc); +int lstcon_batrpc_prep (struct lstcon_node *nd,int transop, +unsigned int version,struct lstcon_tsb_hdr *tsb, +struct lstcon_rpc **crpc); +int lstcon_testrpc_prep (struct lstcon_node *nd,int transop, +unsigned int version,struct lstcon_test *test, +struct lstcon_rpc **crpc); +int lstcon_statrpc_prep (struct lstcon_node *nd,unsigned int version,struct lstcon_rpc **crpc);void lstcon_rpc_put (struct lstcon_rpc *crpc); int lstcon_rpc_trans_prep(struct list_head *translist,
drivers/staging/lustre/lnet/selftest/console.c +6 -4
@@ -397,7 +397,8 @@static int lstcon_group_nodes_add (struct lstcon_group *grp,int count,lnet_process_id_t __user *ids_up, -unsigned *featp,struct list_head __user *result_up) +unsigned int *featp, +struct list_head __user *result_up) {struct lstcon_rpc_trans *trans;struct lstcon_ndlink *ndl;
@@ -542,7 +543,8 @@int lstcon_nodes_add (char *name,int count,lnet_process_id_t __user *ids_up, -unsigned *featp,struct list_head __user *result_up) +unsigned int *featp, +struct list_head __user *result_up) {struct lstcon_group *grp;int rc;
@@ -1702,7 +1704,7 @@ }int -lstcon_session_new (char *name,int key,unsigned feats, +lstcon_session_new (char *name,int key,unsigned int feats,int timeout,int force,lst_sid_t __user *sid_up) {int rc =0 ;
@@ -1868,7 +1870,7 @@ }int -lstcon_session_feats_check (unsigned feats) +lstcon_session_feats_check (unsigned int feats) {int rc =0 ;
drivers/staging/lustre/lnet/selftest/console.h +8 -8
@@ -144,13 +144,13 @@ struct lstcon_session {int ses_timeout;/* timeout in seconds */ time64_t ses_laststamp;/* last operation stamp (seconds) */ -unsigned ses_features;/* tests features of the session +unsigned int ses_features;/* tests features of the session */ - unsigned ses_feats_updated:1; /* features are synced with + unsigned int ses_feats_updated:1; /* features are synced with* remote test nodes */ - unsigned ses_force:1; /* force creating */ - unsigned ses_shutdown:1; /* session is shutting down */ - unsigned ses_expired:1; /* console is timedout */ + unsigned int ses_force:1; /* force creating */ + unsigned int ses_shutdown:1; /* session is shutting down */ + unsigned int ses_expired:1; /* console is timedout */__u64 ses_id_cookie;/* batch id cookie */ char ses_name[LST_NAME_SIZE ];/* session name */ struct lstcon_rpc_trans *ses_ping;/* session pinger */
@@ -188,14 +188,14 @@ struct lstcon_session {int lstcon_console_init (void );int lstcon_console_fini (void );int lstcon_session_match (lst_sid_t sid); -int lstcon_session_new (char *name,int key,unsigned version, +int lstcon_session_new (char *name,int key,unsigned int version,int timeout,int flags,lst_sid_t __user *sid_up);int lstcon_session_info (lst_sid_t __user *sid_up,int __user *key,unsigned __user *verp,lstcon_ndlist_ent_t __user *entp,char __user *name_up,int len);int lstcon_session_end (void );int lstcon_session_debug (int timeout,struct list_head __user *result_up); -int lstcon_session_feats_check (unsigned feats); +int lstcon_session_feats_check (unsigned int feats);int lstcon_batch_debug (int timeout,char *name,int client,struct list_head __user *result_up); int lstcon_group_debug(int timeout, char *name,
@@ -207,7 +207,7 @@ int lstcon_nodes_debug(int timeout, int nnd, lnet_process_id_t __user *nds_up,int lstcon_group_clean (char *name,int args);int lstcon_group_refresh (char *name,struct list_head __user *result_up);int lstcon_nodes_add (char *name,int nnd,lnet_process_id_t __user *nds_up, -unsigned *featp,struct list_head __user *result_up); +unsigned int *featp,struct list_head __user *result_up);int lstcon_nodes_remove (char *name,int nnd,lnet_process_id_t __user *nds_up,struct list_head __user *result_up); int lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gent_up,
drivers/staging/lustre/lnet/selftest/framework.c +4 -4
@@ -254,7 +254,7 @@static inline void sfw_init_session (struct sfw_session *sn,lst_sid_t sid, -unsigned features,const char *name) +unsigned int features,const char *name) {struct stt_timer *timer = &sn->sn_timer;
@@ -897,7 +897,7 @@int sfw_create_test_rpc (struct sfw_test_unit *tsu,lnet_process_id_t peer, -unsigned features,int nblk,int blklen, +unsigned int features,int nblk,int blklen,struct srpc_client_rpc **rpcpp) {struct srpc_client_rpc *rpc =NULL ;
@@ -1225,7 +1225,7 @@struct srpc_service *sv = rpc->srpc_scd->scd_svc;struct srpc_msg *reply = &rpc->srpc_replymsg;struct srpc_msg *request = &rpc->srpc_reqstbuf->buf_msg; -unsigned features =LST_FEATS_MASK ; +unsigned int features =LST_FEATS_MASK ;int rc =0 ;LASSERT (!sfw_data.fw_active_srpc);
@@ -1375,7 +1375,7 @@struct srpc_client_rpc *sfw_create_rpc (lnet_process_id_t peer,int service, -unsigned features,int nbulkiov,int bulklen, +unsigned int features,int nbulkiov,int bulklen,void (*done)(struct srpc_client_rpc *),void *priv) {struct srpc_client_rpc *rpc =NULL ;
drivers/staging/lustre/lnet/selftest/ping_test.c +2 -2
@@ -159,8 +159,8 @@ struct lst_ping_data {ktime_get_real_ts64 (&ts);CDEBUG (D_NET ,"%d reply in %u usec\n" , reply->pnr_seq, - (unsigned )((ts.tv_sec - reqst->pnr_time_sec) *1000000 + - (ts.tv_nsec /NSEC_PER_USEC - reqst->pnr_time_usec))); + (unsigned int )((ts.tv_sec - reqst->pnr_time_sec) *1000000 + + (ts.tv_nsec /NSEC_PER_USEC - reqst->pnr_time_usec))); } static int
drivers/staging/lustre/lnet/selftest/selftest.h +2 -2
@@ -410,10 +410,10 @@ struct sfw_test_case {struct srpc_client_rpc *sfw_create_rpc (lnet_process_id_t peer,int service, -unsigned features,int nbulkiov,int bulklen, +unsigned int features,int nbulkiov,int bulklen,void (*done)(struct srpc_client_rpc *),void *priv);int sfw_create_test_rpc (struct sfw_test_unit *tsu, -lnet_process_id_t peer,unsigned features, +lnet_process_id_t peer,unsigned int features,int nblk,int blklen,struct srpc_client_rpc **rpc);void sfw_abort_rpc (struct srpc_client_rpc *rpc);void sfw_post_rpc (struct srpc_client_rpc *rpc);
Signature · 1 line
1.7.1
PATCH 2/19 staging: lustre: lnet: resolve trailing */ errors
In reply to James SimmonsThis patch resolves the checkpatch error:
Block comments use a trailing */ on a separate line
for the LNet/libcfs layer
--- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 128 +++++++++++++------- drivers/staging/lustre/lnet/libcfs/hash.c | 2 +- .../lustre/lnet/libcfs/linux/linux-crypto.h | 2 +- drivers/staging/lustre/lnet/libcfs/prng.c | 2 +- drivers/staging/lustre/lnet/selftest/console.h | 9 +- drivers/staging/lustre/lnet/selftest/rpc.h | 6 +- drivers/staging/lustre/lnet/selftest/selftest.h | 21 ++- drivers/staging/lustre/lnet/selftest/timer.c | 3 +- 8 files changed, 112 insertions(+), 61 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +83 -45
@@ -84,7 +84,8 @@ struct ksock_sched { /* per scheduler state */struct list_head kss_zombie_noop_txs;/* zombie noop tx list */ wait_queue_head_t kss_waitq;/* where scheduler sleeps */ int kss_nconns;/* # connections assigned to -* this scheduler */ +* this scheduler +*/ struct ksock_sched_info *kss_info;/* owner of it */ };
@@ -110,15 +111,19 @@ struct ksock_interface { /* in-use interface */struct ksock_tunables {int *ksnd_timeout;/* "stuck" socket timeout -* (seconds) */ +* (seconds) +*/ int *ksnd_nscheds;/* # scheduler threads in each -* pool while starting */ +* pool while starting +*/ int *ksnd_nconnds;/* # connection daemons */ int *ksnd_nconnds_max;/* max # connection daemons */ int *ksnd_min_reconnectms;/* first connection retry after -* (ms)... */ +* (ms)... +*/ int *ksnd_max_reconnectms;/* ...exponentially increasing to -* this */ +* this +*/ int *ksnd_eager_ack;/* make TCP ack eagerly? */ int *ksnd_typed_conns;/* drive sockets by type? */ int *ksnd_min_bulk;/* smallest "large" message */
@@ -126,9 +131,11 @@ struct ksock_tunables {int *ksnd_rx_buffer_size;/* socket rx buffer size */ int *ksnd_nagle;/* enable NAGLE? */ int *ksnd_round_robin;/* round robin for multiple -* interfaces */ +* interfaces +*/ int *ksnd_keepalive;/* # secs for sending keepalive -* NOOP */ +* NOOP +*/ int *ksnd_keepalive_idle;/* # idle secs before 1st probe */ int *ksnd_keepalive_count;/* # probes */
@@ -137,20 +144,26 @@ struct ksock_tunables {int *ksnd_peertxcredits;/* # concurrent sends to 1 peer */ int *ksnd_peerrtrcredits;/* # per-peer router buffer -* credits */ +* credits +*/ int *ksnd_peertimeout;/* seconds to consider peer dead */ int *ksnd_enable_csum;/* enable check sum */ int *ksnd_inject_csum_error;/* set non-zero to inject -* checksum error */ +* checksum error +*/ int *ksnd_nonblk_zcack;/* always send zc-ack on -* non-blocking connection */ +* non-blocking connection +*/ unsigned int *ksnd_zc_min_payload;/* minimum zero copy payload -* size */ +* size +*/ int *ksnd_zc_recv;/* enable ZC receive (for -* Chelsio TOE) */ +* Chelsio TOE) +*/ int *ksnd_zc_recv_min_nfrags;/* minimum # of fragments to -* enable ZC receive */ +* enable ZC receive +*/ };struct ksock_net {
@@ -174,9 +187,11 @@ struct ksock_nal_data {int ksnd_nnets;/* # networks set up */ struct list_head ksnd_nets;/* list of nets */ rwlock_t ksnd_global_lock;/* stabilize peer/conn -* ops */ +* ops +*/ struct list_head *ksnd_peers;/* hash table of all my -* known peers */ +* known peers +*/ int ksnd_peer_hash_size;/* size of ksnd_peers */ int ksnd_nthreads;/* # live threads */
@@ -187,11 +202,14 @@ struct ksock_nal_data {atomic_t ksnd_nactive_txs;/* #active txs */ struct list_head ksnd_deathrow_conns;/* conns to close: -* reaper_lock*/ +* reaper_lock +*/ struct list_head ksnd_zombie_conns;/* conns to free: -* reaper_lock */ +* reaper_lock +*/ struct list_head ksnd_enomem_conns;/* conns to retry: -* reaper_lock*/ +* reaper_lock +*/ wait_queue_head_t ksnd_reaper_waitq;/* reaper sleeps here */ unsigned long ksnd_reaper_waketime;/* when reaper will wake */
@@ -201,18 +219,21 @@ struct ksock_nal_data {int ksnd_stall_tx;/* test sluggish sender */ int ksnd_stall_rx;/* test sluggish -* receiver */ - +* receiver +*/ struct list_head ksnd_connd_connreqs;/* incoming connection -* requests */ +* requests +*/ struct list_head ksnd_connd_routes;/* routes waiting to be -* connected */ +* connected +*/ wait_queue_head_t ksnd_connd_waitq;/* connds sleep here */ int ksnd_connd_connecting;/* # connds connecting */ time64_t ksnd_connd_failed_stamp;/* time stamp of the * last failed -* connecting attempt */ +* connecting attempt +*/ time64_t ksnd_connd_starting_stamp;/* time stamp of the * last starting connd */
@@ -221,10 +242,11 @@ struct ksock_nal_data {spinlock_t ksnd_connd_lock;/* serialise */ struct list_head ksnd_idle_noop_txs;/* list head for freed -* noop tx */ +* noop tx +*/ spinlock_t ksnd_tx_lock;/* serialise, g_lock -* unsafe */ - +* unsafe +*/ };#define SOCKNAL_INIT_NOTHING 0
@@ -304,9 +326,11 @@ struct ksock_conn {struct list_head ksnc_list;/* stash on peer's conn list */ struct socket *ksnc_sock;/* actual socket */ void *ksnc_saved_data_ready;/* socket's original -* data_ready() callback */ +* data_ready() callback +*/ void *ksnc_saved_write_space;/* socket's original -* write_space() callback */ +* write_space() callback +*/ atomic_t ksnc_conn_refcount;/* conn refcount */ atomic_t ksnc_sock_refcount;/* sock refcount */ struct ksock_sched *ksnc_scheduler;/* who schedules this connection
@@ -315,7 +339,8 @@ struct ksock_conn {__u32 ksnc_ipaddr;/* peer's IP */ int ksnc_port;/* peer's port */ signed int ksnc_type:3; /* type of connection, should be -* signed value */ +* signed value +*/ unsigned int ksnc_closing:1; /* being shut down */ unsigned int ksnc_flip:1; /* flip or not, only for V2.x */ unsigned int ksnc_zc_capable:1; /* enable to ZC */
@@ -323,9 +348,11 @@ struct ksock_conn {/* reader */ struct list_head ksnc_rx_list;/* where I enq waiting input or a -* forwarding descriptor */ +* forwarding descriptor +*/ unsigned long ksnc_rx_deadline;/* when (in jiffies) receive times -* out */ +* out +*/ __u8 ksnc_rx_started;/* started receiving a message */ __u8 ksnc_rx_ready;/* data ready to read */ __u8 ksnc_rx_scheduled;/* being progressed */
@@ -338,7 +365,8 @@ struct ksock_conn {lnet_kiov_t *ksnc_rx_kiov;/* the page frags */ union ksock_rxiovspace ksnc_rx_iov_space;/* space for frag descriptors */ __u32 ksnc_rx_csum;/* partial checksum for incoming -* data */ +* data +*/ void *ksnc_cookie;/* rx lnet_finalize passthru arg */ ksock_msg_t ksnc_msg;/* incoming message buffer:
@@ -346,14 +374,16 @@ struct ksock_conn {* whole struct * V1.x message is a bare * lnet_hdr_t, it's stored in -* ksnc_msg.ksm_u.lnetmsg */ - +* ksnc_msg.ksm_u.lnetmsg +*/ /* WRITER */ struct list_head ksnc_tx_list;/* where I enq waiting for output -* space */ +* space +*/ struct list_head ksnc_tx_queue;/* packets waiting to be sent */ -struct ksock_tx *ksnc_tx_carrier;/* next TX that can carry a LNet -* message or ZC-ACK */ +struct ksock_tx *ksnc_tx_carrier;/* next TX that can carry a LNet +* message or ZC-ACK +*/ unsigned long ksnc_tx_deadline;/* when (in jiffies) tx times out */ int ksnc_tx_bufnob;/* send buffer marker */
@@ -361,7 +391,8 @@ struct ksock_conn {int ksnc_tx_ready;/* write space */ int ksnc_tx_scheduled;/* being progressed */ unsigned long ksnc_tx_last_post;/* time stamp of the last posted -* TX */ +* TX +*/ };struct ksock_route {
@@ -370,20 +401,24 @@ struct ksock_route {struct ksock_peer *ksnr_peer;/* owning peer */ atomic_t ksnr_refcount;/* # users */ unsigned long ksnr_timeout;/* when (in jiffies) reconnection -* can happen next */ +* can happen next +*/ long ksnr_retry_interval;/* how long between retries */ __u32 ksnr_myipaddr;/* my IP */ __u32 ksnr_ipaddr;/* IP address to connect to */ int ksnr_port;/* port to connect to */ unsigned int ksnr_scheduled:1; /* scheduled for attention */ unsigned int ksnr_connecting:1; /* connection establishment in -* progress */ +* progress +*/ unsigned int ksnr_connected:4; /* connections established by -* type */ +* type +*/ unsigned int ksnr_deleted:1; /* been removed from peer? */unsigned int ksnr_share_count;/* created explicitly? */ int ksnr_conn_count;/* # conns established by this -* route */ +* route +*/ };#define SOCKNAL_KEEPALIVE_PING 1/* cookie for keepalive ping */
@@ -391,7 +426,8 @@ struct ksock_route {struct ksock_peer {struct list_head ksnp_list;/* stash on global peer list */ unsigned long ksnp_last_alive;/* when (in jiffies) I was last -* alive */ +* alive +*/ lnet_process_id_t ksnp_id;/* who's on the other end(s) */ atomic_t ksnp_refcount;/* # users */ int ksnp_sharecount;/* lconf usage counter */
@@ -408,7 +444,8 @@ struct ksock_peer {struct list_head ksnp_tx_queue;/* waiting packets */ spinlock_t ksnp_lock;/* serialize, g_lock unsafe */ struct list_head ksnp_zc_req_list;/* zero copy requests wait for -* ACK */ +* ACK +*/ unsigned long ksnp_send_keepalive;/* time to send keepalive */ lnet_ni_t *ksnp_ni;/* which network */ int ksnp_n_passive_ips;/* # of... */
@@ -429,7 +466,8 @@ struct ksock_connreq {#define SOCKNAL_MATCH_NO 0/* TX can't match type of connection */ #define SOCKNAL_MATCH_YES 1/* TX matches type of connection */ #define SOCKNAL_MATCH_MAY 2/* TX can be sent on the connection, but not -* preferred */ +* preferred +*/ struct ksock_proto {/* version number of protocol */
drivers/staging/lustre/lnet/libcfs/hash.c +1 -1
@@ -1716,7 +1716,7 @@ struct cfs_hash_cond_arg {* the passed callback @func and pass to it as an argument each hash * item and the private @data. During the callback the bucket lock * is held so the callback must never sleep. -*/ +*/ void cfs_hash_for_each_key (struct cfs_hash *hs,const void *key,cfs_hash_for_each_cb_t func,void *data)
drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.h +1 -1
@@ -1,4 +1,4 @@ -/* +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
drivers/staging/lustre/lnet/libcfs/prng.c +1 -1
@@ -33,7 +33,7 @@* x(n)=a*x(n-1)+carry mod 2^16 and y(n)=b*y(n-1)+carry mod 2^16, * number and carry packed within the same 32 bit integer. * algorithm recommended by Marsaglia -*/ +*/ #include "../../include/linux/libcfs/libcfs.h"
drivers/staging/lustre/lnet/selftest/console.h +6 -3
@@ -92,14 +92,16 @@ struct lstcon_batch {int bat_ntest;/* # of test */ int bat_state;/* state of the batch */ int bat_arg;/* parameter for run|stop, timeout -* for run, force for stop */ +* for run, force for stop +*/ char bat_name[LST_NAME_SIZE ];/* name of batch */ struct list_head bat_test_list;/* list head of tests (struct lstcon_test) */ struct list_head bat_trans_list;/* list head of transaction */ struct list_head bat_cli_list;/* list head of client nodes -* (struct lstcon_node) */ +* (struct lstcon_node) +*/ struct list_head *bat_cli_hash;/* hash table of client nodes */ struct list_head bat_srv_list;/* list head of server nodes */ struct list_head *bat_srv_hash;/* hash table of server nodes */
@@ -147,7 +149,8 @@ struct lstcon_session {unsigned int ses_features;/* tests features of the session */ unsigned int ses_feats_updated:1; /* features are synced with -* remote test nodes */ +* remote test nodes +*/ unsigned int ses_force:1; /* force creating */ unsigned int ses_shutdown:1; /* session is shutting down */ unsigned int ses_expired:1; /* console is timedout */
drivers/staging/lustre/lnet/selftest/rpc.h +4 -2
@@ -113,7 +113,8 @@ struct srpc_join_reply {__u32 join_status;/* returned status */ lst_sid_t join_sid;/* session id */ __u32 join_timeout;/* # seconds' inactivity to -* expire */ +* expire +*/ char join_session[LST_NAME_SIZE ];/* session name */ }WIRE_ATTR ;
@@ -190,7 +191,8 @@ struct srpc_test_reqst {lst_bid_t tsr_bid;/* batch id */ __u32 tsr_service;/* test type: bulk|ping|... */ __u32 tsr_loop;/* test client loop count or -* # server buffers needed */ +* # server buffers needed +*/ __u32 tsr_concur;/* concurrency of test */ __u8 tsr_is_client;/* is test client or not */ __u8 tsr_stop_onerr;/* stop on error */
drivers/staging/lustre/lnet/selftest/selftest.h +14 -7
@@ -131,7 +131,8 @@enum srpc_event_type {SRPC_BULK_REQ_RCVD =1 ,/* passive bulk request(PUT sink/GET source) -* received */ +* received +*/ SRPC_BULK_PUT_SENT =2 ,/* active bulk PUT sent (source) */ SRPC_BULK_GET_RPLD =3 ,/* active bulk GET replied (sink) */ SRPC_REPLY_RCVD =4 ,/* incoming reply received */
@@ -295,7 +296,8 @@ struct srpc_service_cd {#define SFW_TEST_WI_MIN 256#define SFW_TEST_WI_MAX 2048/* extra buffers for tolerating buggy peers, or unbalanced number -* of peers between partitions */ +* of peers between partitions +*/ #define SFW_TEST_WI_EXTRA 64/* number of server workitems (mini-thread) for framework service */
@@ -347,9 +349,11 @@ struct sfw_batch {struct sfw_test_client_ops {int (*tso_init)(struct sfw_test_instance *tsi);/* initialize test -* client */ +* client +*/ void (*tso_fini)(struct sfw_test_instance *tsi);/* finalize test -* client */ +* client +*/ int (*tso_prep_rpc)(struct sfw_test_unit *tsu,lnet_process_id_t dest,struct srpc_client_rpc **rpc);/* prep a tests rpc */
@@ -374,7 +378,8 @@ struct sfw_test_instance {spinlock_t tsi_lock;/* serialize */ unsigned int tsi_stopping:1; /* test is stopping */atomic_t tsi_nactive;/* # of active test -* unit */ +* unit +*/ struct list_head tsi_units;/* test units */ struct list_head tsi_free_rpcs;/* free rpcs */ struct list_head tsi_active_rpcs;/* active rpcs */
@@ -386,8 +391,10 @@ struct sfw_test_instance { } tsi_u; }; -/* XXX: trailing (PAGE_SIZE % sizeof(lnet_process_id_t)) bytes at the end of -* pages are not used */ +/* +* XXX: trailing (PAGE_SIZE % sizeof(lnet_process_id_t)) bytes at the end of +* pages are not used +*/ #define SFW_MAX_CONCUR LST_MAX_CONCUR#define SFW_ID_PER_PAGE (PAGE_SIZE / sizeof(lnet_process_id_packed_t))#define SFW_MAX_NDESTS (LNET_MAX_IOV * SFW_ID_PER_PAGE)
drivers/staging/lustre/lnet/selftest/timer.c +2 -1
@@ -55,7 +55,8 @@ static struct st_timer_data { spinlock_t stt_lock; unsigned long stt_prev_slot; /* start time of the slot processed - * previously */ + * previously + */ struct list_head stt_hash[STTIMER_NSLOTS]; int stt_shuttingdown; wait_queue_head_t stt_waitq;
Signature · 1 line
1.7.1
PATCH 3/19 staging: lustre: libcfs: use static const char const * for a suffixes array
In reply to James SimmonsChange the static const array libcfs_debug_subsystems to use static const char const * as pointed out by checkpatch.
--- drivers/staging/lustre/lnet/libcfs/debug.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lnet/libcfs/debug.c +4 -2
@@ -228,7 +228,8 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp)static const char *libcfs_debug_subsys2str (int subsys) { -static const char *libcfs_debug_subsystems[] =LIBCFS_DEBUG_SUBSYS_NAMES ; +static const char *const libcfs_debug_subsystems[] = +LIBCFS_DEBUG_SUBSYS_NAMES ;if (subsys >=ARRAY_SIZE (libcfs_debug_subsystems))return NULL ;
@@ -240,7 +241,8 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp)static const char *libcfs_debug_dbg2str (int debug) { -static const char *libcfs_debug_masks[] =LIBCFS_DEBUG_MASKS_NAMES ; +static const char *const libcfs_debug_masks[] = +LIBCFS_DEBUG_MASKS_NAMES ;if (debug >=ARRAY_SIZE (libcfs_debug_masks))return NULL ;
Signature · 1 line
1.7.1
PATCH 4/19 staging: lustre: libcfs: remove explicit test of NULL variable
In reply to James SimmonsRemove != NULL which is not needed to test key existence.
--- drivers/staging/lustre/lnet/libcfs/libcfs_lock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lnet/libcfs/libcfs_lock.c +1 -1
@@ -73,7 +73,7 @@ struct cfs_percpt_lock *cfs_percpt_for_each (lock, i, pcl->pcl_locks) {spin_lock_init (lock); -if (keys !=NULL ) +if (keys)lockdep_set_class (lock, &keys[i]); }
Signature · 1 line
1.7.1
PATCH 5/19 staging: lustre: libcfs: fix aligment issue
In reply to James SimmonsMake alignment match open parenthesis for parameters to wait_event_interruptible_exclusive() call.
--- drivers/staging/lustre/lnet/libcfs/workitem.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lnet/libcfs/workitem.c +1 -1
@@ -273,7 +273,7 @@ static int cfs_wi_scheduler(void *arg)spin_unlock (&sched->ws_lock); rc =wait_event_interruptible_exclusive (sched->ws_waitq, - !cfs_wi_sched_cansleep (sched)); + !cfs_wi_sched_cansleep (sched));spin_lock (&sched->ws_lock); }
Signature · 1 line
1.7.1
PATCH 6/19 staging: lustre: lnet: fix misspelled word destroy
In reply to James SimmonsFix misspelling of destroy in LNet core.
--- drivers/staging/lustre/lnet/lnet/api-ni.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lnet/lnet/api-ni.c +4 -4
@@ -1551,16 +1551,16 @@ void lnet_lib_exit(void) rc =lnet_check_routes ();if (rc) - goto err_destory_routes; + goto err_destroy_routes; rc =lnet_rtrpools_alloc (im_a_router);if (rc) - goto err_destory_routes; + goto err_destroy_routes; } rc =lnet_acceptor_start ();if (rc) - goto err_destory_routes; + goto err_destroy_routes; the_lnet.ln_refcount =1 ;/* Now I may use my own API functions... */
@@ -1587,7 +1587,7 @@ void lnet_lib_exit(void) err_acceptor_stop: the_lnet.ln_refcount =0 ;lnet_acceptor_stop (); -err_destory_routes: +err_destroy_routes:if (!the_lnet.ln_nis_from_mod_params)lnet_destroy_routes (); err_shutdown_lndnis:
Signature · 1 line
1.7.1
PATCH 7/19 staging: lustre: lnet: remove unused lib_me_dump
In reply to James SimmonsRemove unused lib_me_dump.
--- drivers/staging/lustre/lnet/lnet/lib-me.c | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-me.c +0 -18
@@ -271,21 +271,3 @@lnet_res_lh_invalidate (&me->me_lh);lnet_me_free (me); } - -#if 0 -static void -lib_me_dump (lnet_me_t *me) -{ -CWARN ("Match Entry %p (%#llx)\n" , me, - me->me_lh.lh_cookie); - -CWARN ("\tMatch/Ignore\t= %016lx / %016lx\n" , - me->me_match_bits, me->me_ignore_bits); - -CWARN ("\tMD\t= %p\n" , me->md); -CWARN ("\tprev\t= %p\n" , -list_entry (me->me_list.prev, lnet_me_t, me_list)); -CWARN ("\tnext\t= %p\n" , -list_entry (me->me_list.next, lnet_me_t, me_list)); -} -#endif
Signature · 1 line
1.7.1
PATCH 8/19 staging: lustre: lnet: missing blank line after declaration
In reply to James SimmonsAdd in missing blank line in lnet_copy_iov2iter() after variable declarations.
--- drivers/staging/lustre/lnet/lnet/lib-move.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-move.c +1 -0
@@ -192,6 +192,7 @@ left = siov->iov_len - soffset; do { size_t n, copy = left; + LASSERT(nsiov > 0); if (copy > nob)
Signature · 1 line
1.7.1
PATCH 9/19 staging: lustre: lnet: fill in real lnet_md_t
In reply to James SimmonsWhile checkpatch reported an alignment issue its just ugly to fill in a data structure being passed to a function. Instead fill in a lnet_md_t on the stack and pass that to LNetMDBind.
--- drivers/staging/lustre/lnet/lnet/router.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-)
drivers/staging/lustre/lnet/lnet/router.c +9 -8
@@ -903,6 +903,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) {lnet_rc_data_t *rcd =NULL ;lnet_ping_info_t *pi; +lnet_md_t md;int rc;int i;
@@ -925,15 +926,15 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) } rcd->rcd_pinginfo = pi; + md.start = pi; + md.user_ptr = rcd; + md.length =LNET_PINGINFO_SIZE ; + md.threshold =LNET_MD_THRESH_INF ; + md.options =LNET_MD_TRUNCATE ; + md.eq_handle = the_lnet.ln_rc_eqh; +LASSERT (!LNetHandleIsInvalid (the_lnet.ln_rc_eqh)); - rc =LNetMDBind ((lnet_md_t ){.start = pi, - .user_ptr = rcd, - .length =LNET_PINGINFO_SIZE , - .threshold =LNET_MD_THRESH_INF , - .options =LNET_MD_TRUNCATE , - .eq_handle = the_lnet.ln_rc_eqh}, -LNET_UNLINK , - &rcd->rcd_mdh); + rc =LNetMDBind (md,LNET_UNLINK , &rcd->rcd_mdh);if (rc <0 ) {CERROR ("Can't bind MD: %d\n" , rc); goto out;
Signature · 1 line
1.7.1
PATCH 10/19 staging: lustre: lnet: replace uninitialized_var
In reply to James SimmonsCheckpatch for some reason doesn't like the way libcfs_str2net_internal. Lets just replace it with nf being set to NULL instead
--- drivers/staging/lustre/lnet/lnet/nidstrings.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lnet/lnet/nidstrings.c +1 -1
@@ -1156,7 +1156,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid,static struct netstrfns *libcfs_str2net_internal (const char *str,__u32 *net) { -struct netstrfns *uninitialized_var (nf ); +struct netstrfns *nf =NULL ;int nob;unsigned int netnum;int i;
Signature · 1 line
1.7.1
PATCH 11/19 staging: lustre: libcfs: remove != 0 testing
In reply to James SimmonsTesting != 0 is not kernel style so remove this
type of testing from libcfs.
--- drivers/staging/lustre/lnet/libcfs/debug.c | 4 +- drivers/staging/lustre/lnet/libcfs/hash.c | 24 ++++++++++---------- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 6 ++-- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 14 +++++----- .../lustre/lnet/libcfs/linux/linux-crypto.c | 6 ++-- .../lustre/lnet/libcfs/linux/linux-tracefile.c | 10 ++++---- drivers/staging/lustre/lnet/libcfs/module.c | 4 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 14 +++++----- drivers/staging/lustre/lnet/libcfs/workitem.c | 6 ++-- 9 files changed, 44 insertions(+), 44 deletions(-)
drivers/staging/lustre/lnet/libcfs/debug.c +2 -2
@@ -278,7 +278,7 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp) len++; } -while (*token !=0 ) { +while (*token) {if (len < size) str[len] = *token; token++;
@@ -315,7 +315,7 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp) t =sscanf (str,"%i%n" , &m, &matched);if (t >=1 && matched == n) {/* don't print warning for lctl set_param debug=0 or -1 */ -if (m !=0 && m !=-1 ) +if (m && m !=-1 )CWARN ("You are trying to use a numerical value for the mask - this will be deprecated in a future release.\n" ); *mask = m;return 0 ;
drivers/staging/lustre/lnet/libcfs/hash.c +12 -12
@@ -492,7 +492,7 @@ struct cfs_hash_dhead_dep {cfs_hash_bd_from_key (hs, hs->hs_buckets, hs->hs_cur_bits, key, bd); }else { -LASSERT (hs->hs_rehash_bits !=0 ); +LASSERT (hs->hs_rehash_bits);cfs_hash_bd_from_key (hs, hs->hs_rehash_buckets, hs->hs_rehash_bits, key, bd); }
@@ -629,7 +629,7 @@ enum cfs_hash_lookup_intent {struct hlist_head *hhead =cfs_hash_bd_hhead (hs, bd);struct hlist_node *ehnode;struct hlist_node *match; -int intent_add = (intent &CFS_HS_LOOKUP_MASK_ADD ) !=0 ; +int intent_add = intent &CFS_HS_LOOKUP_MASK_ADD ;/* with this function, we can avoid a lot of useless refcount ops, * which are expensive atomic operations most time.
@@ -643,13 +643,13 @@ enum cfs_hash_lookup_intent {continue ;/* match and ... */ -if ((intent &CFS_HS_LOOKUP_MASK_DEL ) !=0 ) { +if (intent &CFS_HS_LOOKUP_MASK_DEL ) {cfs_hash_bd_del_locked (hs, bd, ehnode);return ehnode; }/* caller wants refcount? */ -if ((intent &CFS_HS_LOOKUP_MASK_REF ) !=0 ) +if (intent &CFS_HS_LOOKUP_MASK_REF )cfs_hash_get (hs, ehnode);return ehnode; }
@@ -815,7 +815,7 @@ struct hlist_node *return ; } -LASSERT (hs->hs_rehash_bits !=0 ); +LASSERT (hs->hs_rehash_bits);cfs_hash_bd_from_key (hs, hs->hs_rehash_buckets, hs->hs_rehash_bits, key, &bds[1 ]);
@@ -976,7 +976,7 @@ static void cfs_hash_depth_wi_cancel(struct cfs_hash *hs)return ;spin_lock (&hs->hs_dep_lock); -while (hs->hs_dep_bits !=0 ) { +while (hs->hs_dep_bits) {spin_unlock (&hs->hs_dep_lock);cond_resched ();spin_lock (&hs->hs_dep_lock);
@@ -1010,16 +1010,16 @@ struct cfs_hash *LASSERT (ops->hs_get);LASSERT (ops->hs_put_locked); -if ((flags &CFS_HASH_REHASH ) !=0 ) +if (flags &CFS_HASH_REHASH ) flags |=CFS_HASH_COUNTER ;/* must have counter */ LASSERT (cur_bits >0 );LASSERT (cur_bits >= bkt_bits);LASSERT (max_bits >= cur_bits && max_bits <31 );LASSERT (ergo ((flags &CFS_HASH_REHASH ) ==0 , cur_bits == max_bits)); -LASSERT (ergo ((flags &CFS_HASH_REHASH ) !=0 , +LASSERT (ergo (flags &CFS_HASH_REHASH , (flags &CFS_HASH_NO_LOCK ) ==0 )); -LASSERT (ergo ((flags &CFS_HASH_REHASH_KEY ) !=0 , ops->hs_keycpy)); +LASSERT (ergo (flags &CFS_HASH_REHASH_KEY , ops->hs_keycpy)); len = (flags &CFS_HASH_BIGNAME ) ==0 ?CFS_HASH_NAME_LEN :CFS_HASH_BIGNAME_LEN ;
@@ -1948,7 +1948,7 @@ struct cfs_hash_cond_arg {/* can't refer to @hs anymore because it could be destroyed */ if (bkts)cfs_hash_buckets_free (bkts, bsize, new_size, old_size); -if (rc !=0 ) +if (rc)CDEBUG (D_INFO ,"early quit of rehashing: %d\n" , rc);/* return 1 only if cfs_wi_exit is called */ return rc == -ESRCH ;
@@ -2017,7 +2017,7 @@ void cfs_hash_debug_header(struct seq_file *m)if (!hs->hs_rehash_buckets)return hs->hs_buckets; -LASSERT (hs->hs_rehash_bits !=0 ); +LASSERT (hs->hs_rehash_bits);return hs->hs_rehash_bits > hs->hs_cur_bits ? hs->hs_rehash_buckets : hs->hs_buckets; }
@@ -2029,7 +2029,7 @@ void cfs_hash_debug_header(struct seq_file *m)if (!hs->hs_rehash_buckets)return CFS_HASH_NBKT (hs); -LASSERT (hs->hs_rehash_bits !=0 ); +LASSERT (hs->hs_rehash_bits);return hs->hs_rehash_bits > hs->hs_cur_bits ?CFS_HASH_RH_NBKT (hs) :CFS_HASH_NBKT (hs); }
drivers/staging/lustre/lnet/libcfs/libcfs_string.c +3 -3
@@ -391,7 +391,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), i +=scnprintf (buffer + i, count - i,"[" );list_for_each_entry (expr, &expr_list->el_exprs, re_link) { -if (j++ !=0 ) +if (j++) i +=scnprintf (buffer + i, count - i,"," ); i +=cfs_range_expr_print (buffer + i, count - i, expr, numexprs >1 );
@@ -533,7 +533,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), } rc =cfs_range_expr_parse (&tok, min, max,1 , &expr); -if (rc !=0 ) +if (rc)break ;list_add_tail (&expr->re_link, &expr_list->el_exprs);
@@ -544,7 +544,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),list_add_tail (&expr->re_link, &expr_list->el_exprs); } -if (rc !=0 ) +if (rc)cfs_expr_list_free (expr_list);else *elpp = expr_list;
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +7 -7
@@ -712,7 +712,7 @@ struct cfs_cpt_table **/ ncpt =min (2U , ncpt);#endif -while (ncpu % ncpt !=0 ) +while (ncpu % ncpt) ncpt--;/* worst case is 1 */ return ncpt;
@@ -737,7 +737,7 @@ struct cfs_cpt_table * ncpt, rc); } -if (num_online_cpus () % ncpt !=0 ) { +if (num_online_cpus () % ncpt) {CERROR ("CPU number %d is not multiple of cpu_npartition %d, please try different cpu_npartitions value or set pattern string by cpu_pattern=STRING\n" , (int )num_online_cpus (), ncpt); goto failed;
@@ -888,7 +888,7 @@ struct cfs_cpt_table *int n;if (!bracket) { -if (*str !=0 ) { +if (*str) {CERROR ("Invalid pattern %s\n" , str); goto failed; }
@@ -911,7 +911,7 @@ struct cfs_cpt_table * goto failed; } -if (cfs_cpt_weight (cptab, cpt) !=0 ) { +if (cfs_cpt_weight (cptab, cpt)) {CERROR ("Partition %d has already been set.\n" , cpt); goto failed; }
@@ -930,14 +930,14 @@ struct cfs_cpt_table * }if (cfs_expr_list_parse (str, (bracket - str) +1 , -0 , high, &el) !=0 ) { +0 , high, &el)) {CERROR ("Can't parse number range: %s\n" , str); goto failed; }list_for_each_entry (range, &el->el_exprs, re_link) {for (i = range->re_lo; i <= range->re_hi; i++) { -if ((i - range->re_lo) % range->re_stride !=0 ) +if ((i - range->re_lo) % range->re_stride)continue ; rc = node ? cfs_cpt_set_node(cptab, cpt, i) :
@@ -1044,7 +1044,7 @@ struct cfs_cpt_table *register_hotcpu_notifier (&cfs_cpu_notifier);#endif -if (*cpu_pattern !=0 ) { +if (*cpu_pattern) { cfs_cpt_table =cfs_cpt_table_create_pattern (cpu_pattern);if (!cfs_cpt_table) { CERROR("Failed to create cptab from pattern %s\n",
drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c +3 -3
@@ -93,12 +93,12 @@ static int cfs_crypto_hash_alloc(enum cfs_crypto_hash_alg hash_alg,if (key) err =crypto_ahash_setkey (tfm, key, key_len); -else if ((*type)->cht_key !=0 ) +else if ((*type)->cht_key) err =crypto_ahash_setkey (tfm, (unsigned char *)&((*type)->cht_key), (*type)->cht_size); -if (err !=0 ) { +if (err) {ahash_request_free (*req);crypto_free_ahash (tfm);return err;
@@ -156,7 +156,7 @@ int cfs_crypto_hash_digest(enum cfs_crypto_hash_alg hash_alg,return -EINVAL ; err =cfs_crypto_hash_alloc (hash_alg, &type, &req, key, key_len); -if (err !=0 ) +if (err)return err;if (!hash || *hash_len < type->cht_size) {
drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c +5 -5
@@ -224,21 +224,21 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, {char *prefix ="Lustre" , *ptype =NULL ; -if ((mask &D_EMERG ) !=0 ) { +if (mask &D_EMERG ) { prefix =dbghdr_to_err_string (hdr); ptype =KERN_EMERG ; - }else if ((mask &D_ERROR ) !=0 ) { + }else if (mask &D_ERROR ) { prefix =dbghdr_to_err_string (hdr); ptype =KERN_ERR ; - }else if ((mask &D_WARNING ) !=0 ) { + }else if (mask &D_WARNING ) { prefix =dbghdr_to_info_string (hdr); ptype =KERN_WARNING ; - }else if ((mask & (D_CONSOLE | libcfs_printk)) !=0 ) { + }else if (mask & (D_CONSOLE | libcfs_printk)) { prefix =dbghdr_to_info_string (hdr); ptype =KERN_INFO ; } -if ((mask &D_CONSOLE ) !=0 ) { +if (mask &D_CONSOLE ) {printk ("%s%s: %.*s" , ptype, prefix, len, buf); }else { printk("%s%s: %d:%d:(%s:%d:%s()) %.*s", ptype, prefix,
drivers/staging/lustre/lnet/libcfs/module.c +2 -2
@@ -547,7 +547,7 @@ static int libcfs_init(void) } rc =cfs_cpu_init (); -if (rc !=0 ) +if (rc) goto cleanup_debug; rc =misc_register (&libcfs_dev);
@@ -566,7 +566,7 @@ static int libcfs_init(void) rc =min (cfs_cpt_weight (cfs_cpt_table,CFS_CPT_ANY ),4 ); rc =cfs_wi_sched_create ("cfs_rh" , cfs_cpt_table,CFS_CPT_ANY , rc, &cfs_sched_rehash); -if (rc !=0 ) { +if (rc) {CERROR ("Startup workitem scheduler: error: %d\n" , rc); goto cleanup_deregister; }
drivers/staging/lustre/lnet/libcfs/tracefile.c +7 -7
@@ -432,7 +432,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,if (cdls) {if (libcfs_console_ratelimit && - cdls->cdls_next !=0 &&/* not first time ever */ + cdls->cdls_next &&/* not first time ever */ !cfs_time_after (cfs_time_current (), cdls->cdls_next)) {/* skipping a console message */ cdls->cdls_count++;
@@ -489,7 +489,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,put_cpu (); } -if (cdls && cdls->cdls_count !=0 ) { +if (cdls && cdls->cdls_count) { string_buf =cfs_trace_get_console_buffer (); needed = snprintf(string_buf, CFS_TRACE_CONSOLE_BUFFER_SIZE,
@@ -847,12 +847,12 @@ int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob)int rc; rc =cfs_trace_allocate_string_buffer (&str, usr_str_nob +1 ); -if (rc !=0 ) +if (rc)return rc; rc =cfs_trace_copyin_string (str, usr_str_nob +1 , usr_str, usr_str_nob); -if (rc !=0 ) +if (rc) goto out;if (str[0 ] !='/' ) {
@@ -912,7 +912,7 @@ int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob)int rc; rc =cfs_trace_allocate_string_buffer (&str, usr_str_nob +1 ); -if (rc !=0 ) +if (rc)return rc; rc = cfs_trace_copyin_string(str, usr_str_nob + 1,
@@ -1003,7 +1003,7 @@ static int tracefiled(void *arg) filp =NULL ;cfs_tracefile_read_lock (); -if (cfs_tracefile[0 ] !=0 ) { +if (cfs_tracefile[0 ]) { filp =filp_open (cfs_tracefile,O_CREAT |O_RDWR |O_LARGEFILE ,0600 );
@@ -1141,7 +1141,7 @@ int cfs_tracefile_init(int max_pages)int factor; rc =cfs_tracefile_init_arch (); -if (rc !=0 ) +if (rc)return rc;cfs_tcd_for_each (tcd, i, j) {
drivers/staging/lustre/lnet/libcfs/workitem.c +3 -3
@@ -208,7 +208,7 @@ static int cfs_wi_scheduler(void *arg)/* CPT affinity scheduler? */ if (sched->ws_cptab) -if (cfs_cpt_bind (sched->ws_cptab, sched->ws_cpt) !=0 ) +if (cfs_cpt_bind (sched->ws_cptab, sched->ws_cpt))CWARN ("Failed to bind %s on CPT %d\n" , sched->ws_name, sched->ws_cpt);
@@ -247,7 +247,7 @@ static int cfs_wi_scheduler(void *arg) rc = (*wi->wi_action) (wi);spin_lock (&sched->ws_lock); -if (rc !=0 )/* WI should be dead, even be freed! */ +if (rc)/* WI should be dead, even be freed! */ continue ; wi->wi_running =0 ;
@@ -447,7 +447,7 @@ static int cfs_wi_scheduler(void *arg)list_for_each_entry (sched, &cfs_wi_data.wi_scheds, ws_list) {spin_lock (&cfs_wi_data.wi_glock); -while (sched->ws_nthreads !=0 ) { +while (sched->ws_nthreads) {spin_unlock (&cfs_wi_data.wi_glock);set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (cfs_time_seconds (1 ) /20 );
Signature · 1 line
1.7.1
PATCH 12/19 staging: lustre: libcfs: remove == 0 testing
In reply to James SimmonsTesting == 0 is not kernel style so remove this
type of testing from libcfs.
--- drivers/staging/lustre/lnet/libcfs/debug.c | 8 +++--- drivers/staging/lustre/lnet/libcfs/hash.c | 27 +++++++++---------- drivers/staging/lustre/lnet/libcfs/libcfs_lock.c | 4 +- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 16 ++++++------ .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 12 ++++---- .../lustre/lnet/libcfs/linux/linux-crypto.c | 4 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 14 +++++----- drivers/staging/lustre/lnet/libcfs/workitem.c | 2 +- 8 files changed, 43 insertions(+), 44 deletions(-)
drivers/staging/lustre/lnet/libcfs/debug.c +4 -4
@@ -259,13 +259,13 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp)const char *token;int i; -if (mask ==0 ) {/* "0" */ +if (!mask) {/* "0" */ if (size >0 ) str[0 ] ='0' ; len =1 ; }else {/* space-separated tokens */ for (i =0 ; i <32 ; i++) { -if ((mask & (1 << i)) ==0 ) +if (!(mask & (1 << i)))continue ; token =fn (i);
@@ -416,9 +416,9 @@ int libcfs_debug_init(unsigned long bufsize) max = max /num_possible_cpus (); max <<= (20 -PAGE_SHIFT ); } - rc =cfs_tracefile_init (max); -if (rc ==0 ) { + rc =cfs_tracefile_init (max); +if (!rc) {libcfs_register_panic_notifier (); libcfs_debug_mb =cfs_trace_get_debug_mb (); }
drivers/staging/lustre/lnet/libcfs/hash.c +13 -14
@@ -507,7 +507,7 @@ struct cfs_hash_dhead_dep { bd->bd_bucket->hsb_depmax = dep_cur;# if CFS_HASH_DEBUG_LEVEL >=CFS_HASH_DEBUG_1 -if (likely (warn_on_depth ==0 || +if (likely (!warn_on_depth ||max (warn_on_depth, hs->hs_dep_max) >= dep_cur))return ;
@@ -531,7 +531,7 @@ struct cfs_hash_dhead_dep { rc = hs->hs_hops->hop_hnode_add (hs, bd, hnode);cfs_hash_bd_dep_record (hs, bd, rc); bd->bd_bucket->hsb_version++; -if (unlikely (bd->bd_bucket->hsb_version ==0 )) +if (unlikely (!bd->bd_bucket->hsb_version)) bd->bd_bucket->hsb_version++; bd->bd_bucket->hsb_count++;
@@ -551,7 +551,7 @@ struct cfs_hash_dhead_dep {LASSERT (bd->bd_bucket->hsb_count >0 ); bd->bd_bucket->hsb_count--; bd->bd_bucket->hsb_version++; -if (unlikely (bd->bd_bucket->hsb_version ==0 )) +if (unlikely (!bd->bd_bucket->hsb_version)) bd->bd_bucket->hsb_version++;if (cfs_hash_with_counter (hs)) {
@@ -571,7 +571,7 @@ struct cfs_hash_dhead_dep {struct cfs_hash_bucket *nbkt = bd_new->bd_bucket;int rc; -if (cfs_hash_bd_compare (bd_old, bd_new) ==0 ) +if (!cfs_hash_bd_compare (bd_old, bd_new))return ;/* use cfs_hash_bd_hnode_add/del, to avoid atomic & refcount ops
@@ -584,11 +584,11 @@ struct cfs_hash_dhead_dep {LASSERT (obkt->hsb_count >0 ); obkt->hsb_count--; obkt->hsb_version++; -if (unlikely (obkt->hsb_version ==0 )) +if (unlikely (!obkt->hsb_version)) obkt->hsb_version++; nbkt->hsb_count++; nbkt->hsb_version++; -if (unlikely (nbkt->hsb_version ==0 )) +if (unlikely (!nbkt->hsb_version)) nbkt->hsb_version++; }
@@ -883,7 +883,7 @@ struct hlist_node *struct cfs_hash_bucket **new_bkts;int i; -LASSERT (old_size ==0 || old_bkts); +LASSERT (!old_size || old_bkts);if (old_bkts && old_size == new_size)return old_bkts;
@@ -1016,12 +1016,11 @@ struct cfs_hash *LASSERT (cur_bits >0 );LASSERT (cur_bits >= bkt_bits);LASSERT (max_bits >= cur_bits && max_bits <31 ); -LASSERT (ergo ((flags &CFS_HASH_REHASH ) ==0 , cur_bits == max_bits)); -LASSERT (ergo (flags &CFS_HASH_REHASH , - (flags &CFS_HASH_NO_LOCK ) ==0 )); +LASSERT (ergo (!(flags &CFS_HASH_REHASH ), cur_bits == max_bits)); +LASSERT (ergo (flags &CFS_HASH_REHASH , !(flags &CFS_HASH_NO_LOCK )));LASSERT (ergo (flags &CFS_HASH_REHASH_KEY , ops->hs_keycpy)); - len = (flags &CFS_HASH_BIGNAME ) ==0 ? + len = !(flags &CFS_HASH_BIGNAME ) ?CFS_HASH_NAME_LEN :CFS_HASH_BIGNAME_LEN ; LIBCFS_ALLOC(hs, offsetof(struct cfs_hash, hs_name[len]));if (!hs)
@@ -1107,12 +1106,12 @@ struct cfs_hash *cfs_hash_exit (hs, hnode); } } -LASSERT (bd.bd_bucket->hsb_count ==0 ); +LASSERT (!bd.bd_bucket->hsb_count);cfs_hash_bd_unlock (hs, &bd,1 );cond_resched (); } -LASSERT (atomic_read (&hs->hs_count) ==0 ); +LASSERT (!atomic_read (&hs->hs_count));cfs_hash_buckets_free (hs->hs_buckets,cfs_hash_bkt_size (hs),0 ,CFS_HASH_NBKT (hs));
@@ -1388,7 +1387,7 @@ void cfs_hash_putref(struct cfs_hash *hs) bits =cfs_hash_rehash_bits (hs);cfs_hash_unlock (hs,1 );/* NB: it's race on cfs_has_t::hs_iterating, see above */ -if (remained ==0 ) +if (!remained) hs->hs_iterating =0 ;if (bits >0 ) { cfs_hash_rehash(hs, atomic_read(&hs->hs_count) <
drivers/staging/lustre/lnet/libcfs/libcfs_lock.c +2 -2
@@ -114,7 +114,7 @@ struct cfs_percpt_lock */* exclusive lock request */ for (i =0 ; i < ncpt; i++) {spin_lock (pcl->pcl_locks[i]); -if (i ==0 ) { +if (!i) {LASSERT (!pcl->pcl_locked);/* nobody should take private lock after this * so I wouldn't starve for too long time
@@ -141,7 +141,7 @@ struct cfs_percpt_lock * }for (i = ncpt -1 ; i >=0 ; i--) { -if (i ==0 ) { +if (!i) {LASSERT (pcl->pcl_locked); pcl->pcl_locked =0 ; }
drivers/staging/lustre/lnet/libcfs/libcfs_string.c +8 -8
@@ -79,7 +79,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),for (i =0 ; i <32 ; i++) { debugstr =bit2str (i);if (debugstr &&strlen (debugstr) == len && -strncasecmp (str, debugstr, len) ==0 ) { + !strncasecmp (str, debugstr, len)) {if (op =='-' ) newmask &= ~(1 << i);else
@@ -89,7 +89,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), } }if (!found && len ==3 && - (strncasecmp (str,"ALL" , len) ==0 )) { + !strncasecmp (str,"ALL" , len)) {if (op =='-' ) newmask = minmask;else
@@ -182,7 +182,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), next->ls_len--; } -if (next->ls_len ==0 )/* whitespaces only */ +if (!next->ls_len)/* whitespaces only */ return 0 ;if (*next->ls_str == delim) {
@@ -417,7 +417,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),list_for_each_entry (expr, &expr_list->el_exprs, re_link) {if (value >= expr->re_lo && value <= expr->re_hi && - ((value - expr->re_lo) % expr->re_stride) ==0 ) + !((value - expr->re_lo) % expr->re_stride))return 1 ; }
@@ -442,12 +442,12 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),list_for_each_entry (expr, &expr_list->el_exprs, re_link) {for (i = expr->re_lo; i <= expr->re_hi; i++) { -if (((i - expr->re_lo) % expr->re_stride) ==0 ) +if (!((i - expr->re_lo) % expr->re_stride)) count++; } } -if (count ==0 )/* empty expression list */ +if (!count)/* empty expression list */ return 0 ;if (count > max) {
@@ -463,7 +463,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), count =0 ;list_for_each_entry (expr, &expr_list->el_exprs, re_link) {for (i = expr->re_lo; i <= expr->re_hi; i++) { -if (((i - expr->re_lo) % expr->re_stride) ==0 ) +if (!((i - expr->re_lo) % expr->re_stride)) val[count++] = i; } }
@@ -540,7 +540,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), } }else { rc =cfs_range_expr_parse (&src, min, max,0 , &expr); -if (rc ==0 ) +if (!rc)list_add_tail (&expr->re_link, &expr_list->el_exprs); }
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +6 -6
@@ -375,7 +375,7 @@ struct cfs_cpt_table * {int i; -if (cpumask_weight (mask) ==0 || +if (!cpumask_weight (mask) ||cpumask_any_and (mask, cpu_online_mask) >= nr_cpu_ids) {CDEBUG (D_INFO ,"No online CPU is found in the CPU mask for CPU partition %d\n" , cpt);
@@ -516,7 +516,7 @@ struct cfs_cpt_table * rotor %= weight;for_each_node_mask (node, *mask) { -if (rotor-- ==0 ) +if (!rotor--)return node; }
@@ -584,7 +584,7 @@ struct cfs_cpt_table * rc =set_cpus_allowed_ptr (current, cpumask);set_mems_allowed (*nodemask); -if (rc ==0 ) +if (!rc)schedule ();/* switch to allowed CPU */ return rc;
@@ -658,7 +658,7 @@ struct cfs_cpt_table * goto out; } -if (--number ==0 ) +if (!--number) goto out; } cpu =cpumask_first (socket);
@@ -750,7 +750,7 @@ struct cfs_cpt_table * } num =num_online_cpus () / ncpt; -if (num ==0 ) { +if (!num) {CERROR ("CPU changed while setting CPU partition\n" ); goto failed; }
@@ -848,7 +848,7 @@ struct cfs_cpt_table * } } -if (ncpt ==0 || +if (!ncpt || (node && ncpt >num_online_nodes ()) || (!node && ncpt >num_online_cpus ())) { CERROR("Invalid pattern %s, or too many partitions %d\n",
drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c +2 -2
@@ -152,7 +152,7 @@ int cfs_crypto_hash_digest(enum cfs_crypto_hash_alg hash_alg,int err;const struct cfs_crypto_hash_type *type; -if (!buf || buf_len ==0 || !hash_len) +if (!buf || !buf_len || !hash_len)return -EINVAL ; err =cfs_crypto_hash_alloc (hash_alg, &type, &req, key, key_len);
@@ -440,6 +440,6 @@ int cfs_crypto_register(void)*/ void cfs_crypto_unregister (void ) { -if (adler32 ==0 ) +if (!adler32)cfs_crypto_adler32_unregister (); }
drivers/staging/lustre/lnet/libcfs/tracefile.c +7 -7
@@ -236,7 +236,7 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd)INIT_LIST_HEAD (&pc.pc_pages);list_for_each_entry_safe (tage, tmp, &tcd->tcd_pages, linkage) { -if (pgcount-- ==0 ) +if (!pgcount--)break ;list_move_tail (&tage->linkage, &pc.pc_pages);
@@ -320,7 +320,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,if (!tcd)/* arch may not log in IRQ context */ goto console; -if (tcd->tcd_cur_pages ==0 ) +if (!tcd->tcd_cur_pages) header.ph_flags |=PH_FLAG_FIRST_RECORD ;if (tcd->tcd_shutting_down) {
@@ -423,7 +423,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,__LASSERT (tage->used <=PAGE_SIZE ); console: -if ((mask & libcfs_printk) ==0 ) { +if (!(mask & libcfs_printk)) {/* no console output requested */ if (tcd)cfs_trace_put_tcd (tcd);
@@ -871,13 +871,13 @@ int cfs_trace_daemon_command(char *str)cfs_tracefile_write_lock (); -if (strcmp (str,"stop" ) ==0 ) { +if (!strcmp (str,"stop" )) {cfs_tracefile_write_unlock ();cfs_trace_stop_thread ();cfs_tracefile_write_lock ();memset (cfs_tracefile,0 ,sizeof (cfs_tracefile)); - }else if (strncmp (str,"size=" ,5 ) ==0 ) { + }else if (!strncmp (str,"size=" ,5 )) {unsigned long tmp; rc =kstrtoul (str +5 ,10 , &tmp);
@@ -917,7 +917,7 @@ int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob) rc =cfs_trace_copyin_string (str, usr_str_nob +1 , usr_str, usr_str_nob); -if (rc ==0 ) +if (!rc) rc =cfs_trace_daemon_command (str);kfree (str);
@@ -1072,7 +1072,7 @@ static int tracefiled(void *arg)__LASSERT (list_empty (&pc.pc_pages)); end_loop:if (atomic_read (&tctl->tctl_shutdown)) { -if (last_loop ==0 ) { +if (!last_loop) { last_loop =1 ;continue ; }else {
drivers/staging/lustre/lnet/libcfs/workitem.c +1 -1
@@ -325,7 +325,7 @@ static int cfs_wi_scheduler(void *arg)list_del (&sched->ws_list);spin_unlock (&cfs_wi_data.wi_glock); -LASSERT (sched->ws_nscheduled ==0 ); +LASSERT (!sched->ws_nscheduled);LIBCFS_FREE (sched,sizeof (*sched)); }
Signature · 1 line
1.7.1
Re: [PATCH 12/19] staging: lustre: libcfs: remove == 0 testing
Quoted 3 lines · James Simmons
Testing == 0 is not kernel style so remove this
type of testing from libcfs.
That's not true. Checkpatch.pl won't complain.
Not everyone has thought about it or agrees with me but there are time when == 0 is idiomatic. For example, if you are talking about the *number* zero then it should probably be == 0. If it's like "rc == 0" then "rc" doesn't mean the number it means success/fail so it should be "if (!rc) ". But it's intuitive to say "if (len == 0) ".
The other place is strcmp() and friends where it's much more intuitive:
strcmp(a, b) == 0 means a == b strcmp(a, b) < 0 means a < b strcmp(a, b) != 0 means a != b
regards,
dan carpenter
Re: [PATCH 12/19] staging: lustre: libcfs: remove == 0 testing
Quoted 8 lines · James Simmons
Quoted 3 lines
Testing == 0 is not kernel style so remove this
type of testing from libcfs.That's not true. Checkpatch.pl won't complain.
It got lumped in with the checkpatch fixes. Also the __uXX problem is not reported by checkpatch so this patch series covers checkpatch + style issues.
Quoted 11 lines
Not everyone has thought about it or agrees with me but there are time when == 0 is idiomatic. For example, if you are talking about the *number* zero then it should probably be == 0. If it's like "rc == 0" then "rc" doesn't mean the number it means success/fail so it should be "if (!rc) ". But it's intuitive to say "if (len == 0) ".
The other place is
strcmp()and friends where it's much more intuitive:strcmp(a, b) == 0 means a == b strcmp(a, b) < 0 means a < b strcmp(a, b) != 0 means a != b
Oh this I didn't know. I will keep this in mind for the future.
PATCH 13/19 staging: lustre: libcfs: white space cleanup
In reply to James SimmonsRemove white space present for variable declarations or initialization. Cleanup structs was strange alignments due to white spacing.
--- drivers/staging/lustre/lnet/libcfs/debug.c | 16 ++-- drivers/staging/lustre/lnet/libcfs/hash.c | 24 +++--- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 2 +- drivers/staging/lustre/lnet/libcfs/libcfs_lock.c | 14 ++-- drivers/staging/lustre/lnet/libcfs/libcfs_mem.c | 22 ++-- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 24 +++--- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 100 ++++++++++---------- .../lustre/lnet/libcfs/linux/linux-crypto.c | 20 ++-- .../staging/lustre/lnet/libcfs/linux/linux-debug.c | 6 +- .../staging/lustre/lnet/libcfs/linux/linux-prim.c | 10 +- .../lustre/lnet/libcfs/linux/linux-tracefile.c | 8 +- drivers/staging/lustre/lnet/libcfs/module.c | 14 ++-- drivers/staging/lustre/lnet/libcfs/tracefile.c | 80 ++++++++-------- drivers/staging/lustre/lnet/libcfs/tracefile.h | 28 +++--- drivers/staging/lustre/lnet/libcfs/workitem.c | 40 ++++---- 15 files changed, 204 insertions(+), 204 deletions(-)
drivers/staging/lustre/lnet/libcfs/debug.c +8 -8
@@ -255,9 +255,9 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp) {const char *(*fn)(int bit) = is_subsys ? libcfs_debug_subsys2str : libcfs_debug_dbg2str; -int len =0 ; -const char *token; -int i; +int len =0 ; +const char *token; +int i;if (!mask) {/* "0" */ if (size >0 )
@@ -301,10 +301,10 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp) {const char *(*fn)(int bit) = is_subsys ? libcfs_debug_subsys2str : libcfs_debug_dbg2str; -int m =0 ; -int matched; -int n; -int t; +int m =0 ; +int matched; +int n; +int t;/* Allow a number for backwards compatibility */
@@ -389,8 +389,8 @@ void libcfs_debug_dumplog(void)int libcfs_debug_init (unsigned long bufsize) { -int rc =0 ;unsigned int max = libcfs_debug_mb; +int rc =0 ;init_waitqueue_head (&debug_ctlwq);
drivers/staging/lustre/lnet/libcfs/hash.c +12 -12
@@ -289,7 +289,7 @@ struct cfs_hash_head_dep {static struct hlist_head *cfs_hash_hd_hhead (struct cfs_hash *hs,struct cfs_hash_bd *bd) { -struct cfs_hash_head_dep *head; +struct cfs_hash_head_dep *head; head = (struct cfs_hash_head_dep *)&bd->bd_bucket->hsb_head[0 ];return &head[bd->bd_offset].hd_head;
@@ -512,9 +512,9 @@ struct cfs_hash_dhead_dep {return ;spin_lock (&hs->hs_dep_lock); - hs->hs_dep_max = dep_cur; - hs->hs_dep_bkt = bd->bd_bucket->hsb_index; - hs->hs_dep_off = bd->bd_offset; + hs->hs_dep_max = dep_cur; + hs->hs_dep_bkt = bd->bd_bucket->hsb_index; + hs->hs_dep_off = bd->bd_offset; hs->hs_dep_bits = hs->hs_cur_bits;spin_unlock (&hs->hs_dep_lock);
@@ -908,9 +908,9 @@ struct hlist_node *return NULL ; } - new_bkts[i]->hsb_index = i; - new_bkts[i]->hsb_version =1 ;/* shouldn't be zero */ - new_bkts[i]->hsb_depmax =-1 ;/* unknown */ + new_bkts[i]->hsb_index = i; + new_bkts[i]->hsb_version =1 ;/* shouldn't be zero */ + new_bkts[i]->hsb_depmax =-1 ;/* unknown */ bd.bd_bucket = new_bkts[i];cfs_hash_bd_for_each_hlist (hs, &bd, hhead)INIT_HLIST_HEAD (hhead);
@@ -950,9 +950,9 @@ static int cfs_hash_dep_print(struct cfs_workitem *wi)int bits;spin_lock (&hs->hs_dep_lock); - dep = hs->hs_dep_max; - bkt = hs->hs_dep_bkt; - off = hs->hs_dep_off; + dep = hs->hs_dep_max; + bkt = hs->hs_dep_bkt; + off = hs->hs_dep_off; bits = hs->hs_dep_bits;spin_unlock (&hs->hs_dep_lock);
@@ -1040,7 +1040,7 @@ struct cfs_hash * hs->hs_max_bits = (__u8 )max_bits; hs->hs_bkt_bits = (__u8 )bkt_bits; - hs->hs_ops = ops; + hs->hs_ops = ops; hs->hs_extra_bytes = extra_bytes; hs->hs_rehash_bits =0 ;cfs_wi_init (&hs->hs_rehash_wi, hs, cfs_hash_rehash_worker);
@@ -1292,7 +1292,7 @@ void cfs_hash_putref(struct cfs_hash *hs) }if (hnode) { - obj =cfs_hash_object (hs, hnode); + obj =cfs_hash_object (hs, hnode); bits =cfs_hash_rehash_bits (hs); }
drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +1 -1
@@ -74,7 +74,7 @@ struct cfs_cpt_table *int cfs_cpt_table_print (struct cfs_cpt_table *cptab,char *buf,int len) { -int rc; +int rc; rc =snprintf (buf, len,"%d\t: %d\n" ,0 ,0 ); len -= rc;
drivers/staging/lustre/lnet/libcfs/libcfs_lock.c +7 -7
@@ -52,9 +52,9 @@ struct cfs_percpt_lock * cfs_percpt_lock_create(struct cfs_cpt_table *cptab, struct lock_class_key *keys) { - struct cfs_percpt_lock *pcl; -spinlock_t *lock; -int i; + struct cfs_percpt_lock *pcl; +spinlock_t *lock; +int i;/* NB: cptab can be NULL, pcl will be for HW CPUs on that case */ LIBCFS_ALLOC (pcl,sizeof (*pcl));
@@ -94,8 +94,8 @@ struct cfs_percpt_lock * cfs_percpt_lock(struct cfs_percpt_lock *pcl, int index) __acquires(pcl->pcl_locks) { - int ncpt = cfs_cpt_number(pcl->pcl_cptab); -int i; + int ncpt = cfs_cpt_number(pcl->pcl_cptab); +int i;LASSERT (index >=CFS_PERCPT_LOCK_EX && index < ncpt);
@@ -130,8 +130,8 @@ struct cfs_percpt_lock * cfs_percpt_unlock(struct cfs_percpt_lock *pcl, int index) __releases(pcl->pcl_locks) { - int ncpt = cfs_cpt_number(pcl->pcl_cptab); -int i; + int ncpt = cfs_cpt_number(pcl->pcl_cptab); +int i; index = ncpt ==1 ?0 : index;
drivers/staging/lustre/lnet/libcfs/libcfs_mem.c +11 -11
@@ -43,8 +43,8 @@ struct cfs_var_array {void cfs_percpt_free (void *vars) { -struct cfs_var_array *arr; -int i; +struct cfs_var_array *arr; +int i; arr = container_of(vars, struct cfs_var_array, va_ptrs[0]);
@@ -72,9 +72,9 @@ struct cfs_var_array {void *cfs_percpt_alloc (struct cfs_cpt_table *cptab,unsigned int size) { -struct cfs_var_array *arr; -int count; -int i; +struct cfs_var_array *arr; +int count; +int i; count =cfs_cpt_number (cptab);
@@ -120,8 +120,8 @@ struct cfs_var_array {void cfs_array_free (void *vars) { -struct cfs_var_array *arr; -int i; +struct cfs_var_array *arr; +int i; arr = container_of(vars, struct cfs_var_array, va_ptrs[0]);
@@ -144,15 +144,15 @@ struct cfs_var_array {void *cfs_array_alloc (int count,unsigned int size) { -struct cfs_var_array *arr; -int i; +struct cfs_var_array *arr; +int i; LIBCFS_ALLOC(arr, offsetof(struct cfs_var_array, va_ptrs[count]));if (!arr)return NULL ; - arr->va_count = count; - arr->va_size = size; + arr->va_count = count; + arr->va_size = size;for (i =0 ; i < count; i++) {LIBCFS_ALLOC (arr->va_ptrs[i], size);
drivers/staging/lustre/lnet/libcfs/libcfs_string.c +12 -12
@@ -112,7 +112,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),char *cfs_firststr (char *str,size_t size) {size_t i =0 ; -char *end; +char *end;/* trim leading spaces */ while (i < size && *str &&isspace (*str)) {
@@ -276,8 +276,8 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), cfs_range_expr_parse(struct cfs_lstr *src, unsigned int min, unsigned int max, int bracketed, struct cfs_range_expr **expr) { - struct cfs_range_expr *re; -struct cfs_lstr tok; + struct cfs_range_expr *re; +struct cfs_lstr tok;LIBCFS_ALLOC (re,sizeof (*re));if (!re)
@@ -413,7 +413,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),int cfs_expr_list_match (__u32 value,struct cfs_expr_list *expr_list) { -struct cfs_range_expr *expr; +struct cfs_range_expr *expr;list_for_each_entry (expr, &expr_list->el_exprs, re_link) { if (value >= expr->re_lo && value <= expr->re_hi &&
@@ -435,10 +435,10 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),int cfs_expr_list_values (struct cfs_expr_list *expr_list,int max,__u32 **valpp) { -struct cfs_range_expr *expr; -__u32 *val; -int count =0 ; -int i; +struct cfs_range_expr *expr; +__u32 *val; +int count =0 ; +int i;list_for_each_entry (expr, &expr_list->el_exprs, re_link) {for (i = expr->re_lo; i <= expr->re_hi; i++) {
@@ -504,10 +504,10 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), cfs_expr_list_parse(char *str, int len, unsigned int min, unsigned int max, struct cfs_expr_list **elpp) { -struct cfs_expr_list *expr_list; -struct cfs_range_expr *expr; -struct cfs_lstr src; -int rc; +struct cfs_expr_list *expr_list; +struct cfs_range_expr *expr; +struct cfs_lstr src; +int rc;LIBCFS_ALLOC (expr_list,sizeof (*expr_list));if (!expr_list)
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +50 -50
242 lines not on this page · raw message
drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c +10 -10
@@ -64,7 +64,7 @@ static int cfs_crypto_hash_alloc(enum cfs_crypto_hash_alg hash_alg, unsigned int key_len) {struct crypto_ahash *tfm; -int err =0 ; +int err =0 ; *type =cfs_crypto_hash_type (hash_alg);
@@ -147,10 +147,10 @@ int cfs_crypto_hash_digest(enum cfs_crypto_hash_alg hash_alg, unsigned char *key, unsigned int key_len, unsigned char *hash, unsigned int *hash_len) { - struct scatterlist sl; + struct scatterlist sl;struct ahash_request *req; -int err; -const struct cfs_crypto_hash_type *type; +int err; +const struct cfs_crypto_hash_type *type;if (!buf || !buf_len || !hash_len)return -EINVAL ;
@@ -198,8 +198,8 @@ struct cfs_crypto_hash_desc * unsigned char *key, unsigned int key_len) {struct ahash_request *req; -int err; -const struct cfs_crypto_hash_type *type; +int err; +const struct cfs_crypto_hash_type *type; err =cfs_crypto_hash_alloc (hash_alg, &type, &req, key, key_len);
@@ -273,7 +273,7 @@ int cfs_crypto_hash_update(struct cfs_crypto_hash_desc *hdesc,int cfs_crypto_hash_final (struct cfs_crypto_hash_desc *hdesc,unsigned char *hash,unsigned int *hash_len) { -int err; +int err;struct ahash_request *req = (void *)hdesc;int size =crypto_ahash_digestsize (crypto_ahash_reqtfm (req));
@@ -312,8 +312,8 @@ static void cfs_crypto_performance_test(enum cfs_crypto_hash_alg hash_alg) {int buf_len =max (PAGE_SIZE ,1048576UL );void *buf; -unsigned long start, end; -int bcount, err =0 ; +unsigned long start, end; +int bcount, err =0 ;struct page *page;unsigned char hash[CFS_CRYPTO_HASH_DIGESTSIZE_MAX ];unsigned int hash_len =sizeof (hash);
@@ -358,7 +358,7 @@ static void cfs_crypto_performance_test(enum cfs_crypto_hash_alg hash_alg)CDEBUG (D_INFO ,"Crypto hash algorithm %s test error: rc = %d\n" ,cfs_crypto_hash_name (hash_alg), err); }else { -unsigned long tmp; +unsigned long tmp; tmp = ((bcount * buf_len /jiffies_to_msecs (end - start)) *1000 ) / (1024 *1024 );
drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c +3 -3
@@ -68,7 +68,7 @@void libcfs_run_debug_log_upcall (char *file) {char *argv[3 ]; -int rc; +int rc;char *envp[] = {"HOME=/" ,"PATH=/sbin:/bin:/usr/sbin:/usr/bin" ,
@@ -93,8 +93,8 @@ void libcfs_run_debug_log_upcall(char *file)void libcfs_run_upcall (char **argv) { -int rc; -int argc; +int rc; +int argc;char *envp[] = {"HOME=/" ,"PATH=/sbin:/bin:/usr/sbin:/usr/bin" ,
drivers/staging/lustre/lnet/libcfs/linux/linux-prim.c +5 -5
@@ -45,8 +45,8 @@sigset_t cfs_block_allsigs (void ) { -unsigned long flags; -sigset_t old; +unsigned long flags; +sigset_t old;spin_lock_irqsave (¤t->sighand->siglock, flags); old = current->blocked;
@@ -60,8 +60,8 @@sigset_t cfs_block_sigs (unsigned long sigs) { -unsigned long flags; -sigset_t old; +unsigned long flags; +sigset_t old;spin_lock_irqsave (¤t->sighand->siglock, flags); old = current->blocked;
@@ -91,7 +91,7 @@ sigset_t cfs_block_sigsinv(unsigned long sigs)void cfs_restore_sigs (sigset_t old) { -unsigned long flags; +unsigned long flags;spin_lock_irqsave (¤t->sighand->siglock, flags); current->blocked = old;
drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c +4 -4
@@ -49,8 +49,8 @@int cfs_tracefile_init_arch (void ) { -int i; -int j; +int i; +int j;struct cfs_trace_cpu_data *tcd;/* initialize trace_data */
@@ -91,8 +91,8 @@ int cfs_tracefile_init_arch(void)void cfs_tracefile_fini_arch (void ) { -int i; -int j; +int i; +int j;for (i =0 ; i <num_possible_cpus (); i++)for (j =0 ; j <3 ; j++) {
drivers/staging/lustre/lnet/libcfs/module.c +7 -7
@@ -183,12 +183,12 @@ int lprocfs_call_handler(void *data, int write, loff_t *ppos,static int __proc_dobitmasks (void *data,int write,loff_t pos,void __user *buffer,int nob) { -const int tmpstrlen =512 ; -char *tmpstr; -int rc; +const int tmpstrlen =512 ; +char *tmpstr; +int rc;unsigned int *mask = data; -int is_subsys = (mask == &libcfs_subsystem_debug) ?1 :0 ; -int is_printk = (mask == &libcfs_printk) ?1 :0 ; +int is_subsys = (mask == &libcfs_subsystem_debug) ?1 :0 ; +int is_printk = (mask == &libcfs_printk) ?1 :0 ; rc =cfs_trace_allocate_string_buffer (&tmpstr, tmpstrlen);if (rc <0 )
@@ -293,8 +293,8 @@ static int __proc_cpt_table(void *data, int write, loff_t pos, void __user *buffer, int nob) { char *buf = NULL; -int len =4096 ; -int rc =0 ; +int len =4096 ; +int rc =0 ;if (write)return -EPERM ;
drivers/staging/lustre/lnet/libcfs/tracefile.c +40 -40
178 lines not on this page · raw message
drivers/staging/lustre/lnet/libcfs/tracefile.h +14 -14
@@ -45,7 +45,7 @@ enum cfs_trace_buf_type {/* trace file lock routines */ #define TRACEFILE_NAME_SIZE 1024 -extern char cfs_tracefile[TRACEFILE_NAME_SIZE ]; +extern char cfs_tracefile[TRACEFILE_NAME_SIZE ];extern long long cfs_tracefile_size;void libcfs_run_debug_log_upcall (char *file);
@@ -80,7 +80,7 @@ int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,void libcfs_debug_dumplog_internal (void *arg);void libcfs_register_panic_notifier (void );void libcfs_unregister_panic_notifier (void ); -extern int libcfs_panic_in_progress; +extern int libcfs_panic_in_progress;int cfs_trace_max_debug_mb (void );#define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT))
@@ -113,14 +113,14 @@ int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,* tcd_for_each_type_lock */ spinlock_t tcd_lock; -unsigned long tcd_lock_flags; +unsigned long tcd_lock_flags;/* * pages with trace records not yet processed by tracefiled. */ -struct list_head tcd_pages; +struct list_head tcd_pages;/* number of pages on ->tcd_pages */ -unsigned long tcd_cur_pages; +unsigned long tcd_cur_pages;/* * pages with trace records already processed by
@@ -132,9 +132,9 @@ int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,* (put_pages_on_daemon_list()). LRU pages from this list are * discarded when list grows too large. */ -struct list_head tcd_daemon_pages; +struct list_head tcd_daemon_pages;/* number of pages on ->tcd_daemon_pages */ -unsigned long tcd_cur_daemon_pages; +unsigned long tcd_cur_daemon_pages;/* * Maximal number of pages allowed on ->tcd_pages and
@@ -142,7 +142,7 @@ int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,* Always TCD_MAX_PAGES * tcd_pages_factor / 100 in current * implementation. */ -unsigned long tcd_max_pages; +unsigned long tcd_max_pages;/* * preallocated pages to write trace records into. Pages from
@@ -166,15 +166,15 @@ int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,* TCD_STOCK_PAGES pagesful are consumed by trace records all * emitted in non-blocking contexts. Which is quite unlikely. */ -struct list_head tcd_stock_pages; +struct list_head tcd_stock_pages;/* number of pages on ->tcd_stock_pages */ -unsigned long tcd_cur_stock_pages; +unsigned long tcd_cur_stock_pages; -unsigned short tcd_shutting_down; -unsigned short tcd_cpu; -unsigned short tcd_type; +unsigned short tcd_shutting_down; +unsigned short tcd_cpu; +unsigned short tcd_type;/* The factors to share debug memory. */ -unsigned short tcd_pages_factor; +unsigned short tcd_pages_factor; } tcd;char __pad[L1_CACHE_ALIGN (sizeof (struct cfs_trace_cpu_data ))]; };
drivers/staging/lustre/lnet/libcfs/workitem.c +20 -20
@@ -45,7 +45,7 @@ struct cfs_wi_sched {/* chain on global list */ struct list_head ws_list;/** serialised workitems */ -spinlock_t ws_lock; +spinlock_t ws_lock;/** where schedulers sleep */ wait_queue_head_t ws_waitq;/** concurrent workitems */
@@ -59,26 +59,26 @@ struct cfs_wi_sched {*/ struct list_head ws_rerunq;/** CPT-table for this scheduler */ -struct cfs_cpt_table *ws_cptab; +struct cfs_cpt_table *ws_cptab;/** CPT id for affinity */ -int ws_cpt; +int ws_cpt;/** number of scheduled workitems */ -int ws_nscheduled; +int ws_nscheduled;/** started scheduler thread, protected by cfs_wi_data::wi_glock */ - unsigned int ws_nthreads:30; + unsigned int ws_nthreads:30;/** shutting down, protected by cfs_wi_data::wi_glock */ - unsigned int ws_stopping:1; + unsigned int ws_stopping:1;/** serialize starting thread, protected by cfs_wi_data::wi_glock */ - unsigned int ws_starting:1; + unsigned int ws_starting:1;/** scheduler name */ -char ws_name[CFS_WS_NAME_LEN ]; +char ws_name[CFS_WS_NAME_LEN ]; }; static struct cfs_workitem_data { /** serialize */ spinlock_t wi_glock; /** list of all schedulers */ - struct list_head wi_scheds; + struct list_head wi_scheds; /** WI module is initialized */ int wi_init; /** shutting down the whole WI module */
@@ -136,7 +136,7 @@ struct cfs_wi_sched {int cfs_wi_deschedule (struct cfs_wi_sched *sched,struct cfs_workitem *wi) { -int rc; +int rc;LASSERT (!in_interrupt ());/* because we use plain spinlock */ LASSERT (!sched->ws_stopping);
@@ -202,7 +202,7 @@ struct cfs_wi_sched {static int cfs_wi_scheduler (void *arg) { -struct cfs_wi_sched *sched = (struct cfs_wi_sched *)arg; +struct cfs_wi_sched *sched = (struct cfs_wi_sched *)arg;cfs_block_allsigs ();
@@ -223,8 +223,8 @@ static int cfs_wi_scheduler(void *arg)spin_lock (&sched->ws_lock);while (!sched->ws_stopping) { -int nloops =0 ; -int rc; +int nloops =0 ; +int rc;struct cfs_workitem *wi; while (!list_empty(&sched->ws_runq) &&
@@ -238,13 +238,13 @@ static int cfs_wi_scheduler(void *arg)LASSERT (sched->ws_nscheduled >0 ); sched->ws_nscheduled--; - wi->wi_running =1 ; + wi->wi_running =1 ; wi->wi_scheduled =0 ;spin_unlock (&sched->ws_lock); nloops++; - rc = (*wi->wi_action) (wi); + rc = (*wi->wi_action)(wi);spin_lock (&sched->ws_lock);if (rc)/* WI should be dead, even be freed! */
@@ -289,7 +289,7 @@ static int cfs_wi_scheduler(void *arg)void cfs_wi_sched_destroy (struct cfs_wi_sched *sched) { -int i; +int i;LASSERT (cfs_wi_data.wi_init);LASSERT (!cfs_wi_data.wi_stopping);
@@ -335,8 +335,8 @@ static int cfs_wi_scheduler(void *arg) cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, int cpt, int nthrs, struct cfs_wi_sched **sched_pp) { -struct cfs_wi_sched *sched; -int rc; +struct cfs_wi_sched *sched; +int rc;LASSERT (cfs_wi_data.wi_init);LASSERT (!cfs_wi_data.wi_stopping);
@@ -364,7 +364,7 @@ static int cfs_wi_scheduler(void *arg) rc =0 ;while (nthrs >0 ) { -char name[16 ]; +char name[16 ];struct task_struct *task;spin_lock (&cfs_wi_data.wi_glock);
@@ -431,7 +431,7 @@ static int cfs_wi_scheduler(void *arg)void cfs_wi_shutdown (void ) { -struct cfs_wi_sched *sched; +struct cfs_wi_sched *sched;struct cfs_wi_sched *temp;spin_lock (&cfs_wi_data.wi_glock);
Signature · 1 line
1.7.1
PATCH 14/19 staging: lustre: libcfs: fix misspelling of descriptor
In reply to James SimmonsFix typo for correct spelling.
--- .../lustre/lnet/libcfs/linux/linux-crypto.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c +1 -1
@@ -177,7 +177,7 @@ int cfs_crypto_hash_digest(enum cfs_crypto_hash_alg hash_alg,EXPORT_SYMBOL (cfs_crypto_hash_digest);/** -* Allocate and initialize desriptor for hash algorithm. +* Allocate and initialize descriptor for hash algorithm. * * This should be used to initialize a hash descriptor for multiple calls * to a single hash function when computing the hash across multiple
Signature · 1 line
1.7.1
PATCH 15/19 staging: lustre: libcfs: Make char * array envp static constant
In reply to James SimmonsThe envp char array can be made static constant.
--- .../staging/lustre/lnet/libcfs/linux/linux-debug.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c +8 -6
@@ -69,10 +69,11 @@ void libcfs_run_debug_log_upcall(char *file) {char *argv[3 ];int rc; -char *envp[] = { +static const char *const envp[] = {"HOME=/" ,"PATH=/sbin:/bin:/usr/sbin:/usr/bin" , -NULL }; +NULL + }; argv[0 ] = lnet_debug_log_upcall;
@@ -81,7 +82,7 @@ void libcfs_run_debug_log_upcall(char *file) argv[2 ] =NULL ; - rc =call_usermodehelper (argv[0 ], argv, envp,1 ); + rc =call_usermodehelper (argv[0 ], argv, (char **)envp,1 );if (rc <0 && rc != -ENOENT ) {CERROR ("Error %d invoking LNET debug log upcall %s %s; check /sys/kernel/debug/lnet/debug_log_upcall\n" , rc, argv[0 ], argv[1 ]);
@@ -95,10 +96,11 @@ void libcfs_run_upcall(char **argv) {int rc;int argc; -char *envp[] = { +static const char *const envp[] = {"HOME=/" ,"PATH=/sbin:/bin:/usr/sbin:/usr/bin" , -NULL }; +NULL + }; argv[0 ] = lnet_upcall; argc =1 ;
@@ -107,7 +109,7 @@ void libcfs_run_upcall(char **argv)LASSERT (argc >=2 ); - rc =call_usermodehelper (argv[0 ], argv, envp,1 ); + rc =call_usermodehelper (argv[0 ], argv, (char **)envp,1 );if (rc <0 && rc != -ENOENT ) { CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; check /sys/kernel/debug/lnet/upcall\n", rc, argv[0], argv[1],
Signature · 1 line
1.7.1
PATCH 16/19 staging: lustre: libcfs: use pr_* instead of printk
In reply to James SimmonsCheckpatch recommended that we use pr_*() instead
of printk directly.
--- .../lustre/lnet/libcfs/linux/linux-tracefile.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-tracefile.c +5 -5
@@ -85,7 +85,7 @@ int cfs_tracefile_init_arch(void) out:cfs_tracefile_fini_arch (); -printk (KERN_ERR "lnet: Not enough memory\n" ); +pr_err ("lnet: Not enough memory\n" );return -ENOMEM ; }
@@ -239,11 +239,11 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, }if (mask &D_CONSOLE ) { -printk ("%s%s: %.*s" , ptype, prefix, len, buf); +pr_info ("%s%s: %.*s" , ptype, prefix, len, buf); }else { -printk ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, - hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, - fn, len, buf); +pr_info ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, + hdr->ph_pid, hdr->ph_extern_pid, file, + hdr->ph_line_num, fn, len, buf); } }
Signature · 1 line
1.7.1
PATCH 17/19 staging: lustre: libcfs: remove use of __u* types
In reply to James SimmonsThe __[u|s]* types are for UAPI headers or user space. They shouldn't be used in core kernel code.
--- drivers/staging/lustre/lnet/libcfs/fail.c | 4 ++-- drivers/staging/lustre/lnet/libcfs/hash.c | 16 ++++++++-------- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 6 +++--- .../lustre/lnet/libcfs/linux/linux-module.c | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-)
drivers/staging/lustre/lnet/libcfs/fail.c +2 -2
@@ -46,7 +46,7 @@int cfs_race_state;EXPORT_SYMBOL (cfs_race_state); -int __cfs_fail_check_set (__u32 id,__u32 value,int set) +int __cfs_fail_check_set (u32 id,u32 value,int set) {static atomic_t cfs_fail_count =ATOMIC_INIT (0 );
@@ -124,7 +124,7 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set) }EXPORT_SYMBOL (__cfs_fail_check_set); -int __cfs_fail_timeout_set (__u32 id,__u32 value,int ms,int set) +int __cfs_fail_timeout_set (u32 id,u32 value,int ms,int set) {int ret;
drivers/staging/lustre/lnet/libcfs/hash.c +8 -8
@@ -1035,10 +1035,10 @@ struct cfs_hash *cfs_hash_lock_setup (hs);cfs_hash_hlist_setup (hs); - hs->hs_cur_bits = (__u8 )cur_bits; - hs->hs_min_bits = (__u8 )cur_bits; - hs->hs_max_bits = (__u8 )max_bits; - hs->hs_bkt_bits = (__u8 )bkt_bits; + hs->hs_cur_bits = (u8 )cur_bits; + hs->hs_min_bits = (u8 )cur_bits; + hs->hs_max_bits = (u8 )max_bits; + hs->hs_bkt_bits = (u8 )bkt_bits; hs->hs_ops = ops; hs->hs_extra_bytes = extra_bytes;
@@ -1405,14 +1405,14 @@ void cfs_hash_putref(struct cfs_hash *hs)* . if @removal_safe is true, use can remove current item by * cfs_hash_bd_del_locked */ -static __u64 +static u64 cfs_hash_for_each_tight (struct cfs_hash *hs,cfs_hash_for_each_cb_t func,void *data,int remove_safe) {struct hlist_node *hnode;struct hlist_node *pos;struct cfs_hash_bd bd; -__u64 count =0 ; +u64 count =0 ;int excl = !!remove_safe;int loop =0 ;int i;
@@ -1525,7 +1525,7 @@ struct cfs_hash_cond_arg { }EXPORT_SYMBOL (cfs_hash_is_empty); -__u64 +u64 cfs_hash_size_get (struct cfs_hash *hs) { return cfs_hash_with_counter(hs) ?
@@ -1556,7 +1556,7 @@ struct cfs_hash_cond_arg {struct hlist_node *hnode;struct hlist_node *tmp;struct cfs_hash_bd bd; -__u32 version; +u32 version;int count =0 ;int stop_on_change;int end =-1 ;
drivers/staging/lustre/lnet/libcfs/libcfs_string.c +3 -3
@@ -411,7 +411,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),* \retval 0 otherwise */ int -cfs_expr_list_match (__u32 value,struct cfs_expr_list *expr_list) +cfs_expr_list_match (u32 value,struct cfs_expr_list *expr_list) {struct cfs_range_expr *expr;
@@ -433,10 +433,10 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),* \retval < 0 for failure */ int -cfs_expr_list_values (struct cfs_expr_list *expr_list,int max,__u32 **valpp) +cfs_expr_list_values (struct cfs_expr_list *expr_list,int max,u32 **valpp) {struct cfs_range_expr *expr; -__u32 *val; +u32 *val;int count =0 ;int i;
drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +1 -1
@@ -83,7 +83,7 @@ static inline bool libcfs_ioctl_is_invalid(struct libcfs_ioctl_data *data)CERROR ("LIBCFS ioctl: plen2 nonzero but no pbuf2 pointer\n" );return true; } -if ((__u32 )libcfs_ioctl_packlen (data) != data->ioc_hdr.ioc_len) { +if ((u32 )libcfs_ioctl_packlen (data) != data->ioc_hdr.ioc_len) {CERROR ("LIBCFS ioctl: packlen != ioc_len\n" );return true; }
Signature · 1 line
1.7.1
PATCH 18/19 staging: lustre: lnet: use BIT macro in LNet selftest
In reply to James SimmonsSome of the defines for lnet selftest can use the BIT macros.
--- drivers/staging/lustre/lnet/selftest/timer.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lnet/selftest/timer.c +2 -2
@@ -46,9 +46,9 @@* to cover a time period of 1024 seconds into the future before wrapping. */ #define STTIMER_MINPOLL 3/* log2 min poll interval (8 s) */ -#define STTIMER_SLOTTIME (1 << STTIMER_MINPOLL) +#define STTIMER_SLOTTIME BIT(STTIMER_MINPOLL)#define STTIMER_SLOTTIMEMASK (~(STTIMER_SLOTTIME - 1)) -#define STTIMER_NSLOTS (1 << 7) +#define STTIMER_NSLOTS BIT(7)#define STTIMER_SLOT (t) (&stt_data.stt_hash[(((t) >> STTIMER_MINPOLL) & \ (STTIMER_NSLOTS - 1))])
Signature · 1 line
1.7.1
PATCH 19/19 staging: lustre: lnet: cleanup some of the > 80 line issues
In reply to James SimmonsCleanup some of the checkpatch over 80 character lines reported.
--- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 31 ++++++++++----- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 40 +++++++++++++------- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 6 ++- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 26 ++++++++++--- drivers/staging/lustre/lnet/selftest/conrpc.c | 10 +++-- drivers/staging/lustre/lnet/selftest/conrpc.h | 3 +- drivers/staging/lustre/lnet/selftest/console.c | 17 +++++--- drivers/staging/lustre/lnet/selftest/framework.c | 15 +++++-- drivers/staging/lustre/lnet/selftest/rpc.c | 3 +- 9 files changed, 101 insertions(+), 50 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +21 -10
@@ -96,7 +96,8 @@ }static int -ksocknal_create_peer (struct ksock_peer **peerp,lnet_ni_t *ni,lnet_process_id_t id) +ksocknal_create_peer (struct ksock_peer **peerp,lnet_ni_t *ni, +lnet_process_id_t id) {int cpt =lnet_cpt_of_nid (id.nid);struct ksock_net *net = ni->ni_data;
@@ -319,7 +320,8 @@ struct ksock_peer * }static void -ksocknal_associate_route_conn_locked (struct ksock_route *route,struct ksock_conn *conn) +ksocknal_associate_route_conn_locked (struct ksock_route *route, +struct ksock_conn *conn) {struct ksock_peer *peer = route->ksnr_peer;int type = conn->ksnc_type;
@@ -821,7 +823,8 @@ struct ksock_peer *if (k < peer->ksnp_n_passive_ips)/* using it already */ continue ; - k =ksocknal_match_peerip (iface, peerips, n_peerips); + k =ksocknal_match_peerip (iface, peerips, + n_peerips); xor = ip ^ peerips[k]; this_netmatch = !(xor & iface->ksni_netmask) ?1 :0 ;
@@ -1302,8 +1305,11 @@ struct ksock_peer */* Take packets blocking for this connection. */ list_for_each_entry_safe (tx, txtmp, &peer->ksnp_tx_queue, tx_list) { -if (conn->ksnc_proto->pro_match_tx (conn, tx, tx->tx_nonblk) ==SOCKNAL_MATCH_NO ) -continue ; +int match = conn->ksnc_proto->pro_match_tx (conn, tx, + tx->tx_nonblk); + +if (match ==SOCKNAL_MATCH_NO ) +continue ;list_del (&tx->tx_list);ksocknal_queue_tx_locked (tx, conn);
@@ -1493,8 +1499,8 @@ struct ksock_peer *spin_unlock_bh (&conn->ksnc_scheduler->kss_lock); } - peer->ksnp_proto =NULL ;/* renegotiate protocol version */ - peer->ksnp_error = error;/* stash last conn close reason */ + peer->ksnp_proto =NULL ;/* renegotiate protocol version */ + peer->ksnp_error = error;/* stash last conn close reason */ if (list_empty (&peer->ksnp_routes)) {/*
@@ -1786,7 +1792,8 @@ struct ksock_peer * (id.pid == LNET_PID_ANY || id.pid == peer->ksnp_id.pid))) continue; - count +=ksocknal_close_peer_conns_locked (peer, ipaddr,0 ); + count +=ksocknal_close_peer_conns_locked (peer, ipaddr, +0 ); } }
@@ -2026,7 +2033,10 @@ static int ksocknal_push(lnet_ni_t *ni, lnet_process_id_t id) } rc =0 ; -/* NB only new connections will pay attention to the new interface! */ +/* +* NB only new connections will pay attention to the +* new interface! +*/ }write_unlock_bh (&ksocknal_data.ksnd_global_lock);
@@ -2200,8 +2210,9 @@ static int ksocknal_push(lnet_ni_t *ni, lnet_process_id_t id)int txmem;int rxmem;int nagle; -struct ksock_conn *conn =ksocknal_get_conn_by_idx (ni, data->ioc_count); +struct ksock_conn *conn; + conn =ksocknal_get_conn_by_idx (ni, data->ioc_count);if (!conn)return -ENOENT ;
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +26 -14
@@ -620,7 +620,8 @@ struct ksock_tx * }struct ksock_conn * -ksocknal_find_conn_locked (struct ksock_peer *peer,struct ksock_tx *tx,int nonblk) +ksocknal_find_conn_locked (struct ksock_peer *peer,struct ksock_tx *tx, +int nonblk) {struct list_head *tmp;struct ksock_conn *conn;
@@ -630,10 +631,12 @@ struct ksock_conn *int fnob =0 ;list_for_each (tmp, &peer->ksnp_conns) { - struct ksock_conn *c = list_entry(tmp, struct ksock_conn, ksnc_list); -int nob =atomic_read (&c->ksnc_tx_nob) + - c->ksnc_sock->sk->sk_wmem_queued; -int rc; +struct ksock_conn *c; +int nob, rc; + + c = list_entry(tmp, struct ksock_conn, ksnc_list); + nob =atomic_read (&c->ksnc_tx_nob) + + c->ksnc_sock->sk->sk_wmem_queued;LASSERT (!c->ksnc_closing); LASSERT(c->ksnc_proto &&
@@ -752,9 +755,9 @@ struct ksock_conn *LASSERT (msg->ksm_zc_cookies[1 ]);LASSERT (conn->ksnc_proto->pro_queue_tx_zcack); +/* ZC ACK piggybacked on ztx release tx later */ if (conn->ksnc_proto->pro_queue_tx_zcack (conn, tx,0 )) - ztx = tx;/* ZC ACK piggybacked on ztx release tx later */ - + ztx = tx; }else {/* * It's a normal packet - can it piggback a noop zc-ack that
@@ -796,7 +799,8 @@ struct ksock_route *LASSERT (!route->ksnr_connecting || route->ksnr_scheduled); -if (route->ksnr_scheduled)/* connections being established */ +/* connections being established */ +if (route->ksnr_scheduled)continue ;/* all route types connected ? */
@@ -1514,7 +1518,10 @@ int ksocknal_scheduler(void *arg) rc =ksocknal_process_transmit (conn, tx);if (rc == -ENOMEM || rc == -EAGAIN ) { -/* Incomplete send: replace tx on HEAD of tx_queue */ +/* +* Incomplete send: replace tx on HEAD of +* tx_queue +*/ spin_lock_bh (&sched->kss_lock);list_add (&tx->tx_list, &conn->ksnc_tx_queue); }else {
@@ -1724,7 +1731,8 @@ void ksocknal_write_callback(struct ksock_conn *conn) timeout = active ? *ksocknal_tunables.ksnd_timeout :lnet_acceptor_timeout (); - rc =lnet_sock_read (sock, &hello->kshm_magic,sizeof (hello->kshm_magic), timeout); + rc =lnet_sock_read (sock, &hello->kshm_magic, +sizeof (hello->kshm_magic), timeout);if (rc) {CERROR ("Error %d reading HELLO from %pI4h\n" , rc, &conn->ksnc_ipaddr);
@@ -1798,7 +1806,8 @@ void ksocknal_write_callback(struct ksock_conn *conn) conn->ksnc_port > LNET_ACCEPTOR_MAX_RESERVED_PORT) { /* Userspace NAL assigns peer process ID from socket */ recv_id.pid = conn->ksnc_port | LNET_PID_USERFLAG; - recv_id.nid = LNET_MKNID(LNET_NIDNET(ni->ni_nid), conn->ksnc_ipaddr); + recv_id.nid = LNET_MKNID(LNET_NIDNET(ni->ni_nid), + conn->ksnc_ipaddr); } else { recv_id.nid = hello->kshm_src_nid; recv_id.pid = hello->kshm_src_pid;
@@ -1882,7 +1891,8 @@ void ksocknal_write_callback(struct ksock_conn *conn)if (peer->ksnp_accepting >0 ) {CDEBUG (D_NET ,"peer %s(%d) already connecting to me, retry later.\n" , -libcfs_nid2str (peer->ksnp_id.nid), peer->ksnp_accepting); +libcfs_nid2str (peer->ksnp_id.nid), + peer->ksnp_accepting); retry_later =1 ; }
@@ -2241,7 +2251,8 @@ void ksocknal_write_callback(struct ksock_conn *conn)/* Nothing to do for 'timeout' */ set_current_state (TASK_INTERRUPTIBLE ); -add_wait_queue_exclusive (&ksocknal_data.ksnd_connd_waitq, &wait); +add_wait_queue_exclusive (&ksocknal_data.ksnd_connd_waitq, + &wait);spin_unlock_bh (connd_lock); nloops =0 ;
@@ -2371,7 +2382,8 @@ void ksocknal_write_callback(struct ksock_conn *conn)struct ksock_conn *conn;struct ksock_tx *tx; -if (list_empty (&peer->ksnp_conns))/* last_alive will be updated by create_conn */ +/* last_alive will be updated by create_conn */ +if (list_empty (&peer->ksnp_conns))return 0 ;if (peer->ksnp_proto != &ksocknal_protocol_v3x)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +4 -2
@@ -202,7 +202,8 @@ fragnob = sum; conn->ksnc_rx_csum =ksocknal_csum (conn->ksnc_rx_csum, - iov[i].iov_base, fragnob); + iov[i].iov_base, + fragnob); } conn->ksnc_msg.ksm_csum = saved_csum; }
@@ -291,7 +292,8 @@ }int -ksocknal_lib_get_conn_tunables (struct ksock_conn *conn,int *txmem,int *rxmem,int *nagle) +ksocknal_lib_get_conn_tunables (struct ksock_conn *conn,int *txmem, +int *rxmem,int *nagle) {struct socket *sock = conn->ksnc_sock;int len;
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +20 -6
@@ -194,7 +194,10 @@ }if (!tx->tx_msg.ksm_zc_cookies[0 ]) { -/* NOOP tx has only one ZC-ACK cookie, can carry at least one more */ +/* +* NOOP tx has only one ZC-ACK cookie, +* can carry at least one more +*/ if (tx->tx_msg.ksm_zc_cookies[1 ] > cookie) { tx->tx_msg.ksm_zc_cookies[0 ] = tx->tx_msg.ksm_zc_cookies[1 ]; tx->tx_msg.ksm_zc_cookies[1 ] = cookie;
@@ -203,7 +206,10 @@ }if (tx->tx_msg.ksm_zc_cookies[0 ] - tx->tx_msg.ksm_zc_cookies[1 ] >2 ) { -/* not likely to carry more ACKs, skip it to simplify logic */ +/* +* not likely to carry more ACKs, skip it +* to simplify logic +*/ ksocknal_next_tx_carrier (conn); }
@@ -237,7 +243,10 @@ } }else { -/* ksm_zc_cookies[0] < ksm_zc_cookies[1], it is range of cookies */ +/* +* ksm_zc_cookies[0] < ksm_zc_cookies[1], +* it is range of cookies +*/ if (cookie >= tx->tx_msg.ksm_zc_cookies[0 ] && cookie <= tx->tx_msg.ksm_zc_cookies[1 ]) { CWARN("%s: duplicated ZC cookie: %llu\n",
@@ -425,7 +434,8 @@ tx_zc_list) {__u64 c = tx->tx_msg.ksm_zc_cookies[0 ]; -if (c == cookie1 || c == cookie2 || (cookie1 < c && c < cookie2)) { +if (c == cookie1 || c == cookie2 || + (cookie1 < c && c < cookie2)) { tx->tx_msg.ksm_zc_cookies[0 ] =0 ;list_del (&tx->tx_zc_list);list_add (&tx->tx_zc_list, &zlist);
@@ -639,7 +649,8 @@ }static int -ksocknal_recv_hello_v2 (struct ksock_conn *conn,ksock_hello_msg_t *hello,int timeout) +ksocknal_recv_hello_v2 (struct ksock_conn *conn,ksock_hello_msg_t *hello, +int timeout) {struct socket *sock = conn->ksnc_sock;int rc;
@@ -737,7 +748,10 @@ tx->tx_nob = offsetof(ksock_msg_t, ksm_u.lnetmsg.ksnm_hdr); tx->tx_resid = offsetof(ksock_msg_t, ksm_u.lnetmsg.ksnm_hdr); } -/* Don't checksum before start sending, because packet can be piggybacked with ACK */ +/* +* Don't checksum before start sending, because packet can be +* piggybacked with ACK +*/ } static void
drivers/staging/lustre/lnet/selftest/conrpc.c +6 -4
@@ -87,7 +87,8 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *,static int lstcon_rpc_init (struct lstcon_node *nd,int service,unsigned int feats, -int bulk_npg,int bulk_len,int embedded,struct lstcon_rpc *crpc) +int bulk_npg,int bulk_len,int embedded, +struct lstcon_rpc *crpc) { crpc->crp_rpc = sfw_create_rpc(nd->nd_id, service, feats, bulk_npg, bulk_len,
@@ -292,8 +293,8 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *,spin_lock (&rpc->crpc_lock); -if (!crpc->crp_posted ||/* not posted */ - crpc->crp_stamp) {/* rpc done or aborted already */ +if (!crpc->crp_posted ||/* not posted */ + crpc->crp_stamp) {/* rpc done or aborted already */ if (!crpc->crp_stamp) { crpc->crp_stamp =cfs_time_current (); crpc->crp_status = -EINTR ;
@@ -778,7 +779,8 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, }static int -lstcon_bulkrpc_v0_prep (lst_test_bulk_param_t *param,struct srpc_test_reqst *req) +lstcon_bulkrpc_v0_prep (lst_test_bulk_param_t *param, +struct srpc_test_reqst *req) {struct test_bulk_req *brq = &req->tsr_u.bulk_v0;
drivers/staging/lustre/lnet/selftest/conrpc.h +2 -1
@@ -131,7 +131,8 @@ int lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, lstcon_rpc_readent_func_t readent);void lstcon_rpc_trans_abort (struct lstcon_rpc_trans *trans,int error);void lstcon_rpc_trans_destroy (struct lstcon_rpc_trans *trans); -void lstcon_rpc_trans_addreq (struct lstcon_rpc_trans *trans,struct lstcon_rpc *req); +void lstcon_rpc_trans_addreq (struct lstcon_rpc_trans *trans, +struct lstcon_rpc *req);int lstcon_rpc_trans_postwait (struct lstcon_rpc_trans *trans,int timeout);int lstcon_rpc_pinger_start (void );void lstcon_rpc_pinger_stop (void );
drivers/staging/lustre/lnet/selftest/console.c +10 -7
@@ -86,7 +86,7 @@if (!create)return -ENOENT ; -LIBCFS_ALLOC (*ndpp,sizeof (struct lstcon_node ) +sizeof (struct lstcon_ndlink )); +LIBCFS_ALLOC (*ndpp,sizeof (*ndpp) +sizeof (*ndl));if (!*ndpp)return -ENOMEM ;
@@ -131,12 +131,12 @@list_del (&ndl->ndl_link);list_del (&ndl->ndl_hlink); -LIBCFS_FREE (nd,sizeof (struct lstcon_node ) +sizeof (struct lstcon_ndlink )); +LIBCFS_FREE (nd,sizeof (*nd) +sizeof (*ndl)); }static int -lstcon_ndlink_find (struct list_head *hash, -lnet_process_id_t id,struct lstcon_ndlink **ndlpp,int create) +lstcon_ndlink_find (struct list_head *hash,lnet_process_id_t id, +struct lstcon_ndlink **ndlpp,int create) {unsigned int idx =LNET_NIDADDR (id.nid) %LST_NODE_HASHSIZE ;struct lstcon_ndlink *ndl;
@@ -230,7 +230,8 @@ grp->grp_ref++; } -static void lstcon_group_ndlink_release (struct lstcon_group *,struct lstcon_ndlink *); +static void lstcon_group_ndlink_release (struct lstcon_group *, +struct lstcon_ndlink *);static void lstcon_group_drain (struct lstcon_group *grp,int keep)
@@ -1183,7 +1184,8 @@ }static int -lstcon_test_nodes_add (struct lstcon_test *test,struct list_head __user *result_up) +lstcon_test_nodes_add (struct lstcon_test *test, +struct list_head __user *result_up) {struct lstcon_rpc_trans *trans;struct lstcon_group *grp;
@@ -1366,7 +1368,8 @@ }static int -lstcon_test_find (struct lstcon_batch *batch,int idx,struct lstcon_test **testpp) +lstcon_test_find (struct lstcon_batch *batch,int idx, +struct lstcon_test **testpp) {struct lstcon_test *test;
drivers/staging/lustre/lnet/selftest/framework.c +10 -5
@@ -131,7 +131,8 @@ }static int -sfw_register_test (struct srpc_service *service,struct sfw_test_client_ops *cliops) +sfw_register_test (struct srpc_service *service, +struct sfw_test_client_ops *cliops) {struct sfw_test_case *tsc;
@@ -469,7 +470,8 @@ }static int -sfw_remove_session (struct srpc_rmsn_reqst *request,struct srpc_rmsn_reply *reply) +sfw_remove_session (struct srpc_rmsn_reqst *request, +struct srpc_rmsn_reply *reply) {struct sfw_session *sn = sfw_data.fw_session;
@@ -501,7 +503,8 @@ }static int -sfw_debug_session (struct srpc_debug_reqst *request,struct srpc_debug_reply *reply) +sfw_debug_session (struct srpc_debug_reqst *request, +struct srpc_debug_reply *reply) {struct sfw_session *sn = sfw_data.fw_session;
@@ -1064,7 +1067,8 @@ }static int -sfw_query_batch (struct sfw_batch *tsb,int testidx,struct srpc_batch_reply *reply) +sfw_query_batch (struct sfw_batch *tsb,int testidx, +struct srpc_batch_reply *reply) {struct sfw_test_instance *tsi;
@@ -1179,7 +1183,8 @@ }static int -sfw_control_batch (struct srpc_batch_reqst *request,struct srpc_batch_reply *reply) +sfw_control_batch (struct srpc_batch_reqst *request, +struct srpc_batch_reply *reply) {struct sfw_session *sn = sfw_data.fw_session;int rc =0 ;
drivers/staging/lustre/lnet/selftest/rpc.c +2 -1
@@ -696,7 +696,8 @@ struct srpc_bulk */* called with sv->sv_lock held */ static void -srpc_service_recycle_buffer (struct srpc_service_cd *scd,struct srpc_buffer *buf) +srpc_service_recycle_buffer (struct srpc_service_cd *scd, +struct srpc_buffer *buf) __must_hold(&scd->scd_lock) {if (!scd->scd_svc->sv_shuttingdown && scd->scd_buf_adjust >=0 ) {
Signature · 1 line
1.7.1