lustre: cleanups with no code changes
PATCH 23/26 libcfs: cleanup white spaces
In reply to James SimmonsThe libcfs code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes.
--- .../lustre/include/linux/libcfs/libcfs_debug.h | 74 ++++++------ .../lustre/include/linux/libcfs/libcfs_fail.h | 8 +- .../lustre/include/linux/libcfs/libcfs_private.h | 56 ++++----- .../lustre/include/linux/libcfs/libcfs_string.h | 10 +- drivers/staging/lustre/lnet/libcfs/debug.c | 22 ++-- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 8 +- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 4 +- .../lustre/lnet/libcfs/linux-crypto-adler.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux-crypto.c | 1 - drivers/staging/lustre/lnet/libcfs/module.c | 128 ++++++++++----------- drivers/staging/lustre/lnet/libcfs/tracefile.c | 5 +- drivers/staging/lustre/lnet/libcfs/tracefile.h | 12 +- 12 files changed, 164 insertions(+), 166 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +37 -37
@@ -67,28 +67,28 @@/* Enable debug-checks on stack size - except on x86_64 */ #if !defined(__x86_64__)# ifdef __ia64__ -# define CDEBUG_STACK () (THREAD_SIZE - \ +# define CDEBUG_STACK () (THREAD_SIZE - \ ((unsigned long)__builtin_dwarf_cfa() & \ (THREAD_SIZE - 1)))# else -# define CDEBUG_STACK () (THREAD_SIZE - \ +# define CDEBUG_STACK () (THREAD_SIZE - \ ((unsigned long)__builtin_frame_address(0) & \ (THREAD_SIZE - 1)))# endif /* __ia64__ */ -#define __CHECK_STACK(msgdata, mask, cdls) \ -do { \ - if (unlikely(CDEBUG_STACK() > libcfs_stack)) { \ +#define __CHECK_STACK(msgdata, mask, cdls) \ +do { \ + if (unlikely(CDEBUG_STACK() > libcfs_stack)) { \ LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL); \ - libcfs_stack = CDEBUG_STACK(); \ - libcfs_debug_msg(msgdata, \ - "maximum lustre stack %lu\n", \ - CDEBUG_STACK()); \ - (msgdata)->msg_mask = mask; \ - (msgdata)->msg_cdls = cdls; \ - dump_stack(); \ + libcfs_stack = CDEBUG_STACK(); \ + libcfs_debug_msg(msgdata, \ + "maximum lustre stack %lu\n", \ + CDEBUG_STACK()); \ + (msgdata)->msg_mask = mask; \ + (msgdata)->msg_cdls = cdls; \ + dump_stack(); \ /*panic("LBUG");*/ \ - } \ + } \ } while (0)#define CFS_CHECK_STACK (msgdata, mask, cdls) __CHECK_STACK(msgdata, mask, cdls)#else /* __x86_64__ */
@@ -104,37 +104,37 @@#define CDEBUG_DEFAULT_MIN_DELAY ((HZ + 1) / 2)/* jiffies */ #define CDEBUG_DEFAULT_BACKOFF 2struct cfs_debug_limit_state { -unsigned long cdls_next; -unsigned int cdls_delay; -int cdls_count; +unsigned long cdls_next; +unsigned int cdls_delay; +int cdls_count; };struct libcfs_debug_msg_data { -const char *msg_file; -const char *msg_fn; -int msg_subsys; -int msg_line; -int msg_mask; -struct cfs_debug_limit_state *msg_cdls; +const char *msg_file; +const char *msg_fn; +int msg_subsys; +int msg_line; +int msg_mask; +struct cfs_debug_limit_state *msg_cdls; }; -#define LIBCFS_DEBUG_MSG_DATA_INIT (data, mask, cdls) \ -do { \ - (data)->msg_subsys = DEBUG_SUBSYSTEM; \ - (data)->msg_file = __FILE__; \ - (data)->msg_fn = __func__; \ - (data)->msg_line = __LINE__; \ - (data)->msg_cdls = (cdls); \ - (data)->msg_mask = (mask); \ +#define LIBCFS_DEBUG_MSG_DATA_INIT (data, mask, cdls) \ +do { \ + (data)->msg_subsys = DEBUG_SUBSYSTEM; \ + (data)->msg_file = __FILE__; \ + (data)->msg_fn = __func__; \ + (data)->msg_line = __LINE__; \ + (data)->msg_cdls = (cdls); \ + (data)->msg_mask = (mask); \ } while (0) -#define LIBCFS_DEBUG_MSG_DATA_DECL (dataname, mask, cdls) \ - static struct libcfs_debug_msg_data dataname = { \ - .msg_subsys = DEBUG_SUBSYSTEM, \ - .msg_file = __FILE__, \ - .msg_fn = __func__, \ - .msg_line = __LINE__, \ - .msg_cdls = (cdls) }; \ +#define LIBCFS_DEBUG_MSG_DATA_DECL (dataname, mask, cdls) \ + static struct libcfs_debug_msg_data dataname = { \ + .msg_subsys = DEBUG_SUBSYSTEM, \ + .msg_file = __FILE__, \ + .msg_fn = __func__, \ + .msg_line = __LINE__, \ + .msg_cdls = (cdls) }; \ dataname.msg_mask = (mask)/**
drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +4 -4
@@ -54,14 +54,14 @@ enum { };/* Failure injection control */ -#define CFS_FAIL_MASK_SYS 0x0000FF00 -#define CFS_FAIL_MASK_LOC (0x000000FF | CFS_FAIL_MASK_SYS) +#define CFS_FAIL_MASK_SYS 0x0000FF00 +#define CFS_FAIL_MASK_LOC (0x000000FF | CFS_FAIL_MASK_SYS) -#define CFS_FAILED_BIT 30 +#define CFS_FAILED_BIT 30/* CFS_FAILED is 0x40000000 */ #define CFS_FAILED BIT(CFS_FAILED_BIT) -#define CFS_FAIL_ONCE_BIT 31 +#define CFS_FAIL_ONCE_BIT 31/* CFS_FAIL_ONCE is 0x80000000 */ #define CFS_FAIL_ONCE BIT(CFS_FAIL_ONCE_BIT)
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +28 -28
94 lines not on this page · raw message
drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +5 -5
@@ -53,8 +53,8 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),* Structure to represent NULL-less strings. */ struct cfs_lstr { -char *ls_str; -int ls_len; +char *ls_str; +int ls_len; };/*
@@ -65,9 +65,9 @@ struct cfs_range_expr {* Link to cfs_expr_list::el_exprs. */ struct list_head re_link; -u32 re_lo; -u32 re_hi; -u32 re_stride; +u32 re_lo; +u32 re_hi; +u32 re_stride; };struct cfs_expr_list {
drivers/staging/lustre/lnet/libcfs/debug.c +11 -11
@@ -85,8 +85,8 @@ static int libcfs_param_debug_mb_set(const char *val,* debug_mb parameter type with corresponding methods to handle this case */ static const struct kernel_param_ops param_ops_debug_mb = { - .set = libcfs_param_debug_mb_set, - .get = param_get_uint, + .set = libcfs_param_debug_mb_set, + .get = param_get_uint, };#define param_check_debug_mb (name, p) \
@@ -143,8 +143,8 @@ static int param_set_console_max_delay(const char *val, }static const struct kernel_param_ops param_ops_console_max_delay = { - .set = param_set_console_max_delay, - .get = param_get_delay, + .set = param_set_console_max_delay, + .get = param_get_delay, };#define param_check_console_max_delay (name, p) \
@@ -161,8 +161,8 @@ static int param_set_console_min_delay(const char *val, }static const struct kernel_param_ops param_ops_console_min_delay = { - .set = param_set_console_min_delay, - .get = param_get_delay, + .set = param_set_console_min_delay, + .get = param_get_delay, };#define param_check_console_min_delay (name, p) \
@@ -195,8 +195,8 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp) }static const struct kernel_param_ops param_ops_uintpos = { - .set = param_set_uintpos, - .get = param_get_uint, + .set = param_set_uintpos, + .get = param_get_uint, };#define param_check_uintpos (name, p) \
@@ -499,9 +499,9 @@ static int panic_notifier(struct notifier_block *self, unsigned long unused1, }static struct notifier_block libcfs_panic_notifier = { - .notifier_call = panic_notifier, - .next =NULL , - .priority =10000 , + .notifier_call = panic_notifier, + .next =NULL , + .priority =10000 , };static void libcfs_register_panic_notifier (void )
drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +4 -4
@@ -76,7 +76,7 @@ struct cfs_cpt_table { };/** Global CPU partition table */ -struct cfs_cpt_table *cfs_cpt_tab__read_mostly ; +struct cfs_cpt_table *cfs_cpt_tab__read_mostly ;EXPORT_SYMBOL (cfs_cpt_tab);/**
@@ -86,7 +86,7 @@ struct cfs_cpt_table {* 1 : disable multiple partitions * >1 : specify number of partitions */ -static int cpu_npartitions; +static int cpu_npartitions;module_param (cpu_npartitions, int,0444 );MODULE_PARM_DESC (cpu_npartitions,"# of CPU partitions" );
@@ -103,7 +103,7 @@ struct cfs_cpt_table {* * NB: If user specified cpu_pattern, cpu_npartitions will be ignored */ -static char *cpu_pattern ="N" ; +static char *cpu_pattern ="N" ;module_param (cpu_pattern, charp,0444 );MODULE_PARM_DESC (cpu_pattern,"CPU partitions pattern" );
@@ -167,7 +167,7 @@ struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt) GFP_KERNEL);if (!part->cpt_distance) {kfree (part->cpt_nodemask); - failed_setting_one_part: +failed_setting_one_part:free_cpumask_var (part->cpt_cpumask); goto failed_setting_ctb_parts; }
drivers/staging/lustre/lnet/libcfs/libcfs_string.c +2 -2
@@ -314,11 +314,11 @@ char *cfs_firststr(char *str, size_t size) } } - out: +out: *expr = re;return 0 ; - failed: +failed:kfree (re);return -EINVAL ; }
drivers/staging/lustre/lnet/libcfs/linux-crypto-adler.c +1 -1
@@ -104,7 +104,7 @@ static int adler32_digest(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return __adler32_finup(crypto_shash_ctx(desc->tfm), data, len, -out ); +out ); } static struct shash_alg alg = {
drivers/staging/lustre/lnet/libcfs/linux-crypto.c +0 -1
@@ -205,7 +205,6 @@ struct ahash_request *const struct cfs_crypto_hash_type *type; err =cfs_crypto_hash_alloc (hash_alg, &type, &req, key, key_len); -if (err)return ERR_PTR (err);return req;
drivers/staging/lustre/lnet/libcfs/module.c +64 -64
177 lines not on this page · raw message
drivers/staging/lustre/lnet/libcfs/tracefile.c +2 -3
@@ -331,7 +331,6 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd,* XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT) * from here: this will lead to infinite recursion. */ -if (len >PAGE_SIZE ) {pr_err ("cowardly refusing to write %lu bytes in a page\n" , len);return NULL ;
@@ -489,7 +488,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, } string_buf = (char *)page_address (tage->page) + - tage->used + known_size; + tage->used + known_size; max_nob =PAGE_SIZE - tage->used - known_size;if (max_nob <=0 ) {
@@ -746,7 +745,7 @@ static void put_pages_back(struct page_collection *pc)put_pages_back_on_all_cpus (pc); } -/* Add pages to a per-cpu debug daemon ringbuffer. This buffer makes sure that +/* Add pages to a per-cpu debug daemon ringbuffer. This buffer makes sure that * we have a good amount of data@all times for dumping during an LBUG, even * if we have been steadily writing (and otherwise discarding) pages via the * debug daemon.
drivers/staging/lustre/lnet/libcfs/tracefile.h +6 -6
@@ -165,12 +165,12 @@ void cfs_trace_assertion_failed(const char *str, } \ } while (0) -#define __LASSERT_TAGE_INVARIANT (tage) \ -do { \ - __LASSERT(tage); \ - __LASSERT(tage->page); \ - __LASSERT(tage->used <= PAGE_SIZE); \ - __LASSERT(page_count(tage->page) > 0); \ +#define __LASSERT_TAGE_INVARIANT (tage) \ +do { \ + __LASSERT(tage); \ + __LASSERT(tage->page); \ + __LASSERT(tage->used <= PAGE_SIZE); \ + __LASSERT(page_count(tage->page) > 0); \ } while (0)#endif /* __LIBCFS_TRACEFILE_H__ */
Signature · 1 line
1.8.3.1
PATCH 24/26 lnet: cleanup white spaces
In reply to James SimmonsThe LNet core code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes.
--- drivers/staging/lustre/include/linux/lnet/api.h | 32 ++-- .../staging/lustre/include/linux/lnet/lib-lnet.h | 3 +- .../staging/lustre/include/linux/lnet/lib-types.h | 192 ++++++++++----------- drivers/staging/lustre/lnet/lnet/acceptor.c | 16 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 89 +++++----- drivers/staging/lustre/lnet/lnet/config.c | 38 ++-- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 84 +++++---- drivers/staging/lustre/lnet/lnet/lib-msg.c | 72 ++++---- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 22 +-- drivers/staging/lustre/lnet/lnet/lib-socket.c | 11 +- drivers/staging/lustre/lnet/lnet/module.c | 3 +- drivers/staging/lustre/lnet/lnet/net_fault.c | 1 - drivers/staging/lustre/lnet/lnet/nidstrings.c | 40 ++--- drivers/staging/lustre/lnet/lnet/peer.c | 37 ++-- drivers/staging/lustre/lnet/lnet/router.c | 26 +-- drivers/staging/lustre/lnet/lnet/router_proc.c | 61 ++++--- 17 files changed, 361 insertions(+), 368 deletions(-)
drivers/staging/lustre/include/linux/lnet/api.h +16 -16
@@ -94,18 +94,18 @@* and LNetMEInsert(), and removed from its list by LNetMEUnlink(). * @{ */ -int LNetMEAttach (unsigned int portal, +int LNetMEAttach (unsigned int portal,struct lnet_process_id match_id_in, -u64 match_bits_in, -u64 ignore_bits_in, +u64 match_bits_in, +u64 ignore_bits_in,enum lnet_unlink unlink_in,enum lnet_ins_pos pos_in,struct lnet_handle_me *handle_out);int LNetMEInsert (struct lnet_handle_me current_in,struct lnet_process_id match_id_in, -u64 match_bits_in, -u64 ignore_bits_in, +u64 match_bits_in, +u64 ignore_bits_in,enum lnet_unlink unlink_in,enum lnet_ins_pos position_in,struct lnet_handle_me *handle_out);
@@ -161,18 +161,18 @@ int LNetMDBind(struct lnet_md md_in,* on multiple EQs. * @{ */ -int LNetEQAlloc (unsigned int count_in, +int LNetEQAlloc (unsigned int count_in,lnet_eq_handler_t handler,struct lnet_handle_eq *handle_out);int LNetEQFree (struct lnet_handle_eq eventq_in);int LNetEQPoll (struct lnet_handle_eq *eventqs_in, -int neq_in, -signed long timeout, -int interruptible, +int neq_in, +signed long timeout, +int interruptible,struct lnet_event *event_out, -int *which_eq_out); +int *which_eq_out);/** @} lnet_eq */ /** \defgroup lnet_data Data movement operations
@@ -181,21 +181,21 @@ int LNetEQPoll(struct lnet_handle_eq *eventqs_in,* and LNetGet(). * @{ */ -int LNetPut (lnet_nid_t self, +int LNetPut (lnet_nid_t self,struct lnet_handle_md md_in,enum lnet_ack_req ack_req_in,struct lnet_process_id target_in, -unsigned int portal_in, +unsigned int portal_in,u64 match_bits_in, -unsigned int offset_in, +unsigned int offset_in,u64 hdr_data_in); -int LNetGet (lnet_nid_t self, +int LNetGet (lnet_nid_t self,struct lnet_handle_md md_in,struct lnet_process_id target_in, -unsigned int portal_in, +unsigned int portal_in,u64 match_bits_in, -unsigned int offset_in); +unsigned int offset_in);/** @} lnet_data */ /** \defgroup lnet_misc Miscellaneous operations.
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1 -2
@@ -205,7 +205,6 @@ static inline int lnet_md_unlinkable(struct lnet_libmd *md) } md =kzalloc (size,GFP_NOFS ); -if (md) {/* Set here in case of early free */ md->md_options = umd->options;
@@ -467,7 +466,7 @@ int lnet_get_peer_list(u32 *countp, u32 *sizep,void lnet_router_debugfs_init (void );void lnet_router_debugfs_fini (void ); -int lnet_rtrpools_alloc (int im_a_router); +int lnet_rtrpools_alloc (int im_a_router);void lnet_destroy_rtrbuf (struct lnet_rtrbuf *rb,int npages);int lnet_rtrpools_adjust (int tiny,int small,int large);int lnet_rtrpools_enable (void );
drivers/staging/lustre/include/linux/lnet/lib-types.h +96 -96
371 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/acceptor.c +8 -8
@@ -36,9 +36,9 @@#include <net/sock.h> #include <linux/lnet/lib-lnet.h> -static int accept_port =988 ; -static int accept_backlog =127 ; -static int accept_timeout =5 ; +static int accept_port =988 ; +static int accept_backlog =127 ; +static int accept_timeout =5 ; static struct { int pta_shutdown;
@@ -167,9 +167,9 @@BUILD_BUG_ON (LNET_PROTO_ACCEPTOR_VERSION !=1 ); - cr.acr_magic =LNET_PROTO_ACCEPTOR_MAGIC ; + cr.acr_magic =LNET_PROTO_ACCEPTOR_MAGIC ; cr.acr_version =LNET_PROTO_ACCEPTOR_VERSION ; - cr.acr_nid = peer_nid; + cr.acr_nid = peer_nid;if (the_lnet.ln_testprotocompat) {/* single-shot proto check */
@@ -196,9 +196,9 @@ rc = -EADDRINUSE ; goto failed; - failed_sock: +failed_sock:sock_release (sock); - failed: +failed:lnet_connect_console_error (rc, peer_nid, peer_ip, peer_port);return rc; }
@@ -297,7 +297,7 @@__swab64s (&cr.acr_nid); ni =lnet_nid2ni_addref (cr.acr_nid); -if (!ni ||/* no matching net */ +if (!ni ||/* no matching net */ ni->ni_nid != cr.acr_nid) {/* right NET, wrong NID! */ if (ni)lnet_ni_decref (ni);
drivers/staging/lustre/lnet/lnet/api-ni.c +44 -45
237 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/config.c +18 -20
@@ -38,15 +38,15 @@#include <linux/lnet/lib-lnet.h> #include <linux/inetdevice.h> -struct lnet_text_buf {/* tmp struct for parsing routes */ -struct list_head ltb_list;/* stash on lists */ -int ltb_size;/* allocated size */ -char ltb_text[0 ];/* text buffer */ +struct lnet_text_buf {/* tmp struct for parsing routes */ +struct list_head ltb_list;/* stash on lists */ +int ltb_size;/* allocated size */ +char ltb_text[0 ];/* text buffer */ }; -static int lnet_tbnob;/* track text buf allocation */ -#define LNET_MAX_TEXTBUF_NOB (64 << 10)/* bound allocation */ -#define LNET_SINGLE_TEXTBUF_NOB (4 << 10) +static int lnet_tbnob;/* track text buf allocation */ +#define LNET_MAX_TEXTBUF_NOB (64 << 10)/* bound allocation */ +#define LNET_SINGLE_TEXTBUF_NOB (4 << 10)#define SPACESTR " \t\v\r\n"#define DELIMITERS ":()[]"
@@ -126,6 +126,7 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ lnet_ni_unique_ni(char *iface_list[LNET_INTERFACES_NUM], char *iface) {int i; +for (i =0 ; i <LNET_INTERFACES_NUM ; i++) {if (iface_list[i] &&strncmp (iface_list[i], iface,strlen (iface)) ==0 )
@@ -554,7 +555,7 @@ struct lnet_ni * goto failed;return ni; - failed: +failed:lnet_ni_free (ni);return NULL ; }
@@ -743,9 +744,9 @@ struct lnet_ni * goto failed_syntax; } rc =cfs_expr_list_parse (elstr, - nistr - elstr +1 , -0 ,LNET_CPT_NUMBER -1 , - &ni_el); + nistr - elstr +1 , +0 ,LNET_CPT_NUMBER -1 , + &ni_el);if (rc !=0 ) { str = elstr; goto failed_syntax;
@@ -812,9 +813,9 @@ struct lnet_ni *kfree (tokens);return nnets; - failed_syntax: +failed_syntax:lnet_syntax ("networks" , networks, (int )(str - tokens),strlen (str)); - failed: +failed:/* free the net list and all the nis on each net */ while (!list_empty (netlist)) { net = list_entry(netlist->next, struct lnet_net, net_list);
@@ -1038,7 +1039,7 @@ struct lnet_ni *list_splice (&pending, tbs->prev);return 1 ; - failed: +failed:lnet_free_text_bufs (&pending);return -EINVAL ; }
@@ -1093,7 +1094,6 @@ struct lnet_ni * {/* static scratch buffer OK (single threaded) */ static char cmd[LNET_SINGLE_TEXTBUF_NOB ]; -struct list_head nets;struct list_head gateways;struct list_head *tmp1;
@@ -1226,9 +1226,9 @@ struct lnet_ni * myrc =0 ; goto out; - token_error: +token_error:lnet_syntax ("routes" , cmd, (int )(token - str),strlen (token)); - out: +out:lnet_free_text_bufs (&nets);lnet_free_text_bufs (&gateways);return myrc;
@@ -1298,7 +1298,6 @@ struct lnet_ni * lnet_match_network_tokens(char *net_entry, u32 *ipaddrs, int nip) {static char tokens[LNET_SINGLE_TEXTBUF_NOB ]; -int matched =0 ;int ntokens =0 ;int len;
@@ -1451,7 +1450,6 @@ struct lnet_ni * {static char networks[LNET_SINGLE_TEXTBUF_NOB ];static char source[LNET_SINGLE_TEXTBUF_NOB ]; -struct list_head raw_entries;struct list_head matched_nets;struct list_head current_nets;
@@ -1549,7 +1547,7 @@ struct lnet_ni * count++; } - out: +out:lnet_free_text_bufs (&raw_entries);lnet_free_text_bufs (&matched_nets);lnet_free_text_bufs (¤t_nets);
drivers/staging/lustre/lnet/lnet/lib-eq.c +1 -1
@@ -198,7 +198,7 @@lnet_res_lh_invalidate (&eq->eq_lh);list_del (&eq->eq_list);kfree (eq); - out: +out:lnet_eq_wait_unlock ();lnet_res_unlock (LNET_LOCK_EX );
drivers/staging/lustre/lnet/lnet/lib-move.c +41 -43
203 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-msg.c +36 -36
155 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-ptl.c +11 -11
@@ -74,7 +74,7 @@return 1 ; - match: +match:if ((lnet_ptl_is_unique (ptl) && !unique) || (lnet_ptl_is_wildcard (ptl) && unique))return 0 ;
@@ -387,7 +387,7 @@ struct list_head * head = &mtable->mt_mhash[LNET_MT_HASH_IGNORE ]; else head =lnet_mt_match_head (mtable, info->mi_id, info->mi_mbits); - again: +again:/* NB: only wildcard portal needs to return LNET_MATCHMD_EXHAUSTED */ if (lnet_ptl_is_wildcard (the_lnet.ln_portals[mtable->mt_portal])) exhausted =LNET_MATCHMD_EXHAUSTED ;
@@ -634,9 +634,9 @@ struct list_head * info->mi_mbits, info->mi_roffset, info->mi_rlength); } goto out0; - out1: +out1:lnet_res_unlock (mtable->mt_cpt); - out0: +out0:/* EXHAUSTED bit is only meaningful for internal functions */ return rc & ~LNET_MATCHMD_EXHAUSTED ; }
@@ -678,7 +678,7 @@ struct list_head *lnet_ptl_lock (ptl); head = &ptl->ptl_msg_stealing; - again: +again:list_for_each_entry_safe (msg, tmp, head, msg_list) {struct lnet_match_info info;struct lnet_hdr *hdr;
@@ -688,13 +688,13 @@ struct list_head * hdr = &msg->msg_hdr;/* Multi-Rail: Primary peer NID */ - info.mi_id.nid = msg->msg_initiator; - info.mi_id.pid = hdr->src_pid; - info.mi_opc =LNET_MD_OP_PUT ; - info.mi_portal = hdr->msg.put.ptl_index; + info.mi_id.nid = msg->msg_initiator; + info.mi_id.pid = hdr->src_pid; + info.mi_opc =LNET_MD_OP_PUT ; + info.mi_portal = hdr->msg.put.ptl_index; info.mi_rlength = hdr->payload_length; info.mi_roffset = hdr->msg.put.offset; - info.mi_mbits = hdr->msg.put.match_bits; + info.mi_mbits = hdr->msg.put.match_bits; rc =lnet_try_match_md (md, &info, msg);
@@ -824,7 +824,7 @@ struct list_head * }return 0 ; - failed: +failed:lnet_ptl_cleanup (ptl);return -ENOMEM ; }
drivers/staging/lustre/lnet/lnet/lib-socket.c +7 -4
@@ -50,8 +50,11 @@long jiffies_left = timeout *msecs_to_jiffies (MSEC_PER_SEC );unsigned long then;struct timeval tv; -struct kvec iov = { .iov_base = buffer, .iov_len = nob }; -struct msghdr msg = {NULL ,}; +struct kvec iov = { + .iov_base = buffer, + .iov_len = nob + }; +struct msghdr msg = {NULL , };LASSERT (nob >0 );/*
@@ -102,9 +105,9 @@long jiffies_left = timeout *msecs_to_jiffies (MSEC_PER_SEC );unsigned long then;struct timeval tv; -struct kvec iov = { +struct kvec iov = { .iov_base = buffer, - .iov_len = nob + .iov_len = nob };struct msghdr msg = { .msg_flags =0
drivers/staging/lustre/lnet/lnet/module.c +1 -2
@@ -52,7 +52,6 @@if (!the_lnet.ln_niinit_self) { rc =try_module_get (THIS_MODULE ); -if (rc !=1 ) goto out;
@@ -229,7 +228,7 @@ }static struct notifier_block lnet_ioctl_handler = { - .notifier_call = lnet_ioctl, + .notifier_call = lnet_ioctl, };static int __init lnet_init (void )
drivers/staging/lustre/lnet/lnet/net_fault.c +0 -1
@@ -614,7 +614,6 @@ struct delay_daemon_data { rc =lnet_parse_local (ni, msg);if (!rc)continue ; - }else {lnet_net_lock (cpt); rc =lnet_parse_forward_locked (ni, msg);
drivers/staging/lustre/lnet/lnet/nidstrings.c +20 -20
@@ -60,8 +60,8 @@* between getting its string and using it. */ -static char libcfs_nidstrings[LNET_NIDSTR_COUNT ][LNET_NIDSTR_SIZE ]; -static int libcfs_nidstring_idx; +static char libcfs_nidstrings[LNET_NIDSTR_COUNT ][LNET_NIDSTR_SIZE ]; +static int libcfs_nidstring_idx;static DEFINE_SPINLOCK (libcfs_nidstring_lock);
@@ -117,23 +117,23 @@ struct nidrange {* Link to list of this structures which is built on nid range * list parsing. */ -struct list_head nr_link; +struct list_head nr_link;/** * List head for addrrange::ar_link. */ -struct list_head nr_addrranges; +struct list_head nr_addrranges;/** * Flag indicating that *@<net> is found. */ -int nr_all; +int nr_all;/** * Pointer to corresponding element of libcfs_netstrfns. */ -struct netstrfns *nr_netstrfns; +struct netstrfns *nr_netstrfns;/** * Number of network. E.g. 5 if \<net\> is "elan5". */ -int nr_netnum; +int nr_netnum; };/**
@@ -143,11 +143,11 @@ struct addrrange {/** * Link to nidrange::nr_addrranges. */ -struct list_head ar_link; +struct list_head ar_link;/** * List head for cfs_expr_list::el_list. */ -struct list_head ar_numaddr_ranges; +struct list_head ar_numaddr_ranges; };/**
@@ -471,8 +471,8 @@ static void cfs_ip_ar_min_max(struct addrrange *ar, u32 *min_nid,struct cfs_expr_list *el;struct cfs_range_expr *re;u32 tmp_ip_addr =0 ; -unsigned int min_ip[4 ] = {0 }; -unsigned int max_ip[4 ] = {0 }; +unsigned int min_ip[4 ] = {0 }; +unsigned int max_ip[4 ] = {0 };int re_count =0 ;list_for_each_entry (el, &ar->ar_numaddr_ranges, el_link) {
@@ -794,11 +794,11 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid,static int libcfs_ip_str2addr (const char *str,int nob,u32 *addr) { -unsigned int a; -unsigned int b; -unsigned int c; -unsigned int d; -int n = nob;/* XscanfX */ +unsigned int a; +unsigned int b; +unsigned int c; +unsigned int d; +int n = nob;/* XscanfX */ /* numeric IP? */ if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&
@@ -897,7 +897,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid,static int libcfs_num_str2addr (const char *str,int nob,u32 *addr) { -int n; +int n; n = nob;if (sscanf (str,"0x%x%n" , addr, &n) >=1 && n == nob)
@@ -926,7 +926,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid, libcfs_num_parse(char *str, int len, struct list_head *list) {struct cfs_expr_list *el; -int rc; +int rc; rc =cfs_expr_list_parse (str, len,0 ,MAX_NUMERIC_VALUE , &el);if (!rc)
@@ -1049,7 +1049,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid,static struct netstrfns *libcfs_name2netstrfns (const char *name) { -int i; +int i;for (i =0 ; i < libcfs_nnetstrfns; i++)if (!strcmp (libcfs_netstrfns[i].nf_name, name))
@@ -1194,7 +1194,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid,u32 libcfs_str2net (const char *str) { -u32 net; +u32 net;if (libcfs_str2net_internal (str, &net))return net;
drivers/staging/lustre/lnet/lnet/peer.c +18 -19
@@ -586,8 +586,8 @@ void lnet_peer_uninit(void)static struct lnet_peer_ni *lnet_get_peer_ni_locked (struct lnet_peer_table *ptable,lnet_nid_t nid) { -struct list_head *peers; -struct lnet_peer_ni *lp; +struct list_head *peers; +struct lnet_peer_ni *lp;LASSERT (the_lnet.ln_state ==LNET_STATE_RUNNING );
@@ -1069,6 +1069,7 @@ struct lnet_peer_net * lnet_peer_get_net_locked(struct lnet_peer *peer, u32 net_id) {struct lnet_peer_net *peer_net; +list_for_each_entry (peer_net, &peer->lp_peer_nets, lpn_peer_nets) {if (peer_net->lpn_net_id == net_id)return peer_net;
@@ -1088,9 +1089,9 @@ struct lnet_peer_net **/ static int lnet_peer_attach_peer_ni (struct lnet_peer *lp, -struct lnet_peer_net *lpn, -struct lnet_peer_ni *lpni, -unsigned int flags) +struct lnet_peer_net *lpn, +struct lnet_peer_ni *lpni, +unsigned int flags) {struct lnet_peer_table *ptable;
@@ -2686,12 +2687,12 @@ static int lnet_peer_send_ping(struct lnet_peer *lp) }/* initialize md content */ - md.start = &pbuf->pb_info; - md.length =LNET_PING_INFO_SIZE (nnis); + md.start = &pbuf->pb_info; + md.length =LNET_PING_INFO_SIZE (nnis); md.threshold =2 ;/* GET/REPLY */ - md.max_size =0 ; - md.options =LNET_MD_TRUNCATE ; - md.user_ptr = lp; + md.max_size =0 ; + md.options =LNET_MD_TRUNCATE ; + md.user_ptr = lp; md.eq_handle = the_lnet.ln_dc_eqh; rc =LNetMDBind (md,LNET_UNLINK , &lp->lp_ping_mdh);
@@ -2715,7 +2716,6 @@ static int lnet_peer_send_ping(struct lnet_peer *lp) rc =LNetGet (LNET_NID_ANY , lp->lp_ping_mdh, id,LNET_RESERVED_PORTAL ,LNET_PROTO_PING_MATCHBITS ,0 ); -if (rc) goto fail_unlink_md;
@@ -2792,13 +2792,13 @@ static int lnet_peer_send_push(struct lnet_peer *lp)lnet_net_unlock (cpt);/* Push source MD */ - md.start = &pbuf->pb_info; - md.length =LNET_PING_INFO_SIZE (pbuf->pb_nnis); + md.start = &pbuf->pb_info; + md.length =LNET_PING_INFO_SIZE (pbuf->pb_nnis); md.threshold =2 ;/* Put/Ack */ - md.max_size =0 ; - md.options =0 ; + md.max_size =0 ; + md.options =0 ; md.eq_handle = the_lnet.ln_dc_eqh; - md.user_ptr = lp; + md.user_ptr = lp; rc =LNetMDBind (md,LNET_UNLINK , &lp->lp_push_mdh);if (rc) {
@@ -2821,7 +2821,6 @@ static int lnet_peer_send_push(struct lnet_peer *lp) rc =LNetPut (LNET_NID_ANY , lp->lp_push_mdh,LNET_ACK_REQ , id,LNET_RESERVED_PORTAL ,LNET_PROTO_PING_MATCHBITS ,0 ,0 ); -if (rc) goto fail_unlink;
@@ -3315,8 +3314,8 @@ int lnet_get_peer_info(struct lnet_ioctl_peer_cfg *cfg, void __user *bulk) goto out; } - size =sizeof (nid) +sizeof (*lpni_info) +sizeof (*lpni_stats) - +sizeof (*lpni_msg_stats); + size =sizeof (nid) +sizeof (*lpni_info) +sizeof (*lpni_stats) + +sizeof (*lpni_msg_stats); size *= lp->lp_nnis;if (size > cfg->prcfg_size) { cfg->prcfg_size = size;
drivers/staging/lustre/lnet/lnet/router.c +13 -13
@@ -172,7 +172,7 @@ notifylnd = lp->lpni_notifylnd; lp->lpni_notifylnd =0 ; - lp->lpni_notify =0 ; + lp->lpni_notify =0 ;if (notifylnd && ni->ni_net->net_lnd->lnd_notify) {spin_unlock (&lp->lpni_lock);
@@ -274,6 +274,7 @@ static void lnet_shuffle_seed(void)* the NID for this node gives the most entropy in the low bits */ while ((ni =lnet_get_next_ni_locked (NULL , ni))) {u32 lnd_type, seed; + lnd_type =LNET_NETTYP (LNET_NIDNET (ni->ni_nid));if (lnd_type !=LOLND ) { seed = (LNET_NIDADDR (ni->ni_nid) | lnd_type);
@@ -386,7 +387,6 @@ static void lnet_shuffle_seed(void)/* Search for a duplicate route (it's a NOOP if it is) */ add_route =1 ;list_for_each_entry (route2, &rnet2->lrn_routes, lr_list) { -if (route2->lr_gateway == route->lr_gateway) { add_route =0 ;break ;
@@ -501,7 +501,7 @@ static void lnet_shuffle_seed(void)else rn_list =lnet_net2rnethash (net); - again: +again:list_for_each_entry (rnet, rn_list, lrn_list) {if (!(net ==LNET_NIDNET (LNET_NID_ANY ) || net == rnet->lrn_net))
@@ -601,10 +601,10 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)list_for_each_entry (rnet, rn_list, lrn_list) {list_for_each_entry (route, &rnet->lrn_routes, lr_list) {if (!idx--) { - *net = rnet->lrn_net; - *hops = route->lr_hops; + *net = rnet->lrn_net; + *hops = route->lr_hops; *priority = route->lr_priority; - *gateway = route->lr_gateway->lpni_nid; + *gateway = route->lr_gateway->lpni_nid; *alive =lnet_is_route_alive (route);lnet_net_unlock (cpt);return 0 ;
@@ -648,7 +648,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)struct lnet_ping_buffer *pbuf = rcd->rcd_pingbuffer;struct lnet_peer_ni *gw = rcd->rcd_gateway;struct lnet_route *rte; -int nnis; +int nnis;if (!gw->lpni_alive || !pbuf)return ;
@@ -799,7 +799,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)if (avoid_asym_router_failure && !event->status)lnet_parse_rc_info (rcd); - out: +out:lnet_net_unlock (lp->lpni_cpt); }
@@ -1069,14 +1069,14 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) id.pid =LNET_PID_LUSTRE ;CDEBUG (D_NET ,"Check: %s\n" ,libcfs_id2str (id)); - rtr->lpni_ping_notsent =1 ; + rtr->lpni_ping_notsent =1 ; rtr->lpni_ping_timestamp = now; mdh = rcd->rcd_mdh;if (!rtr->lpni_ping_deadline) { rtr->lpni_ping_deadline =ktime_get_seconds () + - router_ping_timeout; + router_ping_timeout; }lnet_net_unlock (rtr->lpni_cpt);
@@ -1652,7 +1652,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)return 0 ; - failed: +failed:lnet_rtrpools_free (0 );return rc; }
@@ -1797,8 +1797,8 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)return -EINVAL ; } -if (ni && !alive &&/* LND telling me she's down */ - !auto_down) {/* auto-down disabled */ +if (ni && !alive &&/* LND telling me she's down */ + !auto_down) {/* auto-down disabled */ CDEBUG (D_NET ,"Auto-down disabled\n" );return 0 ; }
drivers/staging/lustre/lnet/lnet/router_proc.c +30 -31
115 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 24/26 lnet: cleanup white spaces
Quoted 8 lines · James Simmons
The LNet core code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes.
Signed-off-by James Simmons <[email protected]>---
drivers/staging/lustre/include/linux/lnet/lib-types.h struct lnet_lnd { · line 224
Quoted 8 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +1
-1@@ -218,7 +218,7 @@ struct lnet_lnd {*/ /* -* Start sending a preformatted message. 'private' is NULL for PUT and +* Start sending a preformatted message.x 'private' is NULL for PUT and * GET messages; otherwise this is a response to an incoming message * and 'private' is the 'private' passed to lnet_parse(). Return * non-zero for immediate failure, otherwise complete later with
I suspect you just added that 'x' to see if anyone really read you patch I did. I found it. I've removed it.
:-)
NeilBrown
Quoted 1,760 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +75
-75@@ -267,7 +267,7 @@ struct lnet_tx_queue {enum lnet_ni_state {/* set when NI block is allocated */ -LNET_NI_STATE_INIT =0 , +LNET_NI_STATE_INIT =0 ,/* set when NI is started successfully */ LNET_NI_STATE_ACTIVE ,/* set when LND notifies NI failed */ @@ -279,23 +279,23 @@ enum lnet_ni_state { };enum lnet_stats_type { -LNET_STATS_TYPE_SEND =0 , +LNET_STATS_TYPE_SEND =0 ,LNET_STATS_TYPE_RECV ,LNET_STATS_TYPE_DROP };struct lnet_comm_count { -atomic_t co_get_count; -atomic_t co_put_count; -atomic_t co_reply_count; -atomic_t co_ack_count; -atomic_t co_hello_count; +atomic_t co_get_count; +atomic_t co_put_count; +atomic_t co_reply_count; +atomic_t co_ack_count; +atomic_t co_hello_count; };struct lnet_element_stats { -struct lnet_comm_count el_send_stats; -struct lnet_comm_count el_recv_stats; -struct lnet_comm_count el_drop_stats; +struct lnet_comm_count el_send_stats; +struct lnet_comm_count el_recv_stats; +struct lnet_comm_count el_drop_stats; };struct lnet_net {@@ -376,7 +376,7 @@ struct lnet_ni {struct lnet_lnd_tunables ni_lnd_tunables;/* lnd tunables set explicitly */ -bool ni_lnd_tunables_set; +bool ni_lnd_tunables_set;/* NI statistics */ struct lnet_element_stats ni_stats;@@ -391,9 +391,9 @@ struct lnet_ni {* equivalent interfaces to use * This is an array because socklnd bonding can still be configured */ -char *ni_interfaces[LNET_INTERFACES_NUM ]; +char *ni_interfaces[LNET_INTERFACES_NUM ];/* original net namespace */ -struct net *ni_net_ns; +struct net *ni_net_ns; };#define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL@@ -434,9 +434,9 @@ struct lnet_rc_data {struct lnet_peer_ni {/* chain on lpn_peer_nis */ -struct list_head lpni_peer_nis; +struct list_head lpni_peer_nis;/* chain on remote peer list */ -struct list_head lpni_on_remote_peer_ni_list; +struct list_head lpni_on_remote_peer_ni_list;/* chain on peer hash */ struct list_head lpni_hashlist;/* messages blocking for tx credits */ @@ -448,7 +448,7 @@ struct lnet_peer_ni {/* statistics kept on each peer NI */ struct lnet_element_stats lpni_stats;/* spin lock protecting credits and lpni_txq / lpni_rtrq */ -spinlock_t lpni_lock; +spinlock_t lpni_lock;/* # tx credits available */ int lpni_txcredits;struct lnet_peer_net *lpni_peer_net;@@ -491,26 +491,26 @@ struct lnet_peer_ni {/* CPT this peer attached on */ int lpni_cpt;/* state flags -- protected by lpni_lock */ -unsigned int lpni_state; +unsigned int lpni_state;/* # refs from lnet_route::lr_gateway */ int lpni_rtr_refcount;/* sequence number used to round robin over peer nis within a net */ -u32 lpni_seq; +u32 lpni_seq;/* sequence number used to round robin over gateways */ -u32 lpni_gw_seq; +u32 lpni_gw_seq;/* health flag */ -bool lpni_healthy; +bool lpni_healthy;/* returned RC ping features. Protected with lpni_lock */ unsigned int lpni_ping_feats;/* routers on this peer */ struct list_head lpni_routes;/* preferred local nids: if only one, use lpni_pref.nid */ union lpni_pref { -lnet_nid_t nid; +lnet_nid_t nid;lnet_nid_t *nids; } lpni_pref;/* number of preferred NIDs in lnpi_pref_nids */ -u32 lpni_pref_nnids; +u32 lpni_pref_nnids;/* router checker state */ struct lnet_rc_data *lpni_rcd; };@@ -676,9 +676,9 @@ struct lnet_peer_table {/* # peers extant */ atomic_t pt_number;/* peers */ -struct list_head pt_peer_list; +struct list_head pt_peer_list;/* # peers */ -int pt_peers; +int pt_peers;/* # zombies to go to deathrow (and not there yet) */ int pt_zombies;/* zombie peers_ni */ @@ -704,7 +704,7 @@ struct lnet_route {/* chain on gateway */ struct list_head lr_gwlist;/* router node */ -struct lnet_peer_ni *lr_gateway; +struct lnet_peer_ni *lr_gateway;/* remote network number */ u32 lr_net;/* sequence for round-robin */ @@ -754,9 +754,9 @@ struct lnet_rtrbufpool { };struct lnet_rtrbuf { -struct list_head rb_list;/* chain on rbp_bufs */ -struct lnet_rtrbufpool *rb_pool;/* owning pool */ -struct bio_vec rb_kiov[0 ];/* the buffer space */ +struct list_head rb_list;/* chain on rbp_bufs */ +struct lnet_rtrbufpool *rb_pool;/* owning pool */ +struct bio_vec rb_kiov[0 ];/* the buffer space */ };#define LNET_PEER_HASHSIZE 503/* prime! */ @@ -904,58 +904,58 @@ enum lnet_state {struct lnet {/* CPU partition table of LNet */ -struct cfs_cpt_table *ln_cpt_table; +struct cfs_cpt_table *ln_cpt_table;/* number of CPTs in ln_cpt_table */ -unsigned int ln_cpt_number; -unsigned int ln_cpt_bits; +unsigned int ln_cpt_number; +unsigned int ln_cpt_bits;/* protect LNet resources (ME/MD/EQ) */ -struct cfs_percpt_lock *ln_res_lock; +struct cfs_percpt_lock *ln_res_lock;/* # portals */ -int ln_nportals; +int ln_nportals;/* the vector of portals */ -struct lnet_portal **ln_portals; +struct lnet_portal **ln_portals;/* percpt ME containers */ -struct lnet_res_container **ln_me_containers; +struct lnet_res_container **ln_me_containers;/* percpt MD container */ -struct lnet_res_container **ln_md_containers; +struct lnet_res_container **ln_md_containers;/* Event Queue container */ -struct lnet_res_container ln_eq_container; -wait_queue_head_t ln_eq_waitq; -spinlock_t ln_eq_wait_lock; -unsigned int ln_remote_nets_hbits; +struct lnet_res_container ln_eq_container; +wait_queue_head_t ln_eq_waitq; +spinlock_t ln_eq_wait_lock; +unsigned int ln_remote_nets_hbits;/* protect NI, peer table, credits, routers, rtrbuf... */ -struct cfs_percpt_lock *ln_net_lock; +struct cfs_percpt_lock *ln_net_lock;/* percpt message containers for active/finalizing/freed message */ -struct lnet_msg_container **ln_msg_containers; -struct lnet_counters **ln_counters; -struct lnet_peer_table **ln_peer_tables; +struct lnet_msg_container **ln_msg_containers; +struct lnet_counters **ln_counters; +struct lnet_peer_table **ln_peer_tables;/* list of peer nis not on a local network */ struct list_head ln_remote_peer_ni_list;/* failure simulation */ -struct list_head ln_test_peers; -struct list_head ln_drop_rules; -struct list_head ln_delay_rules; +struct list_head ln_test_peers; +struct list_head ln_drop_rules; +struct list_head ln_delay_rules;/* LND instances */ struct list_head ln_nets;/* network zombie list */ struct list_head ln_net_zombie;/* the loopback NI */ -struct lnet_ni *ln_loni; +struct lnet_ni *ln_loni;/* remote networks with routes to them */ -struct list_head *ln_remote_nets_hash; +struct list_head *ln_remote_nets_hash;/* validity stamp */ -u64 ln_remote_nets_version; +u64 ln_remote_nets_version;/* list of all known routers */ -struct list_head ln_routers; +struct list_head ln_routers;/* validity stamp */ -u64 ln_routers_version; +u64 ln_routers_version;/* percpt router buffer pools */ -struct lnet_rtrbufpool **ln_rtrpools; +struct lnet_rtrbufpool **ln_rtrpools;/* * Ping target / Push source @@ -964,9 +964,9 @@ struct lnet {* ln_ping_target is protected against concurrent updates by * ln_api_mutex. */ -struct lnet_handle_md ln_ping_target_md; -struct lnet_handle_eq ln_ping_target_eq; -struct lnet_ping_buffer *ln_ping_target; +struct lnet_handle_md ln_ping_target_md; +struct lnet_handle_eq ln_ping_target_eq; +struct lnet_ping_buffer *ln_ping_target;atomic_t ln_ping_target_seqno;/* @@ -979,7 +979,7 @@ struct lnet {*/ struct lnet_handle_eq ln_push_target_eq;struct lnet_handle_md ln_push_target_md; -struct lnet_ping_buffer *ln_push_target; +struct lnet_ping_buffer *ln_push_target;int ln_push_target_nnis;/* discovery event queue handle */ @@ -996,35 +996,35 @@ struct lnet {int ln_dc_state;/* router checker startup/shutdown state */ -enum lnet_rc_state ln_rc_state; +enum lnet_rc_state ln_rc_state;/* router checker's event queue */ -struct lnet_handle_eq ln_rc_eqh; +struct lnet_handle_eq ln_rc_eqh;/* rcd still pending on net */ -struct list_head ln_rcd_deathrow; +struct list_head ln_rcd_deathrow;/* rcd ready for free */ -struct list_head ln_rcd_zombie; +struct list_head ln_rcd_zombie;/* serialise startup/shutdown */ -struct completion ln_rc_signal; +struct completion ln_rc_signal; -struct mutex ln_api_mutex; -struct mutex ln_lnd_mutex; -struct mutex ln_delay_mutex; +struct mutex ln_api_mutex; +struct mutex ln_lnd_mutex; +struct mutex ln_delay_mutex;/* Have I called LNetNIInit myself? */ -int ln_niinit_self; +int ln_niinit_self;/* LNetNIInit/LNetNIFini counter */ -int ln_refcount; +int ln_refcount;/* SHUTDOWN/RUNNING/STOPPING */ -enum lnet_state ln_state; +enum lnet_state ln_state; -int ln_routing;/* am I a router? */ -lnet_pid_t ln_pid;/* requested pid */ +int ln_routing;/* am I a router? */ +lnet_pid_t ln_pid;/* requested pid */ /* uniquely identifies this ni in this epoch */ -u64 ln_interface_cookie; +u64 ln_interface_cookie;/* registered LNDs */ -struct list_head ln_lnds; +struct list_head ln_lnds;/* test protocol compatibility flags */ -int ln_testprotocompat; +int ln_testprotocompat;/* * 0 - load the NIs from the mod params @@ -1032,14 +1032,14 @@ struct lnet {* Reverse logic to ensure that other calls to LNetNIInit * need no change */ -bool ln_nis_from_mod_params; +bool ln_nis_from_mod_params;/* * waitq for router checker. As long as there are no routes in * the list, the router checker will sleep on this queue. when * routes are added the thread will wake up */ -wait_queue_head_t ln_rc_waitq; +wait_queue_head_t ln_rc_waitq; };drivers/staging/lustre/lnet/lnet/acceptor.c +8
-8@@ -36,9 +36,9 @@#include <net/sock.h> #include <linux/lnet/lib-lnet.h> -static int accept_port =988 ; -static int accept_backlog =127 ; -static int accept_timeout =5 ; +static int accept_port =988 ; +static int accept_backlog =127 ; +static int accept_timeout =5 ; static struct { int pta_shutdown;@@ -167,9 +167,9 @@BUILD_BUG_ON (LNET_PROTO_ACCEPTOR_VERSION !=1 ); - cr.acr_magic =LNET_PROTO_ACCEPTOR_MAGIC ; + cr.acr_magic =LNET_PROTO_ACCEPTOR_MAGIC ; cr.acr_version =LNET_PROTO_ACCEPTOR_VERSION ; - cr.acr_nid = peer_nid; + cr.acr_nid = peer_nid;if (the_lnet.ln_testprotocompat) {/* single-shot proto check */ @@ -196,9 +196,9 @@ rc = -EADDRINUSE ; goto failed; - failed_sock: +failed_sock:sock_release (sock); - failed: +failed:lnet_connect_console_error (rc, peer_nid, peer_ip, peer_port);return rc; }@@ -297,7 +297,7 @@__swab64s (&cr.acr_nid); ni =lnet_nid2ni_addref (cr.acr_nid); -if (!ni ||/* no matching net */ +if (!ni ||/* no matching net */ ni->ni_nid != cr.acr_nid) {/* right NET, wrong NID! */ if (ni)lnet_ni_decref (ni);drivers/staging/lustre/lnet/lnet/api-ni.c +44
-45@@ -47,7 +47,7 @@* before module init completes. The mutex needs to be ready for use then. */ struct lnet the_lnet = { - .ln_api_mutex =__MUTEX_INITIALIZER (the_lnet.ln_api_mutex), + .ln_api_mutex =__MUTEX_INITIALIZER (the_lnet.ln_api_mutex), };/* THE state of the network */ EXPORT_SYMBOL (the_lnet);@@ -281,7 +281,7 @@ static int lnet_discover(struct lnet_process_id id, u32 force,return 0 ; - failed: +failed:lnet_destroy_locks ();return -ENOMEM ; }@@ -476,17 +476,17 @@ static void lnet_assert_wire_constants(void)lnet_net_lock (LNET_LOCK_EX );cfs_percpt_for_each (ctr, i, the_lnet.ln_counters) { - counters->msgs_max += ctr->msgs_max; - counters->msgs_alloc += ctr->msgs_alloc; - counters->errors += ctr->errors; - counters->send_count += ctr->send_count; - counters->recv_count += ctr->recv_count; - counters->route_count += ctr->route_count; - counters->drop_count += ctr->drop_count; - counters->send_length += ctr->send_length; - counters->recv_length += ctr->recv_length; + counters->msgs_max += ctr->msgs_max; + counters->msgs_alloc += ctr->msgs_alloc; + counters->errors += ctr->errors; + counters->send_count += ctr->send_count; + counters->recv_count += ctr->recv_count; + counters->route_count += ctr->route_count; + counters->drop_count += ctr->drop_count; + counters->send_length += ctr->send_length; + counters->recv_length += ctr->recv_length; counters->route_length += ctr->route_length; - counters->drop_length += ctr->drop_length; + counters->drop_length += ctr->drop_length; }lnet_net_unlock (LNET_LOCK_EX ); }@@ -755,7 +755,7 @@ struct lnet_libhandle *return 0 ; - failed: +failed:lnet_unprepare ();return rc; }@@ -942,7 +942,7 @@ struct lnet_net *return false; } -struct lnet_ni * +struct lnet_ni *lnet_nid2ni_locked (lnet_nid_t nid,int cpt) {struct lnet_net *net;@@ -1146,8 +1146,10 @@ struct lnet_ping_buffer *struct lnet_handle_md *ping_mdh, int ni_count, bool set_eq) { - struct lnet_process_id id = { .nid = LNET_NID_ANY, - .pid =LNET_PID_ANY }; + struct lnet_process_id id = { + .nid =LNET_NID_ANY , + .pid =LNET_PID_ANY + };struct lnet_handle_me me_handle;struct lnet_md md = {NULL };int rc, rc2;@@ -1244,7 +1246,7 @@ struct lnet_ping_buffer *lnet_ni_lock (ni); ns->ns_status = ni->ni_status ? - ni->ni_status->ns_status : + ni->ni_status->ns_status :LNET_NI_STATUS_UP ; ni->ni_status = ns;lnet_ni_unlock (ni);@@ -1322,7 +1324,10 @@ struct lnet_ping_buffer */* Resize the push target. */ int lnet_push_target_resize (void ) { -struct lnet_process_id id = {LNET_NID_ANY ,LNET_PID_ANY }; +struct lnet_process_id id = { + .nid =LNET_NID_ANY , + .pid =LNET_PID_ANY + };struct lnet_md md = {NULL };struct lnet_handle_me meh;struct lnet_handle_md mdh;@@ -1353,13 +1358,13 @@ int lnet_push_target_resize(void) }/* initialize md content */ - md.start = &pbuf->pb_info; - md.length =LNET_PING_INFO_SIZE (nnis); + md.start = &pbuf->pb_info; + md.length =LNET_PING_INFO_SIZE (nnis); md.threshold =LNET_MD_THRESH_INF ; - md.max_size =0 ; - md.options =LNET_MD_OP_PUT |LNET_MD_TRUNCATE | -LNET_MD_MANAGE_REMOTE ; - md.user_ptr = pbuf; + md.max_size =0 ; + md.options =LNET_MD_OP_PUT |LNET_MD_TRUNCATE | +LNET_MD_MANAGE_REMOTE ; + md.user_ptr = pbuf; md.eq_handle = the_lnet.ln_push_target_eq; rc =LNetMDAttach (meh, md,LNET_RETAIN , &mdh);@@ -1428,7 +1433,6 @@ static int lnet_push_target_init(void) the_lnet.ln_push_target_nnis =LNET_INTERFACES_MIN ; rc =lnet_push_target_resize (); -if (rc) {LNetEQFree (the_lnet.ln_push_target_eq);LNetInvalidateEQHandle (&the_lnet.ln_push_target_eq);@@ -1723,10 +1727,10 @@ static void lnet_push_target_fini(void)CDEBUG (D_LNI ,"Added LNI %s [%d/%d/%d/%d]\n" ,libcfs_nid2str (ni->ni_nid), - ni->ni_net->net_tunables.lct_peer_tx_credits, + ni->ni_net->net_tunables.lct_peer_tx_credits,lnet_ni_tq_credits (ni) *LNET_CPT_NUMBER , ni->ni_net->net_tunables.lct_peer_rtr_credits, - ni->ni_net->net_tunables.lct_peer_timeout); + ni->ni_net->net_tunables.lct_peer_timeout);return 0 ; failed0:@@ -1932,7 +1936,6 @@ static void lnet_push_target_fini(void)list_del_init (&net->net_list); rc =lnet_startup_lndnet (net,NULL ); -if (rc <0 ) goto failed;@@ -1963,8 +1966,8 @@ int lnet_lib_init(void)lnet_assert_wire_constants ();/* refer to global cfs_cpt_tab for now */ - the_lnet.ln_cpt_table = cfs_cpt_tab; - the_lnet.ln_cpt_number =cfs_cpt_number (cfs_cpt_tab); + the_lnet.ln_cpt_table = cfs_cpt_tab; + the_lnet.ln_cpt_number =cfs_cpt_number (cfs_cpt_tab);LASSERT (the_lnet.ln_cpt_number >0 );if (the_lnet.ln_cpt_number >LNET_CPT_MAX ) {@@ -2409,7 +2412,7 @@ struct lnet_ni *if (!prev) {if (!net) net = list_entry(the_lnet.ln_nets.next, struct lnet_net, - net_list); + net_list); ni = list_entry(net->net_ni_list.next, struct lnet_ni, ni_netlist);@@ -2455,7 +2458,6 @@ struct lnet_ni * cpt =lnet_net_lock_current (); ni =lnet_get_ni_idx_locked (idx); -if (ni) { rc =0 ;lnet_ni_lock (ni);@@ -2483,7 +2485,6 @@ struct lnet_ni * cpt =lnet_net_lock_current (); ni =lnet_get_ni_idx_locked (cfg_ni->lic_idx); -if (ni) { rc =0 ;lnet_ni_lock (ni);@@ -2705,7 +2706,7 @@ int lnet_dyn_del_ni(struct lnet_ioctl_config_ni *conf)struct lnet_ni *ni;u32 net_id =LNET_NIDNET (conf->lic_nid);struct lnet_ping_buffer *pbuf; -struct lnet_handle_md ping_mdh; +struct lnet_handle_md ping_mdh;int rc;int net_count;u32 addr;@@ -2912,7 +2913,7 @@ u32 lnet_get_dlc_seq_locked(void) {struct libcfs_ioctl_data *data = arg;struct lnet_ioctl_config_data *config; -struct lnet_process_id id = {0 }; +struct lnet_process_id id = {0 };struct lnet_ni *ni;int rc;@@ -3357,7 +3358,7 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout,int which;int unlinked =0 ;int replied =0 ; -const signed long a_long_time =60 *HZ ; +const signed long a_long_time =60 *HZ ;struct lnet_ping_buffer *pbuf;struct lnet_process_id tmpid;int i;@@ -3384,12 +3385,12 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, }/* initialize md content */ - md.start = &pbuf->pb_info; - md.length =LNET_PING_INFO_SIZE (n_ids); + md.start = &pbuf->pb_info; + md.length =LNET_PING_INFO_SIZE (n_ids); md.threshold =2 ;/* GET/REPLY */ - md.max_size =0 ; - md.options =LNET_MD_TRUNCATE ; - md.user_ptr =NULL ; + md.max_size =0 ; + md.options =LNET_MD_TRUNCATE ; + md.user_ptr =NULL ; md.eq_handle = eqh; rc =LNetMDBind (md,LNET_UNLINK , &mdh);@@ -3401,7 +3402,6 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, rc =LNetGet (LNET_NID_ANY , mdh, id,LNET_RESERVED_PORTAL ,LNET_PROTO_PING_MATCHBITS ,0 ); -if (rc) {/* Don't CERROR; this could be deliberate! */ rc2 =LNetMDUnlink (mdh);@@ -3414,7 +3414,6 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, do { /* MUST block for unlink to complete */ - rc2 = LNetEQPoll(&eqh, 1, timeout, !unlinked, &event, &which);@@ -3510,13 +3509,13 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, } rc = pbuf->pb_info.pi_nnis; - fail_free_eq: +fail_free_eq: rc2 =LNetEQFree (eqh);if (rc2)CERROR ("rc2 %d\n" , rc2);LASSERT (!rc2); - fail_ping_buffer_decref: +fail_ping_buffer_decref:lnet_ping_buffer_decref (pbuf);return rc; }drivers/staging/lustre/lnet/lnet/config.c +18
-20@@ -38,15 +38,15 @@#include <linux/lnet/lib-lnet.h> #include <linux/inetdevice.h> -struct lnet_text_buf {/* tmp struct for parsing routes */ -struct list_head ltb_list;/* stash on lists */ -int ltb_size;/* allocated size */ -char ltb_text[0 ];/* text buffer */ +struct lnet_text_buf {/* tmp struct for parsing routes */ +struct list_head ltb_list;/* stash on lists */ +int ltb_size;/* allocated size */ +char ltb_text[0 ];/* text buffer */ }; -static int lnet_tbnob;/* track text buf allocation */ -#define LNET_MAX_TEXTBUF_NOB (64 << 10)/* bound allocation */ -#define LNET_SINGLE_TEXTBUF_NOB (4 << 10) +static int lnet_tbnob;/* track text buf allocation */ +#define LNET_MAX_TEXTBUF_NOB (64 << 10)/* bound allocation */ +#define LNET_SINGLE_TEXTBUF_NOB (4 << 10)#define SPACESTR " \t\v\r\n"#define DELIMITERS ":()[]"@@ -126,6 +126,7 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ lnet_ni_unique_ni(char *iface_list[LNET_INTERFACES_NUM], char *iface) {int i; +for (i =0 ; i <LNET_INTERFACES_NUM ; i++) {if (iface_list[i] &&strncmp (iface_list[i], iface,strlen (iface)) ==0 )@@ -554,7 +555,7 @@ struct lnet_ni * goto failed;return ni; - failed: +failed:lnet_ni_free (ni);return NULL ; }@@ -743,9 +744,9 @@ struct lnet_ni * goto failed_syntax; } rc =cfs_expr_list_parse (elstr, - nistr - elstr +1 , -0 ,LNET_CPT_NUMBER -1 , - &ni_el); + nistr - elstr +1 , +0 ,LNET_CPT_NUMBER -1 , + &ni_el);if (rc !=0 ) { str = elstr; goto failed_syntax;@@ -812,9 +813,9 @@ struct lnet_ni *kfree (tokens);return nnets; - failed_syntax: +failed_syntax:lnet_syntax ("networks" , networks, (int )(str - tokens),strlen (str)); - failed: +failed:/* free the net list and all the nis on each net */ while (!list_empty (netlist)) { net = list_entry(netlist->next, struct lnet_net, net_list);@@ -1038,7 +1039,7 @@ struct lnet_ni *list_splice (&pending, tbs->prev);return 1 ; - failed: +failed:lnet_free_text_bufs (&pending);return -EINVAL ; }@@ -1093,7 +1094,6 @@ struct lnet_ni * {/* static scratch buffer OK (single threaded) */ static char cmd[LNET_SINGLE_TEXTBUF_NOB ]; -struct list_head nets;struct list_head gateways;struct list_head *tmp1;@@ -1226,9 +1226,9 @@ struct lnet_ni * myrc =0 ; goto out; - token_error: +token_error:lnet_syntax ("routes" , cmd, (int )(token - str),strlen (token)); - out: +out:lnet_free_text_bufs (&nets);lnet_free_text_bufs (&gateways);return myrc;@@ -1298,7 +1298,6 @@ struct lnet_ni * lnet_match_network_tokens(char *net_entry, u32 *ipaddrs, int nip) {static char tokens[LNET_SINGLE_TEXTBUF_NOB ]; -int matched =0 ;int ntokens =0 ;int len;@@ -1451,7 +1450,6 @@ struct lnet_ni * {static char networks[LNET_SINGLE_TEXTBUF_NOB ];static char source[LNET_SINGLE_TEXTBUF_NOB ]; -struct list_head raw_entries;struct list_head matched_nets;struct list_head current_nets;@@ -1549,7 +1547,7 @@ struct lnet_ni * count++; } - out: +out:lnet_free_text_bufs (&raw_entries);lnet_free_text_bufs (&matched_nets);lnet_free_text_bufs (¤t_nets);drivers/staging/lustre/lnet/lnet/lib-eq.c +1
-1@@ -198,7 +198,7 @@lnet_res_lh_invalidate (&eq->eq_lh);list_del (&eq->eq_list);kfree (eq); - out: +out:lnet_eq_wait_unlock ();lnet_res_unlock (LNET_LOCK_EX );drivers/staging/lustre/lnet/lnet/lib-move.c +41
-43@@ -489,7 +489,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,if (mlen) { niov = msg->msg_niov; - iov = msg->msg_iov; + iov = msg->msg_iov; kiov = msg->msg_kiov;LASSERT (niov >0 );@@ -541,12 +541,12 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,lnet_setpayloadbuffer (msg);memset (&msg->msg_hdr,0 ,sizeof (msg->msg_hdr)); - msg->msg_hdr.type =cpu_to_le32 (type); + msg->msg_hdr.type =cpu_to_le32 (type);/* dest_nid will be overwritten by lnet_select_pathway() */ - msg->msg_hdr.dest_nid =cpu_to_le64 (target.nid); - msg->msg_hdr.dest_pid =cpu_to_le32 (target.pid); + msg->msg_hdr.dest_nid =cpu_to_le64 (target.nid); + msg->msg_hdr.dest_pid =cpu_to_le32 (target.pid);/* src_nid will be set later */ - msg->msg_hdr.src_pid =cpu_to_le32 (the_lnet.ln_pid); + msg->msg_hdr.src_pid =cpu_to_le32 (the_lnet.ln_pid); msg->msg_hdr.payload_length =cpu_to_le32 (len); }@@ -635,7 +635,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, } deadline = lp->lpni_last_alive + - lp->lpni_net->net_tunables.lct_peer_timeout; + lp->lpni_net->net_tunables.lct_peer_timeout; alive = deadline > now;/* Update obsolete lpni_alive except for routers assumed to be dead @@ -911,7 +911,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, {struct lnet_peer_ni *txpeer = msg->msg_txpeer;struct lnet_msg *msg2; -struct lnet_ni *txni = msg->msg_txni; +struct lnet_ni *txni = msg->msg_txni;if (msg->msg_txcredit) {struct lnet_ni *ni = msg->msg_txni;@@ -1044,7 +1044,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, lnet_return_rx_credits_locked(struct lnet_msg *msg) {struct lnet_peer_ni *rxpeer = msg->msg_rxpeer; -struct lnet_ni *rxni = msg->msg_rxni; +struct lnet_ni *rxni = msg->msg_rxni;struct lnet_msg *msg2;if (msg->msg_rtrcredit) {@@ -1796,7 +1796,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,/* if we still can't find a peer ni then we can't reach it */ if (!best_lpni) {u32 net_id = peer_net ? peer_net->lpn_net_id : -LNET_NIDNET (dst_nid); +LNET_NIDNET (dst_nid);lnet_net_unlock (cpt); LCONSOLE_WARN("no peer_ni found on peer net %s\n",@@ -1912,7 +1912,6 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, } rc =lnet_post_send_locked (msg,0 ); -if (!rc) CDEBUG(D_NET, "TRACE: %s(%s:%s) -> %s(%s:%s) : %s\n", libcfs_nid2str(msg->msg_hdr.src_nid),@@ -1931,8 +1930,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,int lnet_send (lnet_nid_t src_nid,struct lnet_msg *msg,lnet_nid_t rtr_nid) { -lnet_nid_t dst_nid = msg->msg_target.nid; -int rc; +lnet_nid_t dst_nid = msg->msg_target.nid; +int rc;/* * NB: rtr_nid is set to LNET_NID_ANY for all current use-cases, @@ -2008,19 +2007,19 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,le32_to_cpus (&hdr->msg.put.offset);/* Primary peer NID. */ - info.mi_id.nid = msg->msg_initiator; - info.mi_id.pid = hdr->src_pid; - info.mi_opc =LNET_MD_OP_PUT ; - info.mi_portal = hdr->msg.put.ptl_index; + info.mi_id.nid = msg->msg_initiator; + info.mi_id.pid = hdr->src_pid; + info.mi_opc =LNET_MD_OP_PUT ; + info.mi_portal = hdr->msg.put.ptl_index; info.mi_rlength = hdr->payload_length; info.mi_roffset = hdr->msg.put.offset; - info.mi_mbits = hdr->msg.put.match_bits; - info.mi_cpt =lnet_cpt_of_nid (msg->msg_rxpeer->lpni_nid, ni); + info.mi_mbits = hdr->msg.put.match_bits; + info.mi_cpt =lnet_cpt_of_nid (msg->msg_rxpeer->lpni_nid, ni); msg->msg_rx_ready_delay = !ni->ni_net->net_lnd->lnd_eager_recv; ready_delay = msg->msg_rx_ready_delay; - again: +again: rc =lnet_ptl_match_md (&info, msg);switch (rc) {default :@@ -2069,17 +2068,17 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,le32_to_cpus (&hdr->msg.get.sink_length);le32_to_cpus (&hdr->msg.get.src_offset); - source_id.nid = hdr->src_nid; - source_id.pid = hdr->src_pid; + source_id.nid = hdr->src_nid; + source_id.pid = hdr->src_pid;/* Primary peer NID */ - info.mi_id.nid = msg->msg_initiator; - info.mi_id.pid = hdr->src_pid; - info.mi_opc =LNET_MD_OP_GET ; - info.mi_portal = hdr->msg.get.ptl_index; + info.mi_id.nid = msg->msg_initiator; + info.mi_id.pid = hdr->src_pid; + info.mi_opc =LNET_MD_OP_GET ; + info.mi_portal = hdr->msg.get.ptl_index; info.mi_rlength = hdr->msg.get.sink_length; info.mi_roffset = hdr->msg.get.src_offset; - info.mi_mbits = hdr->msg.get.match_bits; - info.mi_cpt =lnet_cpt_of_nid (msg->msg_rxpeer->lpni_nid, ni); + info.mi_mbits = hdr->msg.get.match_bits; + info.mi_cpt =lnet_cpt_of_nid (msg->msg_rxpeer->lpni_nid, ni); rc =lnet_ptl_match_md (&info, msg);if (rc ==LNET_MATCHMD_DROP ) {@@ -2128,7 +2127,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, {void *private = msg->msg_private;struct lnet_hdr *hdr = &msg->msg_hdr; -struct lnet_process_id src = {0 }; +struct lnet_process_id src = {0 };struct lnet_libmd *md;int rlength;int mlength;@@ -2192,7 +2191,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, lnet_parse_ack(struct lnet_ni *ni, struct lnet_msg *msg) { struct lnet_hdr *hdr = &msg->msg_hdr; -struct lnet_process_id src = {0 }; +struct lnet_process_id src = {0 };struct lnet_libmd *md;int cpt;@@ -2316,8 +2315,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,void lnet_print_hdr (struct lnet_hdr *hdr) { -struct lnet_process_id src = {0 }; -struct lnet_process_id dst = {0 }; +struct lnet_process_id src = {0 }; +struct lnet_process_id dst = {0 };char *type_str =lnet_msgtyp2str (hdr->type); src.nid = hdr->src_nid;@@ -2533,17 +2532,16 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,/* for building message event */ msg->msg_from = from_nid;if (!for_me) { - msg->msg_target.pid = dest_pid; - msg->msg_target.nid = dest_nid; - msg->msg_routing =1 ; - + msg->msg_target.pid = dest_pid; + msg->msg_target.nid = dest_nid; + msg->msg_routing =1 ; }else {/* convert common msg->hdr fields to host byteorder */ - msg->msg_hdr.type = type; - msg->msg_hdr.src_nid = src_nid; + msg->msg_hdr.type = type; + msg->msg_hdr.src_nid = src_nid;le32_to_cpus (&msg->msg_hdr.src_pid); - msg->msg_hdr.dest_nid = dest_nid; - msg->msg_hdr.dest_pid = dest_pid; + msg->msg_hdr.dest_nid = dest_nid; + msg->msg_hdr.dest_pid = dest_pid; msg->msg_hdr.payload_length = payload_length; }@@ -2609,11 +2607,11 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, goto free_drop;return 0 ; - free_drop: +free_drop:LASSERT (!msg->msg_md);lnet_finalize (msg, rc); - drop: +drop:lnet_drop_message (ni, cpt, private, payload_length, type);return 0 ; }@@ -2623,7 +2621,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, lnet_drop_delayed_msg_list(struct list_head *head, char *reason) {while (!list_empty (head)) { -struct lnet_process_id id = {0 }; +struct lnet_process_id id = {0 };struct lnet_msg *msg; msg = list_entry(head->next, struct lnet_msg, msg_list);@@ -2887,7 +2885,7 @@ struct lnet_msg *return msg; - drop: +drop: cpt =lnet_cpt_of_nid (peer_id.nid, ni);lnet_net_lock (cpt);drivers/staging/lustre/lnet/lnet/lib-msg.c +36
-36@@ -44,9 +44,9 @@ {memset (ev,0 ,sizeof (*ev)); - ev->status =0 ; + ev->status =0 ; ev->unlinked =1 ; - ev->type =LNET_EVENT_UNLINK ; + ev->type =LNET_EVENT_UNLINK ;lnet_md_deconstruct (md, &ev->md);lnet_md2handle (&ev->md_handle, md); }@@ -58,7 +58,7 @@ lnet_build_msg_event(struct lnet_msg *msg, enum lnet_event_kind ev_type) { struct lnet_hdr *hdr = &msg->msg_hdr; -struct lnet_event *ev = &msg->msg_ev; +struct lnet_event *ev = &msg->msg_ev;LASSERT (!msg->msg_routing);@@ -67,27 +67,27 @@if (ev_type ==LNET_EVENT_SEND ) {/* event for active message */ - ev->target.nid =le64_to_cpu (hdr->dest_nid); - ev->target.pid =le32_to_cpu (hdr->dest_pid); + ev->target.nid =le64_to_cpu (hdr->dest_nid); + ev->target.pid =le32_to_cpu (hdr->dest_pid); ev->initiator.nid =LNET_NID_ANY ; ev->initiator.pid = the_lnet.ln_pid; - ev->source.nid =LNET_NID_ANY ; - ev->source.pid = the_lnet.ln_pid; - ev->sender =LNET_NID_ANY ; + ev->source.nid =LNET_NID_ANY ; + ev->source.pid = the_lnet.ln_pid; + ev->sender =LNET_NID_ANY ; }else {/* event for passive message */ - ev->target.pid = hdr->dest_pid; - ev->target.nid = hdr->dest_nid; + ev->target.pid = hdr->dest_pid; + ev->target.nid = hdr->dest_nid; ev->initiator.pid = hdr->src_pid;/* Multi-Rail: resolve src_nid to "primary" peer NID */ ev->initiator.nid = msg->msg_initiator;/* Multi-Rail: track source NID. */ - ev->source.pid = hdr->src_pid; - ev->source.nid = hdr->src_nid; - ev->rlength = hdr->payload_length; - ev->sender = msg->msg_from; - ev->mlength = msg->msg_wanted; - ev->offset = msg->msg_offset; + ev->source.pid = hdr->src_pid; + ev->source.nid = hdr->src_nid; + ev->rlength = hdr->payload_length; + ev->sender = msg->msg_from; + ev->mlength = msg->msg_wanted; + ev->offset = msg->msg_offset; }switch (ev_type) {@@ -95,20 +95,20 @@LBUG ();case LNET_EVENT_PUT :/* passive PUT */ - ev->pt_index = hdr->msg.put.ptl_index; + ev->pt_index = hdr->msg.put.ptl_index; ev->match_bits = hdr->msg.put.match_bits; - ev->hdr_data = hdr->msg.put.hdr_data; + ev->hdr_data = hdr->msg.put.hdr_data;return ;case LNET_EVENT_GET :/* passive GET */ - ev->pt_index = hdr->msg.get.ptl_index; + ev->pt_index = hdr->msg.get.ptl_index; ev->match_bits = hdr->msg.get.match_bits; - ev->hdr_data =0 ; + ev->hdr_data =0 ;return ;case LNET_EVENT_ACK :/* ACK */ ev->match_bits = hdr->msg.ack.match_bits; - ev->mlength = hdr->msg.ack.mlength; + ev->mlength = hdr->msg.ack.mlength;return ;case LNET_EVENT_REPLY :/* REPLY */ @@ -116,21 +116,21 @@case LNET_EVENT_SEND :/* active message */ if (msg->msg_type ==LNET_MSG_PUT ) { - ev->pt_index =le32_to_cpu (hdr->msg.put.ptl_index); + ev->pt_index =le32_to_cpu (hdr->msg.put.ptl_index); ev->match_bits =le64_to_cpu (hdr->msg.put.match_bits); - ev->offset =le32_to_cpu (hdr->msg.put.offset); - ev->mlength = - ev->rlength =le32_to_cpu (hdr->payload_length); - ev->hdr_data =le64_to_cpu (hdr->msg.put.hdr_data); + ev->offset =le32_to_cpu (hdr->msg.put.offset); + ev->mlength = + ev->rlength =le32_to_cpu (hdr->payload_length); + ev->hdr_data =le64_to_cpu (hdr->msg.put.hdr_data); }else {LASSERT (msg->msg_type ==LNET_MSG_GET ); - ev->pt_index =le32_to_cpu (hdr->msg.get.ptl_index); + ev->pt_index =le32_to_cpu (hdr->msg.get.ptl_index); ev->match_bits =le64_to_cpu (hdr->msg.get.match_bits); - ev->mlength = - ev->rlength =le32_to_cpu (hdr->msg.get.sink_length); - ev->offset =le32_to_cpu (hdr->msg.get.src_offset); - ev->hdr_data =0 ; + ev->mlength = + ev->rlength =le32_to_cpu (hdr->msg.get.sink_length); + ev->offset =le32_to_cpu (hdr->msg.get.src_offset); + ev->hdr_data =0 ; }return ; }@@ -140,7 +140,7 @@ lnet_msg_commit(struct lnet_msg *msg, int cpt) {struct lnet_msg_container *container = the_lnet.ln_msg_containers[cpt]; -struct lnet_counters *counters = the_lnet.ln_counters[cpt]; +struct lnet_counters *counters = the_lnet.ln_counters[cpt];/* routed message can be committed for both receiving and sending */ LASSERT (!msg->msg_tx_committed);@@ -172,7 +172,7 @@static void lnet_msg_decommit_tx (struct lnet_msg *msg,int status) { -struct lnet_counters *counters; +struct lnet_counters *counters;struct lnet_event *ev = &msg->msg_ev;LASSERT (msg->msg_tx_committed);@@ -294,7 +294,7 @@if (ev->type ==LNET_EVENT_PUT || ev->type ==LNET_EVENT_REPLY ) counters->recv_length += msg->msg_wanted; - out: +out:lnet_return_rx_credits_locked (msg); msg->msg_rx_committed =0 ; }@@ -375,7 +375,7 @@ unlink =lnet_md_unlinkable (md);if (md->md_eq) { - msg->msg_ev.status = status; + msg->msg_ev.status = status; msg->msg_ev.unlinked = unlink;lnet_eq_enqueue_event (md->md_eq, &msg->msg_ev); }@@ -488,7 +488,7 @@lnet_res_unlock (cpt); } - again: +again: rc =0 ;if (!msg->msg_tx_committed && !msg->msg_rx_committed) {/* not committed to network yet */ drivers/staging/lustre/lnet/lnet/lib-ptl.c +11
-11@@ -74,7 +74,7 @@return 1 ; - match: +match:if ((lnet_ptl_is_unique (ptl) && !unique) || (lnet_ptl_is_wildcard (ptl) && unique))return 0 ;@@ -387,7 +387,7 @@ struct list_head * head = &mtable->mt_mhash[LNET_MT_HASH_IGNORE ]; else head =lnet_mt_match_head (mtable, info->mi_id, info->mi_mbits); - again: +again:/* NB: only wildcard portal needs to return LNET_MATCHMD_EXHAUSTED */ if (lnet_ptl_is_wildcard (the_lnet.ln_portals[mtable->mt_portal])) exhausted =LNET_MATCHMD_EXHAUSTED ;@@ -634,9 +634,9 @@ struct list_head * info->mi_mbits, info->mi_roffset, info->mi_rlength); } goto out0; - out1: +out1:lnet_res_unlock (mtable->mt_cpt); - out0: +out0:/* EXHAUSTED bit is only meaningful for internal functions */ return rc & ~LNET_MATCHMD_EXHAUSTED ; }@@ -678,7 +678,7 @@ struct list_head *lnet_ptl_lock (ptl); head = &ptl->ptl_msg_stealing; - again: +again:list_for_each_entry_safe (msg, tmp, head, msg_list) {struct lnet_match_info info;struct lnet_hdr *hdr;@@ -688,13 +688,13 @@ struct list_head * hdr = &msg->msg_hdr;/* Multi-Rail: Primary peer NID */ - info.mi_id.nid = msg->msg_initiator; - info.mi_id.pid = hdr->src_pid; - info.mi_opc =LNET_MD_OP_PUT ; - info.mi_portal = hdr->msg.put.ptl_index; + info.mi_id.nid = msg->msg_initiator; + info.mi_id.pid = hdr->src_pid; + info.mi_opc =LNET_MD_OP_PUT ; + info.mi_portal = hdr->msg.put.ptl_index; info.mi_rlength = hdr->payload_length; info.mi_roffset = hdr->msg.put.offset; - info.mi_mbits = hdr->msg.put.match_bits; + info.mi_mbits = hdr->msg.put.match_bits; rc =lnet_try_match_md (md, &info, msg);@@ -824,7 +824,7 @@ struct list_head * }return 0 ; - failed: +failed:lnet_ptl_cleanup (ptl);return -ENOMEM ; }drivers/staging/lustre/lnet/lnet/lib-socket.c +7
-4@@ -50,8 +50,11 @@long jiffies_left = timeout *msecs_to_jiffies (MSEC_PER_SEC );unsigned long then;struct timeval tv; -struct kvec iov = { .iov_base = buffer, .iov_len = nob }; -struct msghdr msg = {NULL ,}; +struct kvec iov = { + .iov_base = buffer, + .iov_len = nob + }; +struct msghdr msg = {NULL , };LASSERT (nob >0 );/* @@ -102,9 +105,9 @@long jiffies_left = timeout *msecs_to_jiffies (MSEC_PER_SEC );unsigned long then;struct timeval tv; -struct kvec iov = { +struct kvec iov = { .iov_base = buffer, - .iov_len = nob + .iov_len = nob };struct msghdr msg = { .msg_flags =0 drivers/staging/lustre/lnet/lnet/module.c +1
-2@@ -52,7 +52,6 @@if (!the_lnet.ln_niinit_self) { rc =try_module_get (THIS_MODULE ); -if (rc !=1 ) goto out;@@ -229,7 +228,7 @@ }static struct notifier_block lnet_ioctl_handler = { - .notifier_call = lnet_ioctl, + .notifier_call = lnet_ioctl, };static int __init lnet_init (void )drivers/staging/lustre/lnet/lnet/net_fault.c +0
-1@@ -614,7 +614,6 @@ struct delay_daemon_data { rc =lnet_parse_local (ni, msg);if (!rc)continue ; - }else {lnet_net_lock (cpt); rc =lnet_parse_forward_locked (ni, msg);drivers/staging/lustre/lnet/lnet/nidstrings.c +20
-20@@ -60,8 +60,8 @@* between getting its string and using it. */ -static char libcfs_nidstrings[LNET_NIDSTR_COUNT ][LNET_NIDSTR_SIZE ]; -static int libcfs_nidstring_idx; +static char libcfs_nidstrings[LNET_NIDSTR_COUNT ][LNET_NIDSTR_SIZE ]; +static int libcfs_nidstring_idx;static DEFINE_SPINLOCK (libcfs_nidstring_lock);@@ -117,23 +117,23 @@ struct nidrange {* Link to list of this structures which is built on nid range * list parsing. */ -struct list_head nr_link; +struct list_head nr_link;/** * List head for addrrange::ar_link. */ -struct list_head nr_addrranges; +struct list_head nr_addrranges;/** * Flag indicating that *@<net> is found. */ -int nr_all; +int nr_all;/** * Pointer to corresponding element of libcfs_netstrfns. */ -struct netstrfns *nr_netstrfns; +struct netstrfns *nr_netstrfns;/** * Number of network. E.g. 5 if \<net\> is "elan5". */ -int nr_netnum; +int nr_netnum; };/** @@ -143,11 +143,11 @@ struct addrrange {/** * Link to nidrange::nr_addrranges. */ -struct list_head ar_link; +struct list_head ar_link;/** * List head for cfs_expr_list::el_list. */ -struct list_head ar_numaddr_ranges; +struct list_head ar_numaddr_ranges; };/** @@ -471,8 +471,8 @@ static void cfs_ip_ar_min_max(struct addrrange *ar, u32 *min_nid,struct cfs_expr_list *el;struct cfs_range_expr *re;u32 tmp_ip_addr =0 ; -unsigned int min_ip[4 ] = {0 }; -unsigned int max_ip[4 ] = {0 }; +unsigned int min_ip[4 ] = {0 }; +unsigned int max_ip[4 ] = {0 };int re_count =0 ;list_for_each_entry (el, &ar->ar_numaddr_ranges, el_link) {@@ -794,11 +794,11 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid,static int libcfs_ip_str2addr (const char *str,int nob,u32 *addr) { -unsigned int a; -unsigned int b; -unsigned int c; -unsigned int d; -int n = nob;/* XscanfX */ +unsigned int a; +unsigned int b; +unsigned int c; +unsigned int d; +int n = nob;/* XscanfX */ /* numeric IP? */ if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&@@ -897,7 +897,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid,static int libcfs_num_str2addr (const char *str,int nob,u32 *addr) { -int n; +int n; n = nob;if (sscanf (str,"0x%x%n" , addr, &n) >=1 && n == nob)@@ -926,7 +926,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid, libcfs_num_parse(char *str, int len, struct list_head *list) {struct cfs_expr_list *el; -int rc; +int rc; rc =cfs_expr_list_parse (str, len,0 ,MAX_NUMERIC_VALUE , &el);if (!rc)@@ -1049,7 +1049,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid,static struct netstrfns *libcfs_name2netstrfns (const char *name) { -int i; +int i;for (i =0 ; i < libcfs_nnetstrfns; i++)if (!strcmp (libcfs_netstrfns[i].nf_name, name))@@ -1194,7 +1194,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid,u32 libcfs_str2net (const char *str) { -u32 net; +u32 net;if (libcfs_str2net_internal (str, &net))return net;drivers/staging/lustre/lnet/lnet/peer.c +18
-19@@ -586,8 +586,8 @@ void lnet_peer_uninit(void)static struct lnet_peer_ni *lnet_get_peer_ni_locked (struct lnet_peer_table *ptable,lnet_nid_t nid) { -struct list_head *peers; -struct lnet_peer_ni *lp; +struct list_head *peers; +struct lnet_peer_ni *lp;LASSERT (the_lnet.ln_state ==LNET_STATE_RUNNING );@@ -1069,6 +1069,7 @@ struct lnet_peer_net * lnet_peer_get_net_locked(struct lnet_peer *peer, u32 net_id) {struct lnet_peer_net *peer_net; +list_for_each_entry (peer_net, &peer->lp_peer_nets, lpn_peer_nets) {if (peer_net->lpn_net_id == net_id)return peer_net;@@ -1088,9 +1089,9 @@ struct lnet_peer_net **/ static int lnet_peer_attach_peer_ni (struct lnet_peer *lp, -struct lnet_peer_net *lpn, -struct lnet_peer_ni *lpni, -unsigned int flags) +struct lnet_peer_net *lpn, +struct lnet_peer_ni *lpni, +unsigned int flags) {struct lnet_peer_table *ptable;@@ -2686,12 +2687,12 @@ static int lnet_peer_send_ping(struct lnet_peer *lp) }/* initialize md content */ - md.start = &pbuf->pb_info; - md.length =LNET_PING_INFO_SIZE (nnis); + md.start = &pbuf->pb_info; + md.length =LNET_PING_INFO_SIZE (nnis); md.threshold =2 ;/* GET/REPLY */ - md.max_size =0 ; - md.options =LNET_MD_TRUNCATE ; - md.user_ptr = lp; + md.max_size =0 ; + md.options =LNET_MD_TRUNCATE ; + md.user_ptr = lp; md.eq_handle = the_lnet.ln_dc_eqh; rc =LNetMDBind (md,LNET_UNLINK , &lp->lp_ping_mdh);@@ -2715,7 +2716,6 @@ static int lnet_peer_send_ping(struct lnet_peer *lp) rc =LNetGet (LNET_NID_ANY , lp->lp_ping_mdh, id,LNET_RESERVED_PORTAL ,LNET_PROTO_PING_MATCHBITS ,0 ); -if (rc) goto fail_unlink_md;@@ -2792,13 +2792,13 @@ static int lnet_peer_send_push(struct lnet_peer *lp)lnet_net_unlock (cpt);/* Push source MD */ - md.start = &pbuf->pb_info; - md.length =LNET_PING_INFO_SIZE (pbuf->pb_nnis); + md.start = &pbuf->pb_info; + md.length =LNET_PING_INFO_SIZE (pbuf->pb_nnis); md.threshold =2 ;/* Put/Ack */ - md.max_size =0 ; - md.options =0 ; + md.max_size =0 ; + md.options =0 ; md.eq_handle = the_lnet.ln_dc_eqh; - md.user_ptr = lp; + md.user_ptr = lp; rc =LNetMDBind (md,LNET_UNLINK , &lp->lp_push_mdh);if (rc) {@@ -2821,7 +2821,6 @@ static int lnet_peer_send_push(struct lnet_peer *lp) rc =LNetPut (LNET_NID_ANY , lp->lp_push_mdh,LNET_ACK_REQ , id,LNET_RESERVED_PORTAL ,LNET_PROTO_PING_MATCHBITS ,0 ,0 ); -if (rc) goto fail_unlink;@@ -3315,8 +3314,8 @@ int lnet_get_peer_info(struct lnet_ioctl_peer_cfg *cfg, void __user *bulk) goto out; } - size =sizeof (nid) +sizeof (*lpni_info) +sizeof (*lpni_stats) - +sizeof (*lpni_msg_stats); + size =sizeof (nid) +sizeof (*lpni_info) +sizeof (*lpni_stats) + +sizeof (*lpni_msg_stats); size *= lp->lp_nnis;if (size > cfg->prcfg_size) { cfg->prcfg_size = size;drivers/staging/lustre/lnet/lnet/router.c +13
-13@@ -172,7 +172,7 @@ notifylnd = lp->lpni_notifylnd; lp->lpni_notifylnd =0 ; - lp->lpni_notify =0 ; + lp->lpni_notify =0 ;if (notifylnd && ni->ni_net->net_lnd->lnd_notify) {spin_unlock (&lp->lpni_lock);@@ -274,6 +274,7 @@ static void lnet_shuffle_seed(void)* the NID for this node gives the most entropy in the low bits */ while ((ni =lnet_get_next_ni_locked (NULL , ni))) {u32 lnd_type, seed; + lnd_type =LNET_NETTYP (LNET_NIDNET (ni->ni_nid));if (lnd_type !=LOLND ) { seed = (LNET_NIDADDR (ni->ni_nid) | lnd_type);@@ -386,7 +387,6 @@ static void lnet_shuffle_seed(void)/* Search for a duplicate route (it's a NOOP if it is) */ add_route =1 ;list_for_each_entry (route2, &rnet2->lrn_routes, lr_list) { -if (route2->lr_gateway == route->lr_gateway) { add_route =0 ;break ;@@ -501,7 +501,7 @@ static void lnet_shuffle_seed(void)else rn_list =lnet_net2rnethash (net); - again: +again:list_for_each_entry (rnet, rn_list, lrn_list) {if (!(net ==LNET_NIDNET (LNET_NID_ANY ) || net == rnet->lrn_net))@@ -601,10 +601,10 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)list_for_each_entry (rnet, rn_list, lrn_list) {list_for_each_entry (route, &rnet->lrn_routes, lr_list) {if (!idx--) { - *net = rnet->lrn_net; - *hops = route->lr_hops; + *net = rnet->lrn_net; + *hops = route->lr_hops; *priority = route->lr_priority; - *gateway = route->lr_gateway->lpni_nid; + *gateway = route->lr_gateway->lpni_nid; *alive =lnet_is_route_alive (route);lnet_net_unlock (cpt);return 0 ;@@ -648,7 +648,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)struct lnet_ping_buffer *pbuf = rcd->rcd_pingbuffer;struct lnet_peer_ni *gw = rcd->rcd_gateway;struct lnet_route *rte; -int nnis; +int nnis;if (!gw->lpni_alive || !pbuf)return ;@@ -799,7 +799,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)if (avoid_asym_router_failure && !event->status)lnet_parse_rc_info (rcd); - out: +out:lnet_net_unlock (lp->lpni_cpt); }@@ -1069,14 +1069,14 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) id.pid =LNET_PID_LUSTRE ;CDEBUG (D_NET ,"Check: %s\n" ,libcfs_id2str (id)); - rtr->lpni_ping_notsent =1 ; + rtr->lpni_ping_notsent =1 ; rtr->lpni_ping_timestamp = now; mdh = rcd->rcd_mdh;if (!rtr->lpni_ping_deadline) { rtr->lpni_ping_deadline =ktime_get_seconds () + - router_ping_timeout; + router_ping_timeout; }lnet_net_unlock (rtr->lpni_cpt);@@ -1652,7 +1652,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)return 0 ; - failed: +failed:lnet_rtrpools_free (0 );return rc; }@@ -1797,8 +1797,8 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg)return -EINVAL ; } -if (ni && !alive &&/* LND telling me she's down */ - !auto_down) {/* auto-down disabled */ +if (ni && !alive &&/* LND telling me she's down */ + !auto_down) {/* auto-down disabled */ CDEBUG (D_NET ,"Auto-down disabled\n" );return 0 ; }drivers/staging/lustre/lnet/lnet/router_proc.c +30
-31@@ -66,8 +66,8 @@#define LNET_PROC_HOFF_GET (pos) \ (int)((pos) & LNET_PROC_HOFF_MASK) -#define LNET_PROC_POS_MAKE (cpt, ver, hash, off) \ - (((((loff_t)(cpt)) & LNET_PROC_CPT_MASK) << LNET_PROC_VPOS_BITS) | \ +#define LNET_PROC_POS_MAKE (cpt, ver, hash, off) \ + (((((loff_t)(cpt)) & LNET_PROC_CPT_MASK) << LNET_PROC_VPOS_BITS) | \ ((((loff_t)(ver)) & LNET_PROC_VER_MASK) << LNET_PROC_HPOS_BITS) | \ ((((loff_t)(hash)) & LNET_PROC_HASH_MASK) << LNET_PROC_HOFF_BITS) | \ ((off) & LNET_PROC_HOFF_MASK))@@ -91,7 +91,6 @@ static int proc_lnet_stats(struct ctl_table *table, int write, }/* read */ - ctrs =kzalloc (sizeof (*ctrs),GFP_NOFS );if (!ctrs)return -ENOMEM ;@@ -395,8 +394,8 @@ static int proc_lnet_peers(struct ctl_table *table, int write,struct lnet_peer_table *ptable;char *tmpstr =NULL ;char *s; -int cpt =LNET_PROC_CPT_GET (*ppos); -int ver =LNET_PROC_VER_GET (*ppos); +int cpt =LNET_PROC_CPT_GET (*ppos); +int ver =LNET_PROC_VER_GET (*ppos);int hash =LNET_PROC_HASH_GET (*ppos);int hoff =LNET_PROC_HOFF_GET (*ppos);int rc =0 ;@@ -456,7 +455,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write,struct lnet_peer_ni *peer;struct list_head *p;int skip; - again: +again: p =NULL ; peer =NULL ; skip = hoff -1 ;@@ -630,7 +629,7 @@ static int proc_lnet_buffers(struct ctl_table *table, int write,lnet_net_unlock (LNET_LOCK_EX ); } - out: +out: len = s - tmpstr;if (pos >=min_t (int, len,strlen (tmpstr)))@@ -787,9 +786,9 @@ static int proc_lnet_nis(struct ctl_table *table, int write, }struct lnet_portal_rotors { -int pr_value; -const char *pr_name; -const char *pr_desc; +int pr_value; +const char *pr_name; +const char *pr_desc; };static struct lnet_portal_rotors portal_rotors[] = {@@ -890,39 +889,39 @@ static int proc_lnet_portal_rotor(struct ctl_table *table, int write,* to go via /proc for portability. */ { - .procname = "stats", - .mode = 0644, - .proc_handler = &proc_lnet_stats, + .procname = "stats", + .mode = 0644, + .proc_handler = &proc_lnet_stats, }, { - .procname = "routes", - .mode = 0444, - .proc_handler = &proc_lnet_routes, + .procname = "routes", + .mode = 0444, + .proc_handler = &proc_lnet_routes, }, { - .procname = "routers", - .mode = 0444, - .proc_handler = &proc_lnet_routers, + .procname = "routers", + .mode = 0444, + .proc_handler = &proc_lnet_routers, }, { - .procname = "peers", - .mode = 0644, - .proc_handler = &proc_lnet_peers, + .procname = "peers", + .mode = 0644, + .proc_handler = &proc_lnet_peers, }, { - .procname = "buffers", - .mode = 0444, - .proc_handler = &proc_lnet_buffers, + .procname = "buffers", + .mode = 0444, + .proc_handler = &proc_lnet_buffers, }, { - .procname = "nis", - .mode = 0644, - .proc_handler = &proc_lnet_nis, + .procname = "nis", + .mode = 0644, + .proc_handler = &proc_lnet_nis, }, { - .procname = "portal_rotor", - .mode = 0644, - .proc_handler = &proc_lnet_portal_rotor, + .procname = "portal_rotor", + .mode = 0644, + .proc_handler = &proc_lnet_portal_rotor, }, { }Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20190204/a8d5ab01/attachment-0001.sig>
PATCH 25/26 socklnd: cleanup white spaces
In reply to James SimmonsThe ksocklnd code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes.
--- .../staging/lustre/include/linux/lnet/socklnd.h | 6 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 71 +-- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 548 ++++++++++----------- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 48 +- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 16 +- .../lustre/lnet/klnds/socklnd/socklnd_modparams.c | 54 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 79 ++- 7 files changed, 408 insertions(+), 414 deletions(-)
drivers/staging/lustre/include/linux/lnet/socklnd.h +3 -3
@@ -64,9 +64,9 @@ struct ksock_lnet_msg { } __packed;struct ksock_msg { -u32 ksm_type;/* type of socklnd message */ -u32 ksm_csum;/* checksum if != 0 */ -u64 ksm_zc_cookies[2 ];/* Zero-Copy request/ACK cookie */ +u32 ksm_type;/* type of socklnd message */ +u32 ksm_csum;/* checksum if != 0 */ +u64 ksm_zc_cookies[2 ];/* Zero-Copy request/ACK cookie */ union {struct ksock_lnet_msg lnetmsg;/* lnet message, it's empty if * it's NOOP
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +36 -35
198 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +274 -274
680 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +20 -28
163 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +9 -7
@@ -75,14 +75,14 @@int ksocknal_lib_send_iov (struct ksock_conn *conn,struct ksock_tx *tx) { -struct msghdr msg = {.msg_flags =MSG_DONTWAIT }; +struct msghdr msg = { .msg_flags =MSG_DONTWAIT };struct socket *sock = conn->ksnc_sock;int nob, i; -if (*ksocknal_tunables.ksnd_enable_csum &&/* checksum enabled */ - conn->ksnc_proto == &ksocknal_protocol_v2x &&/* V2.x connection */ - tx->tx_nob == tx->tx_resid &&/* frist sending */ - !tx->tx_msg.ksm_csum)/* not checksummed */ +if (*ksocknal_tunables.ksnd_enable_csum &&/* checksum enabled */ + conn->ksnc_proto == &ksocknal_protocol_v2x &&/* V2.x connection */ + tx->tx_nob == tx->tx_resid &&/* first sending */ + !tx->tx_msg.ksm_csum)/* not checksummed */ ksocknal_lib_csum_tx (tx);for (nob = i =0 ; i < tx->tx_niov; i++)
@@ -130,7 +130,7 @@ rc =tcp_sendpage (sk, page, offset, fragsize, msgflg); } }else { -struct msghdr msg = {.msg_flags =MSG_DONTWAIT }; +struct msghdr msg = { .msg_flags =MSG_DONTWAIT };int i;for (nob = i =0 ; i < tx->tx_nkiov; i++)
@@ -144,6 +144,7 @@ kiov, tx->tx_nkiov, nob); rc =sock_sendmsg (sock, &msg); } +return rc; }
@@ -166,6 +167,7 @@static int lustre_csum (struct kvec *v,void *context) {struct ksock_conn *conn = context; + conn->ksnc_rx_csum =crc32_le (conn->ksnc_rx_csum, v->iov_base, v->iov_len);return 0 ;
@@ -325,7 +327,7 @@ static int lustre_csum(struct kvec *v, void *context)return rc; } -/* TCP_BACKOFF_* sockopt tunables unsupported in stock kernels */ +/* TCP_BACKOFF_* sockopt tunables unsupported in stock kernels */ /* snapshot tunables */ keep_idle = *ksocknal_tunables.ksnd_keepalive_idle;
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +27 -27
63 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +39 -40
126 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 26/26 o2iblnd: cleanup white spaces
In reply to James SimmonsThe o2iblnd code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes.
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 79 +-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 612 +++++++++++---------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 99 ++-- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 22 +- 4 files changed, 407 insertions(+), 405 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +40 -39
@@ -183,15 +183,15 @@ void kiblnd_pack_msg(struct lnet_ni *ni, struct kib_msg *msg, int version,* CAVEAT EMPTOR! all message fields not set here should have been * initialised previously. */ - msg->ibm_magic =IBLND_MSG_MAGIC ; - msg->ibm_version = version; + msg->ibm_magic =IBLND_MSG_MAGIC ; + msg->ibm_version = version;/* ibm_type */ - msg->ibm_credits = credits; + msg->ibm_credits = credits;/* ibm_nob */ - msg->ibm_cksum =0 ; - msg->ibm_srcnid = ni->ni_nid; + msg->ibm_cksum =0 ; + msg->ibm_srcnid = ni->ni_nid; msg->ibm_srcstamp = net->ibn_incarnation; - msg->ibm_dstnid = dstnid; + msg->ibm_dstnid = dstnid; msg->ibm_dststamp = dststamp;if (*kiblnd_tunables.kib_cksum) {
@@ -260,7 +260,7 @@ int kiblnd_unpack_msg(struct kib_msg *msg, int nob) msg->ibm_version = version;BUILD_BUG_ON (sizeof (msg->ibm_type) !=1 );BUILD_BUG_ON (sizeof (msg->ibm_credits) !=1 ); - msg->ibm_nob = msg_nob; + msg->ibm_nob = msg_nob;__swab64s (&msg->ibm_srcnid);__swab64s (&msg->ibm_srcstamp);__swab64s (&msg->ibm_dstnid);
@@ -903,12 +903,12 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer_ni *peer_ni,atomic_inc (&net->ibn_nconns);return conn; - failed_2: +failed_2:kiblnd_destroy_conn (conn);kfree (conn); - failed_1: +failed_1:kfree (init_qp_attr); - failed_0: +failed_0:return NULL ; }
@@ -1004,7 +1004,7 @@ int kiblnd_close_stale_conns_locked(struct kib_peer_ni *peer_ni,list_for_each_safe (ctmp, cnxt, &peer_ni->ibp_conns) { conn = list_entry(ctmp, struct kib_conn, ibc_list); -if (conn->ibc_version == version && +if (conn->ibc_version == version && conn->ibc_incarnation == incarnation)continue ;
@@ -1077,7 +1077,7 @@ static int kiblnd_ctl(struct lnet_ni *ni, unsigned int cmd, void *arg) rc =kiblnd_get_peer_info (ni, data->ioc_count, &nid, &count); - data->ioc_nid = nid; + data->ioc_nid = nid; data->ioc_count = count;break ; }
@@ -1414,15 +1414,16 @@ static void kiblnd_destroy_fmr_pool_list(struct list_head *head)static int kiblnd_alloc_fmr_pool (struct kib_fmr_poolset *fps,struct kib_fmr_pool *fpo) {struct ib_fmr_pool_param param = { - .max_pages_per_fmr =LNET_MAX_IOV , - .page_shift =PAGE_SHIFT , - .access = (IB_ACCESS_LOCAL_WRITE | -IB_ACCESS_REMOTE_WRITE ), - .pool_size = fps->fps_pool_size, - .dirty_watermark = fps->fps_flush_trigger, - .flush_function =NULL , - .flush_arg =NULL , - .cache = !!fps->fps_cache }; + .max_pages_per_fmr =LNET_MAX_IOV , + .page_shift =PAGE_SHIFT , + .access = (IB_ACCESS_LOCAL_WRITE | +IB_ACCESS_REMOTE_WRITE ), + .pool_size = fps->fps_pool_size, + .dirty_watermark = fps->fps_flush_trigger, + .flush_function =NULL , + .flush_arg =NULL , + .cache = !!fps->fps_cache + };int rc =0 ; fpo->fmr.fpo_fmr_pool = ib_create_fmr_pool(fpo->fpo_hdev->ibh_pd,
@@ -1696,7 +1697,7 @@ int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx,u64 version;int rc; - again: +again:spin_lock (&fps->fps_lock); version = fps->fps_version;list_for_each_entry (fpo, &fps->fps_pool_list, fpo_list) {
@@ -1844,8 +1845,8 @@ static void kiblnd_init_pool(struct kib_poolset *ps, struct kib_pool *pool, intmemset (pool,0 ,sizeof (*pool));INIT_LIST_HEAD (&pool->po_free_list); pool->po_deadline =ktime_get_seconds () +IBLND_POOL_DEADLINE ; - pool->po_owner = ps; - pool->po_size = size; + pool->po_owner = ps; + pool->po_size = size; }static void kiblnd_destroy_pool_list (struct list_head *head)
@@ -1900,13 +1901,13 @@ static int kiblnd_init_poolset(struct kib_poolset *ps, int cpt,memset (ps,0 ,sizeof (*ps)); - ps->ps_cpt = cpt; - ps->ps_net = net; + ps->ps_cpt = cpt; + ps->ps_net = net; ps->ps_pool_create = po_create; ps->ps_pool_destroy = po_destroy; - ps->ps_node_init = nd_init; - ps->ps_node_fini = nd_fini; - ps->ps_pool_size = size; + ps->ps_node_init = nd_init; + ps->ps_node_fini = nd_fini; + ps->ps_pool_size = size;if (strlcpy (ps->ps_name, name,sizeof (ps->ps_name)) >=sizeof (ps->ps_name))return -E2BIG ;
@@ -1971,7 +1972,7 @@ struct list_head *kiblnd_pool_alloc_node(struct kib_poolset *ps)unsigned int trips =0 ;int rc; - again: +again:spin_lock (&ps->ps_lock);list_for_each_entry (pool, &ps->ps_pool_list, po_list) {if (list_empty (&pool->po_free_list))
@@ -2286,7 +2287,7 @@ static int kiblnd_net_init_pools(struct kib_net *net, struct lnet_ni *ni, }return 0 ; - failed: +failed:kiblnd_net_fini_pools (net);LASSERT (rc);return rc;
@@ -2302,8 +2303,8 @@ static int kiblnd_hdev_get_attr(struct kib_hca_dev *hdev)* matching that of the native system */ hdev->ibh_page_shift =PAGE_SHIFT ; - hdev->ibh_page_size =1 <<PAGE_SHIFT ; - hdev->ibh_page_mask = ~((u64 )hdev->ibh_page_size -1 ); + hdev->ibh_page_size =1 <<PAGE_SHIFT ; + hdev->ibh_page_mask = ~((u64 )hdev->ibh_page_size -1 ); if (hdev->ibh_ibdev->ops.alloc_fmr && hdev->ibh_ibdev->ops.dealloc_fmr &&
@@ -2455,9 +2456,9 @@ int kiblnd_dev_failover(struct kib_dev *dev) }memset (&addr,0 ,sizeof (addr)); - addr.sin_family =AF_INET ; + addr.sin_family =AF_INET ; addr.sin_addr.s_addr =htonl (dev->ibd_ifip); - addr.sin_port =htons (*kiblnd_tunables.kib_service); + addr.sin_port =htons (*kiblnd_tunables.kib_service);/* Bind to failover device or port */ rc =rdma_bind_addr (cmid, (struct sockaddr *)&addr);
@@ -2478,8 +2479,8 @@ int kiblnd_dev_failover(struct kib_dev *dev) }atomic_set (&hdev->ibh_ref,1 ); - hdev->ibh_dev = dev; - hdev->ibh_cmid = cmid; + hdev->ibh_dev = dev; + hdev->ibh_cmid = cmid; hdev->ibh_ibdev = cmid->device; pd =ib_alloc_pd (cmid->device,0 );
@@ -2519,7 +2520,7 @@ int kiblnd_dev_failover(struct kib_dev *dev) }write_unlock_irqrestore (&kiblnd_data.kib_global_lock, flags); - out: +out:if (!list_empty (&zombie_tpo))kiblnd_destroy_pool_list (&zombie_tpo);if (!list_empty (&zombie_ppo))
@@ -2832,7 +2833,7 @@ static int kiblnd_base_startup(void)return 0 ; - failed: +failed:kiblnd_base_shutdown ();return -ENETDOWN ; }
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +307 -305
888 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +49 -50
259 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +11 -11
@@ -183,17 +183,17 @@MODULE_PARM_DESC (wrq_sge,"# scatter/gather element per work request" );struct kib_tunables kiblnd_tunables = { - .kib_dev_failover = &dev_failover, - .kib_service = &service, - .kib_cksum = &cksum, - .kib_timeout = &timeout, - .kib_keepalive = &keepalive, - .kib_default_ipif = &ipif_name, - .kib_retry_count = &retry_count, - .kib_rnr_retry_count = &rnr_retry_count, - .kib_ib_mtu = &ib_mtu, - .kib_require_priv_port = &require_privileged_port, - .kib_use_priv_port = &use_privileged_port, + .kib_dev_failover = &dev_failover, + .kib_service = &service, + .kib_cksum = &cksum, + .kib_timeout = &timeout, + .kib_keepalive = &keepalive, + .kib_default_ipif = &ipif_name, + .kib_retry_count = &retry_count, + .kib_rnr_retry_count = &rnr_retry_count, + .kib_ib_mtu = &ib_mtu, + .kib_require_priv_port = &require_privileged_port, + .kib_use_priv_port = &use_privileged_port, .kib_nscheds = &nscheds, .kib_wrq_sge = &wrq_sge, .kib_use_fastreg_gaps = &use_fastreg_gaps,
Signature · 1 line
1.8.3.1
cover lustre: cleanups with no code changes
In reply to James SimmonsQuoted 3 lines · James Simmons
192 files changed, 6805 insertions(+), 6827 deletions(-)
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud