staging: lustre: lnet: code cleanups
Subsystems (3)
v4 cover staging: lustre: lnet: code cleanups
This patch series cleans up code in staging/lustre/lnet - mostly spacing and dead function cleanup. Should apply against linux-next 20150518.
PATCH v4 1/13 staging: lustre: lnet: lnet: code cleanups - variable declarations
Unify variable declarations to use a single space, and any other obvious spacing flaws.
--- drivers/staging/lustre/lnet/lnet/acceptor.c | 32 ++-- drivers/staging/lustre/lnet/lnet/api-ni.c | 198 ++++++++++---------- drivers/staging/lustre/lnet/lnet/config.c | 238 ++++++++++++------------ drivers/staging/lustre/lnet/lnet/lib-eq.c | 42 ++-- drivers/staging/lustre/lnet/lnet/lib-md.c | 26 ++-- drivers/staging/lustre/lnet/lnet/lib-me.c | 20 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 240 ++++++++++++------------ drivers/staging/lustre/lnet/lnet/lib-msg.c | 50 +++--- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 116 ++++++------ drivers/staging/lustre/lnet/lnet/lo.c | 2 +- drivers/staging/lustre/lnet/lnet/module.c | 8 +- drivers/staging/lustre/lnet/lnet/peer.c | 50 +++--- drivers/staging/lustre/lnet/lnet/router.c | 224 +++++++++++----------- drivers/staging/lustre/lnet/lnet/router_proc.c | 210 +++++++++++----------- 14 files changed, 728 insertions(+), 728 deletions(-)
drivers/staging/lustre/lnet/lnet/acceptor.c +16 -16
@@ -143,10 +143,10 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, __u32 local_ip, __u32 peer_ip, int peer_port) { lnet_acceptor_connreq_t cr; -struct socket *sock; -int rc; -int port; -int fatal; +struct socket *sock; +int rc; +int port; +int fatal;CLASSERT (sizeof (cr) <=16 );/* not too big to be on the stack */
@@ -211,12 +211,12 @@ static int lnet_accept(struct socket *sock, __u32 magic) {lnet_acceptor_connreq_t cr; -__u32 peer_ip; -int peer_port; -int rc; -int flip; -lnet_ni_t *ni; -char *str; +__u32 peer_ip; +int peer_port; +int rc; +int flip; +lnet_ni_t *ni; +char *str;LASSERT (sizeof (cr) <=16 );/* not too big for the stack */
@@ -333,11 +333,11 @@ static int lnet_acceptor(void *arg) {struct socket *newsock; -int rc; -__u32 magic; -__u32 peer_ip; -int peer_port; -int secure = (int )((long_ptr_t )arg); +int rc; +__u32 magic; +__u32 peer_ip; +int peer_port; +int secure = (int )((long_ptr_t )arg);LASSERT (lnet_acceptor_state.pta_sock =NULL );
@@ -444,7 +444,7 @@ accept2secure(const char *acc, long *sec)int lnet_acceptor_start (void ) { -int rc; +int rc;long rc2;long secure;
drivers/staging/lustre/lnet/lnet/api-ni.c +99 -99
403 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/config.c +119 -119
381 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-eq.c +21 -21
78 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-md.c +13 -13
@@ -74,7 +74,7 @@ lnet_md_unlink(lnet_libmd_t *md)CDEBUG (D_NET ,"Unlinking md %p\n" , md);if (md->md_eq !=NULL ) { -int cpt =lnet_cpt_of_cookie (md->md_lh.lh_cookie); +int cpt =lnet_cpt_of_cookie (md->md_lh.lh_cookie);LASSERT (*md->md_eq->eq_refs[cpt] >0 ); (*md->md_eq->eq_refs[cpt])--;
@@ -88,9 +88,9 @@ lnet_md_unlink(lnet_libmd_t *md)static int lnet_md_build (lnet_libmd_t *lmd,lnet_md_t *umd,int unlink) { -int i; +int i;unsigned int niov; -int total_length =0 ; +int total_length =0 ; lmd->md_me =NULL ; lmd->md_start = umd->start;
@@ -268,10 +268,10 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, {LIST_HEAD (matches);LIST_HEAD (drops); -struct lnet_me *me; -struct lnet_libmd *md; -int cpt; -int rc; +struct lnet_me *me; +struct lnet_libmd *md; +int cpt; +int rc;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -346,9 +346,9 @@ EXPORT_SYMBOL(LNetMDAttach);int LNetMDBind (lnet_md_t umd,lnet_unlink_t unlink,lnet_handle_md_t *handle) { -lnet_libmd_t *md; -int cpt; -int rc; +lnet_libmd_t *md; +int cpt; +int rc;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -421,9 +421,9 @@ EXPORT_SYMBOL(LNetMDBind);int LNetMDUnlink (lnet_handle_md_t mdh) { -lnet_event_t ev; -lnet_libmd_t *md; -int cpt; +lnet_event_t ev; +lnet_libmd_t *md; +int cpt;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
drivers/staging/lustre/lnet/lnet/lib-me.c +10 -10
@@ -80,8 +80,8 @@ LNetMEAttach(unsigned int portal, lnet_handle_me_t *handle) {struct lnet_match_table *mtable; -struct lnet_me *me; -struct list_head *head; +struct lnet_me *me; +struct list_head *head;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -151,10 +151,10 @@ LNetMEInsert(lnet_handle_me_t current_meh, lnet_unlink_t unlink, lnet_ins_pos_t pos, lnet_handle_me_t *handle) { - struct lnet_me *current_me; -struct lnet_me *new_me; -struct lnet_portal *ptl; -int cpt; + struct lnet_me *current_me; +struct lnet_me *new_me; +struct lnet_portal *ptl; +int cpt;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -228,10 +228,10 @@ EXPORT_SYMBOL(LNetMEInsert);int LNetMEUnlink (lnet_handle_me_t meh) { -lnet_me_t *me; -lnet_libmd_t *md; -lnet_event_t ev; -int cpt; +lnet_me_t *me; +lnet_libmd_t *md; +lnet_event_t ev; +int cpt;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
drivers/staging/lustre/lnet/lnet/lib-move.c +120 -120
448 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-msg.c +25 -25
134 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-ptl.c +58 -58
252 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lo.c +1 -1
@@ -111,7 +111,7 @@ lnd_t the_lolnd = {/* .lnd_type = */ LOLND ,/* .lnd_startup = */ lolnd_startup,/* .lnd_shutdown = */ lolnd_shutdown, -/* .lnt_ctl = */ NULL , +/* .lnt_ctl = */ NULL ,/* .lnd_send = */ lolnd_send,/* .lnd_recv = */ lolnd_recv, /* .lnd_eager_recv = */ NULL,
drivers/staging/lustre/lnet/lnet/module.c +4 -4
@@ -47,7 +47,7 @@ static int lnet_configure(void *arg) {/* 'arg' only there so I can be passed to cfs_create_thread() */ -int rc =0 ; +int rc =0 ;LNET_MUTEX_LOCK (&lnet_config_mutex);
@@ -66,7 +66,7 @@ lnet_configure(void *arg)static int lnet_unconfigure (void ) { -int refcount; +int refcount;LNET_MUTEX_LOCK (&lnet_config_mutex);
@@ -86,7 +86,7 @@ lnet_unconfigure(void)static int lnet_ioctl (unsigned int cmd,struct libcfs_ioctl_data *data) { -int rc; +int rc;switch (cmd) {case IOC_LIBCFS_CONFIGURE :
@@ -113,7 +113,7 @@ static DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl);static int __init init_lnet (void ) { -int rc; +int rc;mutex_init (&lnet_config_mutex);
drivers/staging/lustre/lnet/lnet/peer.c +24 -24
95 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router.c +112 -112
440 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router_proc.c +105 -105
340 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 1/13 staging: lustre: lnet: lnet: code cleanups - variable declarations
In reply to Mike ShueyUnify variable declarations to use a single space, and any other obvious spacing flaws.
--- drivers/staging/lustre/lnet/lnet/acceptor.c | 32 ++-- drivers/staging/lustre/lnet/lnet/api-ni.c | 198 ++++++++++---------- drivers/staging/lustre/lnet/lnet/config.c | 238 ++++++++++++------------ drivers/staging/lustre/lnet/lnet/lib-eq.c | 42 ++-- drivers/staging/lustre/lnet/lnet/lib-md.c | 26 ++-- drivers/staging/lustre/lnet/lnet/lib-me.c | 20 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 240 ++++++++++++------------ drivers/staging/lustre/lnet/lnet/lib-msg.c | 50 +++--- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 116 ++++++------ drivers/staging/lustre/lnet/lnet/lo.c | 2 +- drivers/staging/lustre/lnet/lnet/module.c | 8 +- drivers/staging/lustre/lnet/lnet/peer.c | 50 +++--- drivers/staging/lustre/lnet/lnet/router.c | 224 +++++++++++----------- drivers/staging/lustre/lnet/lnet/router_proc.c | 210 +++++++++++----------- 14 files changed, 728 insertions(+), 728 deletions(-)
drivers/staging/lustre/lnet/lnet/acceptor.c +16 -16
@@ -143,10 +143,10 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, __u32 local_ip, __u32 peer_ip, int peer_port) { lnet_acceptor_connreq_t cr; -struct socket *sock; -int rc; -int port; -int fatal; +struct socket *sock; +int rc; +int port; +int fatal;CLASSERT (sizeof (cr) <=16 );/* not too big to be on the stack */
@@ -211,12 +211,12 @@ static int lnet_accept(struct socket *sock, __u32 magic) {lnet_acceptor_connreq_t cr; -__u32 peer_ip; -int peer_port; -int rc; -int flip; -lnet_ni_t *ni; -char *str; +__u32 peer_ip; +int peer_port; +int rc; +int flip; +lnet_ni_t *ni; +char *str;LASSERT (sizeof (cr) <=16 );/* not too big for the stack */
@@ -333,11 +333,11 @@ static int lnet_acceptor(void *arg) {struct socket *newsock; -int rc; -__u32 magic; -__u32 peer_ip; -int peer_port; -int secure = (int )((long_ptr_t )arg); +int rc; +__u32 magic; +__u32 peer_ip; +int peer_port; +int secure = (int )((long_ptr_t )arg);LASSERT (lnet_acceptor_state.pta_sock =NULL );
@@ -444,7 +444,7 @@ accept2secure(const char *acc, long *sec)int lnet_acceptor_start (void ) { -int rc; +int rc;long rc2;long secure;
drivers/staging/lustre/lnet/lnet/api-ni.c +99 -99
403 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/config.c +119 -119
381 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-eq.c +21 -21
78 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-md.c +13 -13
@@ -74,7 +74,7 @@ lnet_md_unlink(lnet_libmd_t *md)CDEBUG (D_NET ,"Unlinking md %p\n" , md);if (md->md_eq !=NULL ) { -int cpt =lnet_cpt_of_cookie (md->md_lh.lh_cookie); +int cpt =lnet_cpt_of_cookie (md->md_lh.lh_cookie);LASSERT (*md->md_eq->eq_refs[cpt] >0 ); (*md->md_eq->eq_refs[cpt])--;
@@ -88,9 +88,9 @@ lnet_md_unlink(lnet_libmd_t *md)static int lnet_md_build (lnet_libmd_t *lmd,lnet_md_t *umd,int unlink) { -int i; +int i;unsigned int niov; -int total_length =0 ; +int total_length =0 ; lmd->md_me =NULL ; lmd->md_start = umd->start;
@@ -268,10 +268,10 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, {LIST_HEAD (matches);LIST_HEAD (drops); -struct lnet_me *me; -struct lnet_libmd *md; -int cpt; -int rc; +struct lnet_me *me; +struct lnet_libmd *md; +int cpt; +int rc;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -346,9 +346,9 @@ EXPORT_SYMBOL(LNetMDAttach);int LNetMDBind (lnet_md_t umd,lnet_unlink_t unlink,lnet_handle_md_t *handle) { -lnet_libmd_t *md; -int cpt; -int rc; +lnet_libmd_t *md; +int cpt; +int rc;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -421,9 +421,9 @@ EXPORT_SYMBOL(LNetMDBind);int LNetMDUnlink (lnet_handle_md_t mdh) { -lnet_event_t ev; -lnet_libmd_t *md; -int cpt; +lnet_event_t ev; +lnet_libmd_t *md; +int cpt;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
drivers/staging/lustre/lnet/lnet/lib-me.c +10 -10
@@ -80,8 +80,8 @@ LNetMEAttach(unsigned int portal, lnet_handle_me_t *handle) {struct lnet_match_table *mtable; -struct lnet_me *me; -struct list_head *head; +struct lnet_me *me; +struct list_head *head;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -151,10 +151,10 @@ LNetMEInsert(lnet_handle_me_t current_meh, lnet_unlink_t unlink, lnet_ins_pos_t pos, lnet_handle_me_t *handle) { - struct lnet_me *current_me; -struct lnet_me *new_me; -struct lnet_portal *ptl; -int cpt; + struct lnet_me *current_me; +struct lnet_me *new_me; +struct lnet_portal *ptl; +int cpt;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -228,10 +228,10 @@ EXPORT_SYMBOL(LNetMEInsert);int LNetMEUnlink (lnet_handle_me_t meh) { -lnet_me_t *me; -lnet_libmd_t *md; -lnet_event_t ev; -int cpt; +lnet_me_t *me; +lnet_libmd_t *md; +lnet_event_t ev; +int cpt;LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
drivers/staging/lustre/lnet/lnet/lib-move.c +120 -120
448 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-msg.c +25 -25
134 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-ptl.c +58 -58
252 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lo.c +1 -1
@@ -111,7 +111,7 @@ lnd_t the_lolnd = {/* .lnd_type = */ LOLND ,/* .lnd_startup = */ lolnd_startup,/* .lnd_shutdown = */ lolnd_shutdown, -/* .lnt_ctl = */ NULL , +/* .lnt_ctl = */ NULL ,/* .lnd_send = */ lolnd_send,/* .lnd_recv = */ lolnd_recv, /* .lnd_eager_recv = */ NULL,
drivers/staging/lustre/lnet/lnet/module.c +4 -4
@@ -47,7 +47,7 @@ static int lnet_configure(void *arg) {/* 'arg' only there so I can be passed to cfs_create_thread() */ -int rc =0 ; +int rc =0 ;LNET_MUTEX_LOCK (&lnet_config_mutex);
@@ -66,7 +66,7 @@ lnet_configure(void *arg)static int lnet_unconfigure (void ) { -int refcount; +int refcount;LNET_MUTEX_LOCK (&lnet_config_mutex);
@@ -86,7 +86,7 @@ lnet_unconfigure(void)static int lnet_ioctl (unsigned int cmd,struct libcfs_ioctl_data *data) { -int rc; +int rc;switch (cmd) {case IOC_LIBCFS_CONFIGURE :
@@ -113,7 +113,7 @@ static DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl);static int __init init_lnet (void ) { -int rc; +int rc;mutex_init (&lnet_config_mutex);
drivers/staging/lustre/lnet/lnet/peer.c +24 -24
95 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router.c +112 -112
440 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router_proc.c +105 -105
340 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 2/13 staging: lustre: lnet: dead code - remove lnet_fini_locks
In reply to Mike Shueylnet_fini_locks() does nothing. Remove.
--- drivers/staging/lustre/lnet/lnet/api-ni.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/staging/lustre/lnet/lnet/api-ni.c +0 -8
@@ -98,12 +98,6 @@ lnet_init_locks(void)mutex_init (&the_lnet.ln_api_mutex); } -static void -lnet_fini_locks (void ) -{ -} - -static int lnet_create_remote_nets_table (void ) {
@@ -153,8 +147,6 @@ lnet_destroy_locks(void)cfs_percpt_lock_free (the_lnet.ln_net_lock); the_lnet.ln_net_lock =NULL ; } - -lnet_fini_locks (); } static int
Signature · 1 line
1.7.1
PATCH v4 2/13 staging: lustre: lnet: dead code - remove lnet_fini_locks
In reply to Mike Shueylnet_fini_locks() does nothing. Remove.
--- drivers/staging/lustre/lnet/lnet/api-ni.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/staging/lustre/lnet/lnet/api-ni.c +0 -8
@@ -98,12 +98,6 @@ lnet_init_locks(void)mutex_init (&the_lnet.ln_api_mutex); } -static void -lnet_fini_locks (void ) -{ -} - -static int lnet_create_remote_nets_table (void ) {
@@ -153,8 +147,6 @@ lnet_destroy_locks(void)cfs_percpt_lock_free (the_lnet.ln_net_lock); the_lnet.ln_net_lock =NULL ; } - -lnet_fini_locks (); } static int
Signature · 1 line
1.7.1
PATCH v4 3/13 staging: lustre: lnet: dead code - remove LNetSetAsync
In reply to Mike ShueyLNetSetAsync() returns 0, and is never called. Doesn't exist in the Intel tree, either. Remove it.
--- drivers/staging/lustre/include/linux/lnet/api.h | 1 - drivers/staging/lustre/lnet/lnet/lib-move.c | 24 ----------------------- 2 files changed, 0 insertions(+), 25 deletions(-)
drivers/staging/lustre/include/linux/lnet/api.h +0 -1
@@ -209,7 +209,6 @@ int LNetGet(lnet_nid_t self,int LNetSetLazyPortal (int portal);int LNetClearLazyPortal (int portal);int LNetCtl (unsigned int cmd,void *arg); -int LNetSetAsync (lnet_process_id_t id,int nasync);/** @} lnet_misc */
drivers/staging/lustre/lnet/lnet/lib-move.c +0 -24
@@ -2434,27 +2434,3 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp)return -EHOSTUNREACH ; }EXPORT_SYMBOL (LNetDist); - -/** -* Set the number of asynchronous messages expected from a target process. -* -* This function is only meaningful for userspace callers. It's a no-op when -* called from kernel. -* -* Asynchronous messages are those that can come from a target when the -* userspace process is not waiting for IO to complete; e.g., AST callbacks -* from Lustre servers. Specifying the expected number of such messages -* allows them to be eagerly received when user process is not running in -* LNet; otherwise network errors may occur. -* -* \param id Process ID of the target process. -* \param nasync Number of asynchronous messages expected from the target. -* -* \return 0 on success, and an error code otherwise. -*/ -int -LNetSetAsync (lnet_process_id_t id,int nasync) -{ -return 0 ; -} -EXPORT_SYMBOL (LNetSetAsync);
Signature · 1 line
1.7.1
PATCH v4 3/13 staging: lustre: lnet: dead code - remove LNetSetAsync
In reply to Mike ShueyLNetSetAsync() returns 0, and is never called. Doesn't exist in the Intel tree, either. Remove it.
--- drivers/staging/lustre/include/linux/lnet/api.h | 1 - drivers/staging/lustre/lnet/lnet/lib-move.c | 24 ----------------------- 2 files changed, 0 insertions(+), 25 deletions(-)
drivers/staging/lustre/include/linux/lnet/api.h +0 -1
@@ -209,7 +209,6 @@ int LNetGet(lnet_nid_t self,int LNetSetLazyPortal (int portal);int LNetClearLazyPortal (int portal);int LNetCtl (unsigned int cmd,void *arg); -int LNetSetAsync (lnet_process_id_t id,int nasync);/** @} lnet_misc */
drivers/staging/lustre/lnet/lnet/lib-move.c +0 -24
@@ -2434,27 +2434,3 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp)return -EHOSTUNREACH ; }EXPORT_SYMBOL (LNetDist); - -/** -* Set the number of asynchronous messages expected from a target process. -* -* This function is only meaningful for userspace callers. It's a no-op when -* called from kernel. -* -* Asynchronous messages are those that can come from a target when the -* userspace process is not waiting for IO to complete; e.g., AST callbacks -* from Lustre servers. Specifying the expected number of such messages -* allows them to be eagerly received when user process is not running in -* LNet; otherwise network errors may occur. -* -* \param id Process ID of the target process. -* \param nasync Number of asynchronous messages expected from the target. -* -* \return 0 on success, and an error code otherwise. -*/ -int -LNetSetAsync (lnet_process_id_t id,int nasync) -{ -return 0 ; -} -EXPORT_SYMBOL (LNetSetAsync);
Signature · 1 line
1.7.1
PATCH v4 4/13 staging: lustre: lnet: lnet: Module is LNet, not Portals
In reply to Mike ShueyFix the module version to match upstream development.
--- drivers/staging/lustre/lnet/lnet/module.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lnet/lnet/module.c +1 -1
@@ -147,7 +147,7 @@ fini_lnet(void) }MODULE_AUTHOR ("Peter J. Braam <[email protected]>" ); -MODULE_DESCRIPTION ("Portals v3.1" ); +MODULE_DESCRIPTION ("LNet v3.1" );MODULE_LICENSE ("GPL" );MODULE_VERSION ("1.0.0" );
Signature · 1 line
1.7.1
PATCH v4 4/13 staging: lustre: lnet: lnet: Module is LNet, not Portals
In reply to Mike ShueyFix the module version to match upstream development.
--- drivers/staging/lustre/lnet/lnet/module.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/lustre/lnet/lnet/module.c +1 -1
@@ -147,7 +147,7 @@ fini_lnet(void) }MODULE_AUTHOR ("Peter J. Braam <[email protected]>" ); -MODULE_DESCRIPTION ("Portals v3.1" ); +MODULE_DESCRIPTION ("LNet v3.1" );MODULE_LICENSE ("GPL" );MODULE_VERSION ("1.0.0" );
Signature · 1 line
1.7.1
PATCH v4 5/13 staging: lustre: lnet: o2iblnd: code cleanup - align whitespace
In reply to Mike ShueyUnify variable declarations to use a single whitespace. Also line up declarations and comments in o2iblnd.h.
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 458 +++++++------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 680 ++++++++++---------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 484 +++++++------- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 48 +- 4 files changed, 841 insertions(+), 829 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +227 -231
@@ -42,21 +42,21 @@#include <asm/div64.h> static lnd_t the_o2iblnd = { - .lnd_type =O2IBLND , - .lnd_startup = kiblnd_startup, - .lnd_shutdown = kiblnd_shutdown, - .lnd_ctl = kiblnd_ctl, - .lnd_query = kiblnd_query, - .lnd_send = kiblnd_send, - .lnd_recv = kiblnd_recv, + .lnd_type =O2IBLND , + .lnd_startup = kiblnd_startup, + .lnd_shutdown = kiblnd_shutdown, + .lnd_ctl = kiblnd_ctl, + .lnd_query = kiblnd_query, + .lnd_send = kiblnd_send, + .lnd_recv = kiblnd_recv, }; -kib_data_t kiblnd_data; +kib_data_t kiblnd_data;static __u32 kiblnd_cksum (void *ptr,int nob) { -char *c = ptr; -__u32 sum =0 ; +char *c = ptr; +__u32 sum =0 ;while (nob-- >0 ) sum = ((sum <<1 ) | (sum >>31 )) + *c++;
@@ -138,10 +138,10 @@ static int kiblnd_msgtype2size(int type)static int kiblnd_unpack_rd (kib_msg_t *msg,int flip) { -kib_rdma_desc_t *rd; -int nob; -int n; -int i; +kib_rdma_desc_t *rd; +int nob; +int n; +int i;LASSERT (msg->ibm_type =IBLND_MSG_GET_REQ || msg->ibm_type =IBLND_MSG_PUT_ACK );
@@ -210,10 +210,10 @@ void kiblnd_pack_msg(lnet_ni_t *ni, kib_msg_t *msg, int version,int kiblnd_unpack_msg (kib_msg_t *msg,int nob) {const int hdr_size = offsetof(kib_msg_t , ibm_u); -__u32 msg_cksum; -__u16 version; -int msg_nob; -int flip; +__u32 msg_cksum; +__u16 version; +int msg_nob; +int flip;/* 6 bytes are enough to have received magic + version */ if (nob <6 ) {
@@ -320,10 +320,10 @@ int kiblnd_unpack_msg(kib_msg_t *msg, int nob)int kiblnd_create_peer (lnet_ni_t *ni,kib_peer_t **peerp,lnet_nid_t nid) { -kib_peer_t *peer; -kib_net_t *net = ni->ni_data; -int cpt =lnet_cpt_of_nid (nid); -unsigned long flags; +kib_peer_t *peer; +kib_net_t *net = ni->ni_data; +int cpt =lnet_cpt_of_nid (nid); +unsigned long flags;LASSERT (net !=NULL );LASSERT (nid !=LNET_NID_ANY );
@@ -385,9 +385,9 @@ kib_peer_t *kiblnd_find_peer_locked(lnet_nid_t nid) {/* the caller is responsible for accounting the additional reference * that this creates */ -struct list_head *peer_list =kiblnd_nid2peerlist (nid); -struct list_head *tmp; -kib_peer_t *peer; +struct list_head *peer_list =kiblnd_nid2peerlist (nid); +struct list_head *tmp; +kib_peer_t *peer;list_for_each (tmp, peer_list) {
@@ -422,10 +422,10 @@ void kiblnd_unlink_peer_locked(kib_peer_t *peer)static int kiblnd_get_peer_info (lnet_ni_t *ni,int index,lnet_nid_t *nidp,int *count) { -kib_peer_t *peer; -struct list_head *ptmp; -int i; -unsigned long flags; +kib_peer_t *peer; +struct list_head *ptmp; +int i; +unsigned long flags;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -459,9 +459,9 @@ static int kiblnd_get_peer_info(lnet_ni_t *ni, int index,static void kiblnd_del_peer_locked (kib_peer_t *peer) { -struct list_head *ctmp; -struct list_head *cnxt; -kib_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt; +kib_conn_t *conn;if (list_empty (&peer->ibp_conns)) {kiblnd_unlink_peer_locked (peer);
@@ -480,14 +480,14 @@ static void kiblnd_del_peer_locked(kib_peer_t *peer)static int kiblnd_del_peer (lnet_ni_t *ni,lnet_nid_t nid) {LIST_HEAD (zombies); -struct list_head *ptmp; -struct list_head *pnxt; -kib_peer_t *peer; -int lo; -int hi; -int i; -unsigned long flags; -int rc = -ENOENT ; +struct list_head *ptmp; +struct list_head *pnxt; +kib_peer_t *peer; +int lo; +int hi; +int i; +unsigned long flags; +int rc = -ENOENT ;write_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -532,12 +532,12 @@ static int kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid)static kib_conn_t *kiblnd_get_conn_by_idx (lnet_ni_t *ni,int index) { -kib_peer_t *peer; -struct list_head *ptmp; -kib_conn_t *conn; -struct list_head *ctmp; -int i; -unsigned long flags; +kib_peer_t *peer; +struct list_head *ptmp; +kib_conn_t *conn; +struct list_head *ctmp; +int i; +unsigned long flags;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -593,7 +593,7 @@ int kiblnd_translate_mtu(int value)static void kiblnd_setup_mtu_locked (struct rdma_cm_id *cmid) { -int mtu; +int mtu;/* XXX There is no path record for iWARP, set by netdev->change_mtu? */ if (cmid->route.path_rec =NULL )
@@ -607,11 +607,11 @@ static void kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid)static int kiblnd_get_completion_vector (kib_conn_t *conn,int cpt) { -cpumask_t *mask; -int vectors; -int off; -int i; -lnet_nid_t nid = conn->ibc_peer->ibp_nid; +cpumask_t *mask; +int vectors; +int off; +int i; +lnet_nid_t nid = conn->ibc_peer->ibp_nid; vectors = conn->ibc_cmid->device->num_comp_vectors;if (vectors <=1 )
@@ -642,17 +642,17 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,* she must dispose of 'cmid'. (Actually I'd block forever if I tried * to destroy 'cmid' here since I'm called from the CM which still has * its ref on 'cmid'). */ -rwlock_t *glock = &kiblnd_data.kib_global_lock; -kib_net_t *net = peer->ibp_ni->ni_data; -kib_dev_t *dev; +rwlock_t *glock = &kiblnd_data.kib_global_lock; +kib_net_t *net = peer->ibp_ni->ni_data; +kib_dev_t *dev;struct ib_qp_init_attr *init_qp_attr; -struct kib_sched_info *sched; -kib_conn_t *conn; -struct ib_cq *cq; -unsigned long flags; -int cpt; -int rc; -int i; +struct kib_sched_info *sched; +kib_conn_t *conn; +struct ib_cq *cq; +unsigned long flags; +int cpt; +int rc; +int i;LASSERT (net !=NULL );LASSERT (!in_interrupt ());
@@ -837,8 +837,8 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,void kiblnd_destroy_conn (kib_conn_t *conn) {struct rdma_cm_id *cmid = conn->ibc_cmid; -kib_peer_t *peer = conn->ibc_peer; -int rc; +kib_peer_t *peer = conn->ibc_peer; +int rc;LASSERT (!in_interrupt ());LASSERT (atomic_read (&conn->ibc_refcount) =0 );
@@ -904,10 +904,10 @@ void kiblnd_destroy_conn(kib_conn_t *conn)int kiblnd_close_peer_conns_locked (kib_peer_t *peer,int why) { -kib_conn_t *conn; -struct list_head *ctmp; -struct list_head *cnxt; -int count =0 ; +kib_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt; +int count =0 ;list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { conn =list_entry (ctmp, kib_conn_t, ibc_list);
@@ -926,10 +926,10 @@ int kiblnd_close_peer_conns_locked(kib_peer_t *peer, int why)int kiblnd_close_stale_conns_locked (kib_peer_t *peer,int version,__u64 incarnation) { -kib_conn_t *conn; -struct list_head *ctmp; -struct list_head *cnxt; -int count =0 ; +kib_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt; +int count =0 ;list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { conn =list_entry (ctmp, kib_conn_t, ibc_list);
@@ -953,14 +953,14 @@ int kiblnd_close_stale_conns_locked(kib_peer_t *peer,static int kiblnd_close_matching_conns (lnet_ni_t *ni,lnet_nid_t nid) { -kib_peer_t *peer; -struct list_head *ptmp; -struct list_head *pnxt; -int lo; -int hi; -int i; -unsigned long flags; -int count =0 ; +kib_peer_t *peer; +struct list_head *ptmp; +struct list_head *pnxt; +int lo; +int hi; +int i; +unsigned long flags; +int count =0 ;write_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -1001,17 +1001,17 @@ static int kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid)int kiblnd_ctl (lnet_ni_t *ni,unsigned int cmd,void *arg) {struct libcfs_ioctl_data *data = arg; -int rc = -EINVAL ; +int rc = -EINVAL ;switch (cmd) {case IOC_LIBCFS_GET_PEER : { -lnet_nid_t nid =0 ; -int count =0 ; +lnet_nid_t nid =0 ; +int count =0 ; rc =kiblnd_get_peer_info (ni, data->ioc_count, &nid, &count); - data->ioc_nid = nid; - data->ioc_count = count; + data->ioc_nid = nid; + data->ioc_count = count;break ; }
@@ -1053,11 +1053,11 @@ int kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)void kiblnd_query (lnet_ni_t *ni,lnet_nid_t nid,unsigned long *when) { -unsigned long last_alive =0 ; -unsigned long now =cfs_time_current (); -rwlock_t *glock = &kiblnd_data.kib_global_lock; -kib_peer_t *peer; -unsigned long flags; +unsigned long last_alive =0 ; +unsigned long now =cfs_time_current (); +rwlock_t *glock = &kiblnd_data.kib_global_lock; +kib_peer_t *peer; +unsigned long flags;read_lock_irqsave (glock, flags);
@@ -1086,8 +1086,8 @@ void kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)void kiblnd_free_pages (kib_pages_t *p) { -int npages = p->ibp_npages; -int i; +int npages = p->ibp_npages; +int i;for (i =0 ; i < npages; i++) {if (p->ibp_pages[i] !=NULL )
@@ -1099,8 +1099,8 @@ void kiblnd_free_pages(kib_pages_t *p)int kiblnd_alloc_pages (kib_pages_t **pp,int cpt,int npages) { -kib_pages_t *p; -int i; +kib_pages_t *p; +int i;LIBCFS_CPT_ALLOC (p,lnet_cpt_table (), cpt, offsetof(kib_pages_t, ibp_pages[npages]));
@@ -1130,7 +1130,7 @@ int kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages)void kiblnd_unmap_rx_descs (kib_conn_t *conn) {kib_rx_t *rx; -int i; +int i;LASSERT (conn->ibc_rxs !=NULL );LASSERT (conn->ibc_hdev !=NULL );
@@ -1153,14 +1153,13 @@ void kiblnd_unmap_rx_descs(kib_conn_t *conn)void kiblnd_map_rx_descs (kib_conn_t *conn) { -kib_rx_t *rx; -struct page *pg; -int pg_off; -int ipg; -int i; +kib_rx_t *rx; +struct page *pg; +int pg_off; +int ipg; +int i; -for (pg_off = ipg = i =0 ; - i <IBLND_RX_MSGS (conn->ibc_version); i++) { +for (pg_off = ipg = i =0 ; i <IBLND_RX_MSGS (conn->ibc_version); i++) { pg = conn->ibc_rx_pages->ibp_pages[ipg]; rx = &conn->ibc_rxs[i];
@@ -1192,9 +1191,9 @@ void kiblnd_map_rx_descs(kib_conn_t *conn)static void kiblnd_unmap_tx_pool (kib_tx_pool_t *tpo) { -kib_hca_dev_t *hdev = tpo->tpo_hdev; -kib_tx_t *tx; -int i; +kib_hca_dev_t *hdev = tpo->tpo_hdev; +kib_tx_t *tx; +int i;LASSERT (tpo->tpo_pool.po_allocated =0 );
@@ -1216,8 +1215,8 @@ static void kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo)static kib_hca_dev_t *kiblnd_current_hdev (kib_dev_t *dev) {kib_hca_dev_t *hdev; -unsigned long flags; -int i =0 ; +unsigned long flags; +int i =0 ;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);while (dev->ibd_failover) {
@@ -1240,15 +1239,15 @@ static kib_hca_dev_t *kiblnd_current_hdev(kib_dev_t *dev)static void kiblnd_map_tx_pool (kib_tx_pool_t *tpo) { -kib_pages_t *txpgs = tpo->tpo_tx_pages; -kib_pool_t *pool = &tpo->tpo_pool; -kib_net_t *net = pool->po_owner->ps_net; -kib_dev_t *dev; -struct page *page; -kib_tx_t *tx; -int page_offset; -int ipage; -int i; +kib_pages_t *txpgs = tpo->tpo_tx_pages; +kib_pool_t *pool = &tpo->tpo_pool; +kib_net_t *net = pool->po_owner->ps_net; +kib_dev_t *dev; +struct page *page; +kib_tx_t *tx; +int page_offset; +int ipage; +int i;LASSERT (net !=NULL );
@@ -1291,7 +1290,7 @@ static void kiblnd_map_tx_pool(kib_tx_pool_t *tpo)struct ib_mr *kiblnd_find_dma_mr (kib_hca_dev_t *hdev,__u64 addr,__u64 size) { -__u64 index; +__u64 index;LASSERT (hdev->ibh_mrs[0 ] !=NULL );
@@ -1311,7 +1310,7 @@ struct ib_mr *kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) {struct ib_mr *prev_mr;struct ib_mr *mr; -int i; +int i;LASSERT (hdev->ibh_mrs[0 ] !=NULL );
@@ -1382,18 +1381,18 @@ static int kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo) {/* FMR pool for RDMA */ -kib_dev_t *dev = fps->fps_net->ibn_dev; -kib_fmr_pool_t *fpo; +kib_dev_t *dev = fps->fps_net->ibn_dev; +kib_fmr_pool_t *fpo;struct ib_fmr_pool_param param = { .max_pages_per_fmr =LNET_MAX_PAYLOAD /PAGE_SIZE , - .page_shift =PAGE_SHIFT , - .access = (IB_ACCESS_LOCAL_WRITE | -IB_ACCESS_REMOTE_WRITE ), - .pool_size = fps->fps_pool_size, + .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 = !!*kiblnd_tunables.kib_fmr_cache}; + .flush_arg =NULL , + .cache = !!*kiblnd_tunables.kib_fmr_cache};int rc;LIBCFS_CPT_ALLOC (fpo,lnet_cpt_table (), fps->fps_cpt,sizeof (*fpo));
@@ -1454,7 +1453,7 @@ static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, int flush_trigger) {kib_fmr_pool_t *fpo; -int rc; +int rc;memset (fps,0 ,sizeof (kib_fmr_poolset_t));
@@ -1485,11 +1484,11 @@ static int kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now)void kiblnd_fmr_pool_unmap (kib_fmr_t *fmr,int status) {LIST_HEAD (zombies); -kib_fmr_pool_t *fpo = fmr->fmr_pool; +kib_fmr_pool_t *fpo = fmr->fmr_pool;kib_fmr_poolset_t *fps = fpo->fpo_owner; -unsigned long now =cfs_time_current (); -kib_fmr_pool_t *tmp; -int rc; +unsigned long now =cfs_time_current (); +kib_fmr_pool_t *tmp; +int rc; rc =ib_fmr_pool_unmap (fmr->fmr_pfmr);LASSERT (rc =0 );
@@ -1525,9 +1524,9 @@ int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, __u64 iov, kib_fmr_t *fmr) { struct ib_pool_fmr *pfmr; -kib_fmr_pool_t *fpo; -__u64 version; -int rc; +kib_fmr_pool_t *fpo; +__u64 version; +int rc; again:spin_lock (&fps->fps_lock);
@@ -1658,13 +1657,13 @@ static int kiblnd_init_poolset(kib_poolset_t *ps, int cpt, kib_ps_node_init_t nd_init, kib_ps_node_fini_t nd_fini) { -kib_pool_t *pool; -int rc; +kib_pool_t *pool; +int rc;memset (ps,0 ,sizeof (kib_poolset_t)); - 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;
@@ -1698,9 +1697,9 @@ static int kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now)void kiblnd_pool_free_node (kib_pool_t *pool,struct list_head *node) {LIST_HEAD (zombies); -kib_poolset_t *ps = pool->po_owner; -kib_pool_t *tmp; -unsigned long now =cfs_time_current (); +kib_poolset_t *ps = pool->po_owner; +kib_pool_t *tmp; +unsigned long now =cfs_time_current ();spin_lock (&ps->ps_lock);
@@ -1727,9 +1726,9 @@ void kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node)struct list_head *kiblnd_pool_alloc_node (kib_poolset_t *ps) { -struct list_head *node; -kib_pool_t *pool; -int rc; +struct list_head *node; +kib_pool_t *pool; +int rc; again:spin_lock (&ps->ps_lock);
@@ -1789,8 +1788,8 @@ struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps)void kiblnd_pmr_pool_unmap (kib_phys_mr_t *pmr) { -kib_pmr_pool_t *ppo = pmr->pmr_pool; -struct ib_mr *mr = pmr->pmr_mr; +kib_pmr_pool_t *ppo = pmr->pmr_pool; +struct ib_mr *mr = pmr->pmr_mr; pmr->pmr_mr =NULL ;kiblnd_pool_free_node (&ppo->ppo_pool, &pmr->pmr_list);
@@ -1802,9 +1801,9 @@ int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr) {kib_phys_mr_t *pmr; -struct list_head *node; -int rc; -int i; +struct list_head *node; +int rc; +int i; node =kiblnd_pool_alloc_node (&pps->pps_poolset);if (node =NULL ) {
@@ -1846,7 +1845,7 @@ int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev,static void kiblnd_destroy_pmr_pool (kib_pool_t *pool) {kib_pmr_pool_t *ppo =container_of (pool, kib_pmr_pool_t, ppo_pool); -kib_phys_mr_t *pmr; +kib_phys_mr_t *pmr;kib_phys_mr_t *tmp;LASSERT (pool->po_allocated =0 );
@@ -1881,10 +1880,10 @@ static inline int kiblnd_pmr_pool_size(int ncpts)static int kiblnd_create_pmr_pool (kib_poolset_t *ps,int size,kib_pool_t **pp_po) { -struct kib_pmr_pool *ppo; -struct kib_pool *pool; -kib_phys_mr_t *pmr; -int i; +struct kib_pmr_pool *ppo; +struct kib_pool *pool; +kib_phys_mr_t *pmr; +int i;LIBCFS_CPT_ALLOC (ppo,lnet_cpt_table (), ps->ps_cpt,sizeof (kib_pmr_pool_t));
@@ -1923,8 +1922,8 @@ static int kiblnd_create_pmr_pool(kib_poolset_t *ps, int size,static void kiblnd_destroy_tx_pool (kib_pool_t *pool) { -kib_tx_pool_t *tpo =container_of (pool, kib_tx_pool_t, tpo_pool); -int i; +kib_tx_pool_t *tpo =container_of (pool, kib_tx_pool_t, tpo_pool); +int i;LASSERT (pool->po_allocated =0 );
@@ -1979,9 +1978,9 @@ static int kiblnd_tx_pool_size(int ncpts)static int kiblnd_create_tx_pool (kib_poolset_t *ps,int size,kib_pool_t **pp_po) { -int i; -int npg; -kib_pool_t *pool; +int i; +int npg; +kib_pool_t *pool;kib_tx_pool_t *tpo;LIBCFS_CPT_ALLOC (tpo,lnet_cpt_table (), ps->ps_cpt,sizeof (*tpo));
@@ -2064,19 +2063,19 @@ static void kiblnd_tx_init(kib_pool_t *pool, struct list_head *node) {kib_tx_poolset_t *tps =container_of (pool->po_owner, kib_tx_poolset_t, tps_poolset); -kib_tx_t *tx =list_entry (node, kib_tx_t, tx_list); +kib_tx_t *tx =list_entry (node, kib_tx_t, tx_list); tx->tx_cookie = tps->tps_next_tx_cookie++; }static void kiblnd_net_fini_pools (kib_net_t *net) { -int i; +int i;cfs_cpt_for_each (i,lnet_cpt_table ()) { -kib_tx_poolset_t *tps; -kib_fmr_poolset_t *fps; -kib_pmr_poolset_t *pps; +kib_tx_poolset_t *tps; +kib_fmr_poolset_t *fps; +kib_pmr_poolset_t *pps;if (net->ibn_tx_ps !=NULL ) { tps = net->ibn_tx_ps[i];
@@ -2112,16 +2111,15 @@ static void kiblnd_net_fini_pools(kib_net_t *net)static int kiblnd_net_init_pools (kib_net_t *net,__u32 *cpts,int ncpts) { -unsigned long flags; -int cpt; -int rc; -int i; +unsigned long flags; +int cpt; +int rc; +int i;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);if (*kiblnd_tunables.kib_map_on_demand =0 && net->ibn_dev->ibd_hdev->ibh_nmrs =1 ) { -read_unlock_irqrestore (&kiblnd_data.kib_global_lock, - flags); +read_unlock_irqrestore (&kiblnd_data.kib_global_lock, flags); goto create_tx_pool; }
@@ -2241,7 +2239,7 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts)static int kiblnd_hdev_get_attr (kib_hca_dev_t *hdev) {struct ib_device_attr *attr; -int rc; +int rc;/* It's safe to assume a HCA can handle a page size * matching that of the native system */
@@ -2284,7 +2282,7 @@ static int kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)static void kiblnd_hdev_cleanup_mrs (kib_hca_dev_t *hdev) { -int i; +int i;if (hdev->ibh_nmrs =0 || hdev->ibh_mrs =NULL )return ;
@@ -2317,12 +2315,11 @@ void kiblnd_hdev_destroy(kib_hca_dev_t *hdev)static int kiblnd_hdev_setup_mrs (kib_hca_dev_t *hdev) {struct ib_mr *mr; -int i; -int rc; -__u64 mm_size; -__u64 mr_size; -int acflags =IB_ACCESS_LOCAL_WRITE | -IB_ACCESS_REMOTE_WRITE ; +int i; +int rc; +__u64 mm_size; +__u64 mr_size; +int acflags =IB_ACCESS_LOCAL_WRITE |IB_ACCESS_REMOTE_WRITE ; rc =kiblnd_hdev_get_attr (hdev);if (rc !=0 )
@@ -2371,11 +2368,11 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)for (i =0 ; i < hdev->ibh_nmrs; i++) {struct ib_phys_buf ipb; -__u64 iova; +__u64 iova; ipb.size = hdev->ibh_mr_size; ipb.addr = i * mr_size; - iova = ipb.addr; + iova = ipb.addr; mr =ib_reg_phys_mr (hdev->ibh_pd, &ipb,1 , acflags, &iova);if (IS_ERR (mr)) {
@@ -2406,10 +2403,10 @@ static int kiblnd_dummy_callback(struct rdma_cm_id *cmid, static int kiblnd_dev_need_failover(kib_dev_t *dev) { - struct rdma_cm_id *cmid; - struct sockaddr_in srcaddr; - struct sockaddr_in dstaddr; - int rc; + struct rdma_cm_id *cmid; + struct sockaddr_in srcaddr; + struct sockaddr_in dstaddr; + int rc; if (dev->ibd_hdev = NULL || /* initializing */ dev->ibd_hdev->ibh_cmid = NULL || /* listener is dead */
@@ -2435,7 +2432,7 @@ static int kiblnd_dev_need_failover(kib_dev_t *dev) }memset (&srcaddr,0 ,sizeof (srcaddr)); - srcaddr.sin_family =AF_INET ; + srcaddr.sin_family =AF_INET ; srcaddr.sin_addr.s_addr = (__force u32 )htonl (dev->ibd_ifip);memset (&dstaddr,0 ,sizeof (dstaddr));
@@ -2464,15 +2461,15 @@ int kiblnd_dev_failover(kib_dev_t *dev)LIST_HEAD (zombie_tpo);LIST_HEAD (zombie_ppo);LIST_HEAD (zombie_fpo); -struct rdma_cm_id *cmid =NULL ; -kib_hca_dev_t *hdev =NULL ; -kib_hca_dev_t *old; -struct ib_pd *pd; -kib_net_t *net; -struct sockaddr_in addr; -unsigned long flags; -int rc =0 ; -int i; +struct rdma_cm_id *cmid =NULL ; +kib_hca_dev_t *hdev =NULL ; +kib_hca_dev_t *old; +struct ib_pd *pd; +kib_net_t *net; +struct sockaddr_in addr; +unsigned long flags; +int rc =0 ; +int i; LASSERT(*kiblnd_tunables.kib_dev_failover > 1 || dev->ibd_can_failover ||
@@ -2614,11 +2611,11 @@ void kiblnd_destroy_dev(kib_dev_t *dev)static kib_dev_t *kiblnd_create_dev (char *ifname) {struct net_device *netdev; -kib_dev_t *dev; -__u32 netmask; -__u32 ip; -int up; -int rc; +kib_dev_t *dev; +__u32 netmask; +__u32 ip; +int up; +int rc; rc =libcfs_ipif_query (ifname, &up, &ip, &netmask);if (rc !=0 ) {
@@ -2665,8 +2662,8 @@ static kib_dev_t *kiblnd_create_dev(char *ifname)static void kiblnd_base_shutdown (void ) { -struct kib_sched_info *sched; -int i; +struct kib_sched_info *sched; +int i;LASSERT (list_empty (&kiblnd_data.kib_devs));
@@ -2732,10 +2729,10 @@ static void kiblnd_base_shutdown(void)void kiblnd_shutdown (lnet_ni_t *ni) { -kib_net_t *net = ni->ni_data; -rwlock_t *g_lock = &kiblnd_data.kib_global_lock; -int i; -unsigned long flags; +kib_net_t *net = ni->ni_data; +rwlock_t *g_lock = &kiblnd_data.kib_global_lock; +int i; +unsigned long flags;LASSERT (kiblnd_data.kib_init =IBLND_INIT_ALL );
@@ -2804,9 +2801,9 @@ out:static int kiblnd_base_startup (void ) { -struct kib_sched_info *sched; -int rc; -int i; +struct kib_sched_info *sched; +int rc; +int i;LASSERT (kiblnd_data.kib_init =IBLND_INIT_NOTHING );
@@ -2821,8 +2818,7 @@ static int kiblnd_base_startup(void) kiblnd_data.kib_peer_hash_size =IBLND_PEER_HASH_SIZE ;LIBCFS_ALLOC (kiblnd_data.kib_peers, -sizeof (struct list_head ) * - kiblnd_data.kib_peer_hash_size); +sizeof (struct list_head ) * kiblnd_data.kib_peer_hash_size);if (kiblnd_data.kib_peers =NULL ) goto failed;for (i =0 ; i < kiblnd_data.kib_peer_hash_size; i++)
@@ -2840,7 +2836,7 @@ static int kiblnd_base_startup(void) goto failed;cfs_percpt_for_each (sched, i, kiblnd_data.kib_scheds) { -int nthrs; +int nthrs;spin_lock_init (&sched->ibs_lock);INIT_LIST_HEAD (&sched->ibs_conns);
@@ -2893,9 +2889,9 @@ static int kiblnd_base_startup(void)static int kiblnd_start_schedulers (struct kib_sched_info *sched) { -int rc =0 ; -int nthrs; -int i; +int rc =0 ; +int nthrs; +int i;if (sched->ibs_nthreads =0 ) {if (*kiblnd_tunables.kib_nscheds >0 ) {
@@ -2913,8 +2909,8 @@ static int kiblnd_start_schedulers(struct kib_sched_info *sched) }for (i =0 ; i < nthrs; i++) { -long id; -char name[20 ]; +long id; +char name[20 ]; id =KIB_THREAD_ID (sched->ibs_cpt, sched->ibs_nthreads + i); snprintf(name, sizeof(name), "kiblnd_sd_%02ld_%02ld",
@@ -2935,9 +2931,9 @@ static int kiblnd_start_schedulers(struct kib_sched_info *sched)static int kiblnd_dev_start_threads (kib_dev_t *dev,int newdev,__u32 *cpts,int ncpts) { -int cpt; -int rc; -int i; +int cpt; +int rc; +int i;for (i =0 ; i < ncpts; i++) {struct kib_sched_info *sched;
@@ -2960,10 +2956,10 @@ static int kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts,static kib_dev_t *kiblnd_dev_search (char *ifname) { -kib_dev_t *alias =NULL ; -kib_dev_t *dev; -char *colon; -char *colon2; +kib_dev_t *alias =NULL ; +kib_dev_t *dev; +char *colon; +char *colon2; colon =strchr (ifname,':' );list_for_each_entry (dev, &kiblnd_data.kib_devs, ibd_list) {
@@ -2992,13 +2988,13 @@ static kib_dev_t *kiblnd_dev_search(char *ifname)int kiblnd_startup (lnet_ni_t *ni) { -char *ifname; -kib_dev_t *ibdev =NULL ; -kib_net_t *net; -struct timeval tv; -unsigned long flags; -int rc; -int newdev; +char *ifname; +kib_dev_t *ibdev =NULL ; +kib_net_t *net; +struct timeval tv; +unsigned long flags; +int rc; +int newdev;LASSERT (ni->ni_lnd = &the_o2iblnd);
@@ -3091,7 +3087,7 @@ static void __exit kiblnd_module_fini(void)static int __init kiblnd_module_init (void ) { -int rc; +int rc;CLASSERT (sizeof (kib_msg_t) <=IBLND_MSG_SIZE ); CLASSERT(offsetof(kib_msg_t,
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +349 -331
828 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +240 -242
876 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +24 -24
54 lines not on this page · raw message
Signature · 1 line
1.7.1
Re: [PATCH v4 05/13] staging: lustre: lnet: o2iblnd: code cleanup - align whitespace
Quoted 60 lines · Mike Shuey
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +24
-28@@ -80,42 +80,47 @@#define IBLND_N_SCHED_HIGH 4 typedef struct { - int *kib_dev_failover; /* HCA failover */ - unsigned int *kib_service; /* IB service number */ - int *kib_min_reconnect_interval; /* first failed connection retry... */ - int *kib_max_reconnect_interval; /* ...exponentially increasing to this */ - int *kib_cksum; /* checksum kib_msg_t? */ - int *kib_timeout; /* comms timeout (seconds) */ - int *kib_keepalive; /* keepalive timeout (seconds) */ - int *kib_ntx; /* # tx descs */ - int *kib_credits; /* # concurrent sends */ - int *kib_peertxcredits; /* # concurrent sends to 1 peer */ - int *kib_peerrtrcredits; /* # per-peer router buffer credits */ - int *kib_peercredits_hiw; /* # when eagerly to return credits */ - int *kib_peertimeout; /* seconds to consider peer dead */ - char **kib_default_ipif; /* default IPoIB interface */ - int *kib_retry_count; - int *kib_rnr_retry_count; - int *kib_concurrent_sends; /* send work queue sizing */ - int *kib_ib_mtu; /* IB MTU */ - int *kib_map_on_demand; /* map-on-demand if RD has more fragments - * than this value, 0 disable map-on-demand */ - int *kib_pmr_pool_size; /* # physical MR in pool */ - int *kib_fmr_pool_size; /* # FMRs in pool */ - int *kib_fmr_flush_trigger; /* When to trigger FMR flush */ - int *kib_fmr_cache; /* enable FMR pool cache? */ - int *kib_require_priv_port;/* accept only privileged ports */ - int *kib_use_priv_port; /* use privileged port for active connect */ - /* # threads on each CPT */ - int *kib_nscheds; + int *kib_dev_failover; /* HCA failover */ + unsigned int *kib_service; /* IB service number */ + int *kib_min_reconnect_interval; /* first failed connection + * retry... */ + int *kib_max_reconnect_interval; /* ...exponentially increasing + * to this */ + int *kib_cksum; /* checksum kib_msg_t? */ + int *kib_timeout; /* comms timeout (seconds) */ + int *kib_keepalive; /* keepalive timeout (seconds) */ + int *kib_ntx; /* # tx descs */ + int *kib_credits; /* # concurrent sends */ + int *kib_peertxcredits; /* # concurrent sends to 1 peer */ + int *kib_peerrtrcredits; /* # per-peer router buffer + * credits */ + int *kib_peercredits_hiw; /* # when eagerly to return + * credits */ + int *kib_peertimeout; /* seconds to consider peer dead */ + char **kib_default_ipif; /* default IPoIB interface */ + int *kib_retry_count; + int *kib_rnr_retry_count; + int *kib_concurrent_sends; /* send work queue sizing */ + int *kib_ib_mtu; /* IB MTU */ + int *kib_map_on_demand; /* map-on-demand if RD has more + * fragments than this value, 0
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h line 116
Quoted 10 lines
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +9
-0+* disable map-on-demand */ +int *kib_pmr_pool_size;/* # physical MR in pool */ +int *kib_fmr_pool_size;/* # FMRs in pool */ +int *kib_fmr_flush_trigger;/* When to trigger FMR flush */ +int *kib_fmr_cache;/* enable FMR pool cache? */ +int *kib_require_priv_port;/* accept only privileged ports */ +int *kib_use_priv_port;/* use privileged port for active +* connect */ +int *kib_nscheds;/* # threads on each CPT */ } kib_tunables_t;
The lustre people have their own style guidelines for these things in the .h file. We should probably match theirs.
I don't care one way or the other, what style people use for this.
regards,
dan carpenter
PATCH v4 5/13 staging: lustre: lnet: o2iblnd: code cleanup - align whitespace
In reply to Mike ShueyUnify variable declarations to use a single whitespace. Also line up declarations and comments in o2iblnd.h.
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 458 +++++++------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 680 ++++++++++---------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 484 +++++++------- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 48 +- 4 files changed, 841 insertions(+), 829 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +227 -231
@@ -42,21 +42,21 @@#include <asm/div64.h> static lnd_t the_o2iblnd = { - .lnd_type =O2IBLND , - .lnd_startup = kiblnd_startup, - .lnd_shutdown = kiblnd_shutdown, - .lnd_ctl = kiblnd_ctl, - .lnd_query = kiblnd_query, - .lnd_send = kiblnd_send, - .lnd_recv = kiblnd_recv, + .lnd_type =O2IBLND , + .lnd_startup = kiblnd_startup, + .lnd_shutdown = kiblnd_shutdown, + .lnd_ctl = kiblnd_ctl, + .lnd_query = kiblnd_query, + .lnd_send = kiblnd_send, + .lnd_recv = kiblnd_recv, }; -kib_data_t kiblnd_data; +kib_data_t kiblnd_data;static __u32 kiblnd_cksum (void *ptr,int nob) { -char *c = ptr; -__u32 sum =0 ; +char *c = ptr; +__u32 sum =0 ;while (nob-- >0 ) sum = ((sum <<1 ) | (sum >>31 )) + *c++;
@@ -138,10 +138,10 @@ static int kiblnd_msgtype2size(int type)static int kiblnd_unpack_rd (kib_msg_t *msg,int flip) { -kib_rdma_desc_t *rd; -int nob; -int n; -int i; +kib_rdma_desc_t *rd; +int nob; +int n; +int i;LASSERT (msg->ibm_type =IBLND_MSG_GET_REQ || msg->ibm_type =IBLND_MSG_PUT_ACK );
@@ -210,10 +210,10 @@ void kiblnd_pack_msg(lnet_ni_t *ni, kib_msg_t *msg, int version,int kiblnd_unpack_msg (kib_msg_t *msg,int nob) {const int hdr_size = offsetof(kib_msg_t , ibm_u); -__u32 msg_cksum; -__u16 version; -int msg_nob; -int flip; +__u32 msg_cksum; +__u16 version; +int msg_nob; +int flip;/* 6 bytes are enough to have received magic + version */ if (nob <6 ) {
@@ -320,10 +320,10 @@ int kiblnd_unpack_msg(kib_msg_t *msg, int nob)int kiblnd_create_peer (lnet_ni_t *ni,kib_peer_t **peerp,lnet_nid_t nid) { -kib_peer_t *peer; -kib_net_t *net = ni->ni_data; -int cpt =lnet_cpt_of_nid (nid); -unsigned long flags; +kib_peer_t *peer; +kib_net_t *net = ni->ni_data; +int cpt =lnet_cpt_of_nid (nid); +unsigned long flags;LASSERT (net !=NULL );LASSERT (nid !=LNET_NID_ANY );
@@ -385,9 +385,9 @@ kib_peer_t *kiblnd_find_peer_locked(lnet_nid_t nid) {/* the caller is responsible for accounting the additional reference * that this creates */ -struct list_head *peer_list =kiblnd_nid2peerlist (nid); -struct list_head *tmp; -kib_peer_t *peer; +struct list_head *peer_list =kiblnd_nid2peerlist (nid); +struct list_head *tmp; +kib_peer_t *peer;list_for_each (tmp, peer_list) {
@@ -422,10 +422,10 @@ void kiblnd_unlink_peer_locked(kib_peer_t *peer)static int kiblnd_get_peer_info (lnet_ni_t *ni,int index,lnet_nid_t *nidp,int *count) { -kib_peer_t *peer; -struct list_head *ptmp; -int i; -unsigned long flags; +kib_peer_t *peer; +struct list_head *ptmp; +int i; +unsigned long flags;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -459,9 +459,9 @@ static int kiblnd_get_peer_info(lnet_ni_t *ni, int index,static void kiblnd_del_peer_locked (kib_peer_t *peer) { -struct list_head *ctmp; -struct list_head *cnxt; -kib_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt; +kib_conn_t *conn;if (list_empty (&peer->ibp_conns)) {kiblnd_unlink_peer_locked (peer);
@@ -480,14 +480,14 @@ static void kiblnd_del_peer_locked(kib_peer_t *peer)static int kiblnd_del_peer (lnet_ni_t *ni,lnet_nid_t nid) {LIST_HEAD (zombies); -struct list_head *ptmp; -struct list_head *pnxt; -kib_peer_t *peer; -int lo; -int hi; -int i; -unsigned long flags; -int rc = -ENOENT ; +struct list_head *ptmp; +struct list_head *pnxt; +kib_peer_t *peer; +int lo; +int hi; +int i; +unsigned long flags; +int rc = -ENOENT ;write_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -532,12 +532,12 @@ static int kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid)static kib_conn_t *kiblnd_get_conn_by_idx (lnet_ni_t *ni,int index) { -kib_peer_t *peer; -struct list_head *ptmp; -kib_conn_t *conn; -struct list_head *ctmp; -int i; -unsigned long flags; +kib_peer_t *peer; +struct list_head *ptmp; +kib_conn_t *conn; +struct list_head *ctmp; +int i; +unsigned long flags;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -593,7 +593,7 @@ int kiblnd_translate_mtu(int value)static void kiblnd_setup_mtu_locked (struct rdma_cm_id *cmid) { -int mtu; +int mtu;/* XXX There is no path record for iWARP, set by netdev->change_mtu? */ if (cmid->route.path_rec =NULL )
@@ -607,11 +607,11 @@ static void kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid)static int kiblnd_get_completion_vector (kib_conn_t *conn,int cpt) { -cpumask_t *mask; -int vectors; -int off; -int i; -lnet_nid_t nid = conn->ibc_peer->ibp_nid; +cpumask_t *mask; +int vectors; +int off; +int i; +lnet_nid_t nid = conn->ibc_peer->ibp_nid; vectors = conn->ibc_cmid->device->num_comp_vectors;if (vectors <=1 )
@@ -642,17 +642,17 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,* she must dispose of 'cmid'. (Actually I'd block forever if I tried * to destroy 'cmid' here since I'm called from the CM which still has * its ref on 'cmid'). */ -rwlock_t *glock = &kiblnd_data.kib_global_lock; -kib_net_t *net = peer->ibp_ni->ni_data; -kib_dev_t *dev; +rwlock_t *glock = &kiblnd_data.kib_global_lock; +kib_net_t *net = peer->ibp_ni->ni_data; +kib_dev_t *dev;struct ib_qp_init_attr *init_qp_attr; -struct kib_sched_info *sched; -kib_conn_t *conn; -struct ib_cq *cq; -unsigned long flags; -int cpt; -int rc; -int i; +struct kib_sched_info *sched; +kib_conn_t *conn; +struct ib_cq *cq; +unsigned long flags; +int cpt; +int rc; +int i;LASSERT (net !=NULL );LASSERT (!in_interrupt ());
@@ -837,8 +837,8 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,void kiblnd_destroy_conn (kib_conn_t *conn) {struct rdma_cm_id *cmid = conn->ibc_cmid; -kib_peer_t *peer = conn->ibc_peer; -int rc; +kib_peer_t *peer = conn->ibc_peer; +int rc;LASSERT (!in_interrupt ());LASSERT (atomic_read (&conn->ibc_refcount) =0 );
@@ -904,10 +904,10 @@ void kiblnd_destroy_conn(kib_conn_t *conn)int kiblnd_close_peer_conns_locked (kib_peer_t *peer,int why) { -kib_conn_t *conn; -struct list_head *ctmp; -struct list_head *cnxt; -int count =0 ; +kib_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt; +int count =0 ;list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { conn =list_entry (ctmp, kib_conn_t, ibc_list);
@@ -926,10 +926,10 @@ int kiblnd_close_peer_conns_locked(kib_peer_t *peer, int why)int kiblnd_close_stale_conns_locked (kib_peer_t *peer,int version,__u64 incarnation) { -kib_conn_t *conn; -struct list_head *ctmp; -struct list_head *cnxt; -int count =0 ; +kib_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt; +int count =0 ;list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { conn =list_entry (ctmp, kib_conn_t, ibc_list);
@@ -953,14 +953,14 @@ int kiblnd_close_stale_conns_locked(kib_peer_t *peer,static int kiblnd_close_matching_conns (lnet_ni_t *ni,lnet_nid_t nid) { -kib_peer_t *peer; -struct list_head *ptmp; -struct list_head *pnxt; -int lo; -int hi; -int i; -unsigned long flags; -int count =0 ; +kib_peer_t *peer; +struct list_head *ptmp; +struct list_head *pnxt; +int lo; +int hi; +int i; +unsigned long flags; +int count =0 ;write_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -1001,17 +1001,17 @@ static int kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid)int kiblnd_ctl (lnet_ni_t *ni,unsigned int cmd,void *arg) {struct libcfs_ioctl_data *data = arg; -int rc = -EINVAL ; +int rc = -EINVAL ;switch (cmd) {case IOC_LIBCFS_GET_PEER : { -lnet_nid_t nid =0 ; -int count =0 ; +lnet_nid_t nid =0 ; +int count =0 ; rc =kiblnd_get_peer_info (ni, data->ioc_count, &nid, &count); - data->ioc_nid = nid; - data->ioc_count = count; + data->ioc_nid = nid; + data->ioc_count = count;break ; }
@@ -1053,11 +1053,11 @@ int kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)void kiblnd_query (lnet_ni_t *ni,lnet_nid_t nid,unsigned long *when) { -unsigned long last_alive =0 ; -unsigned long now =cfs_time_current (); -rwlock_t *glock = &kiblnd_data.kib_global_lock; -kib_peer_t *peer; -unsigned long flags; +unsigned long last_alive =0 ; +unsigned long now =cfs_time_current (); +rwlock_t *glock = &kiblnd_data.kib_global_lock; +kib_peer_t *peer; +unsigned long flags;read_lock_irqsave (glock, flags);
@@ -1086,8 +1086,8 @@ void kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)void kiblnd_free_pages (kib_pages_t *p) { -int npages = p->ibp_npages; -int i; +int npages = p->ibp_npages; +int i;for (i =0 ; i < npages; i++) {if (p->ibp_pages[i] !=NULL )
@@ -1099,8 +1099,8 @@ void kiblnd_free_pages(kib_pages_t *p)int kiblnd_alloc_pages (kib_pages_t **pp,int cpt,int npages) { -kib_pages_t *p; -int i; +kib_pages_t *p; +int i;LIBCFS_CPT_ALLOC (p,lnet_cpt_table (), cpt, offsetof(kib_pages_t, ibp_pages[npages]));
@@ -1130,7 +1130,7 @@ int kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages)void kiblnd_unmap_rx_descs (kib_conn_t *conn) {kib_rx_t *rx; -int i; +int i;LASSERT (conn->ibc_rxs !=NULL );LASSERT (conn->ibc_hdev !=NULL );
@@ -1153,14 +1153,13 @@ void kiblnd_unmap_rx_descs(kib_conn_t *conn)void kiblnd_map_rx_descs (kib_conn_t *conn) { -kib_rx_t *rx; -struct page *pg; -int pg_off; -int ipg; -int i; +kib_rx_t *rx; +struct page *pg; +int pg_off; +int ipg; +int i; -for (pg_off = ipg = i =0 ; - i <IBLND_RX_MSGS (conn->ibc_version); i++) { +for (pg_off = ipg = i =0 ; i <IBLND_RX_MSGS (conn->ibc_version); i++) { pg = conn->ibc_rx_pages->ibp_pages[ipg]; rx = &conn->ibc_rxs[i];
@@ -1192,9 +1191,9 @@ void kiblnd_map_rx_descs(kib_conn_t *conn)static void kiblnd_unmap_tx_pool (kib_tx_pool_t *tpo) { -kib_hca_dev_t *hdev = tpo->tpo_hdev; -kib_tx_t *tx; -int i; +kib_hca_dev_t *hdev = tpo->tpo_hdev; +kib_tx_t *tx; +int i;LASSERT (tpo->tpo_pool.po_allocated =0 );
@@ -1216,8 +1215,8 @@ static void kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo)static kib_hca_dev_t *kiblnd_current_hdev (kib_dev_t *dev) {kib_hca_dev_t *hdev; -unsigned long flags; -int i =0 ; +unsigned long flags; +int i =0 ;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);while (dev->ibd_failover) {
@@ -1240,15 +1239,15 @@ static kib_hca_dev_t *kiblnd_current_hdev(kib_dev_t *dev)static void kiblnd_map_tx_pool (kib_tx_pool_t *tpo) { -kib_pages_t *txpgs = tpo->tpo_tx_pages; -kib_pool_t *pool = &tpo->tpo_pool; -kib_net_t *net = pool->po_owner->ps_net; -kib_dev_t *dev; -struct page *page; -kib_tx_t *tx; -int page_offset; -int ipage; -int i; +kib_pages_t *txpgs = tpo->tpo_tx_pages; +kib_pool_t *pool = &tpo->tpo_pool; +kib_net_t *net = pool->po_owner->ps_net; +kib_dev_t *dev; +struct page *page; +kib_tx_t *tx; +int page_offset; +int ipage; +int i;LASSERT (net !=NULL );
@@ -1291,7 +1290,7 @@ static void kiblnd_map_tx_pool(kib_tx_pool_t *tpo)struct ib_mr *kiblnd_find_dma_mr (kib_hca_dev_t *hdev,__u64 addr,__u64 size) { -__u64 index; +__u64 index;LASSERT (hdev->ibh_mrs[0 ] !=NULL );
@@ -1311,7 +1310,7 @@ struct ib_mr *kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) {struct ib_mr *prev_mr;struct ib_mr *mr; -int i; +int i;LASSERT (hdev->ibh_mrs[0 ] !=NULL );
@@ -1382,18 +1381,18 @@ static int kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo) {/* FMR pool for RDMA */ -kib_dev_t *dev = fps->fps_net->ibn_dev; -kib_fmr_pool_t *fpo; +kib_dev_t *dev = fps->fps_net->ibn_dev; +kib_fmr_pool_t *fpo;struct ib_fmr_pool_param param = { .max_pages_per_fmr =LNET_MAX_PAYLOAD /PAGE_SIZE , - .page_shift =PAGE_SHIFT , - .access = (IB_ACCESS_LOCAL_WRITE | -IB_ACCESS_REMOTE_WRITE ), - .pool_size = fps->fps_pool_size, + .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 = !!*kiblnd_tunables.kib_fmr_cache}; + .flush_arg =NULL , + .cache = !!*kiblnd_tunables.kib_fmr_cache};int rc;LIBCFS_CPT_ALLOC (fpo,lnet_cpt_table (), fps->fps_cpt,sizeof (*fpo));
@@ -1454,7 +1453,7 @@ static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, int flush_trigger) {kib_fmr_pool_t *fpo; -int rc; +int rc;memset (fps,0 ,sizeof (kib_fmr_poolset_t));
@@ -1485,11 +1484,11 @@ static int kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now)void kiblnd_fmr_pool_unmap (kib_fmr_t *fmr,int status) {LIST_HEAD (zombies); -kib_fmr_pool_t *fpo = fmr->fmr_pool; +kib_fmr_pool_t *fpo = fmr->fmr_pool;kib_fmr_poolset_t *fps = fpo->fpo_owner; -unsigned long now =cfs_time_current (); -kib_fmr_pool_t *tmp; -int rc; +unsigned long now =cfs_time_current (); +kib_fmr_pool_t *tmp; +int rc; rc =ib_fmr_pool_unmap (fmr->fmr_pfmr);LASSERT (rc =0 );
@@ -1525,9 +1524,9 @@ int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, __u64 iov, kib_fmr_t *fmr) { struct ib_pool_fmr *pfmr; -kib_fmr_pool_t *fpo; -__u64 version; -int rc; +kib_fmr_pool_t *fpo; +__u64 version; +int rc; again:spin_lock (&fps->fps_lock);
@@ -1658,13 +1657,13 @@ static int kiblnd_init_poolset(kib_poolset_t *ps, int cpt, kib_ps_node_init_t nd_init, kib_ps_node_fini_t nd_fini) { -kib_pool_t *pool; -int rc; +kib_pool_t *pool; +int rc;memset (ps,0 ,sizeof (kib_poolset_t)); - 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;
@@ -1698,9 +1697,9 @@ static int kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now)void kiblnd_pool_free_node (kib_pool_t *pool,struct list_head *node) {LIST_HEAD (zombies); -kib_poolset_t *ps = pool->po_owner; -kib_pool_t *tmp; -unsigned long now =cfs_time_current (); +kib_poolset_t *ps = pool->po_owner; +kib_pool_t *tmp; +unsigned long now =cfs_time_current ();spin_lock (&ps->ps_lock);
@@ -1727,9 +1726,9 @@ void kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node)struct list_head *kiblnd_pool_alloc_node (kib_poolset_t *ps) { -struct list_head *node; -kib_pool_t *pool; -int rc; +struct list_head *node; +kib_pool_t *pool; +int rc; again:spin_lock (&ps->ps_lock);
@@ -1789,8 +1788,8 @@ struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps)void kiblnd_pmr_pool_unmap (kib_phys_mr_t *pmr) { -kib_pmr_pool_t *ppo = pmr->pmr_pool; -struct ib_mr *mr = pmr->pmr_mr; +kib_pmr_pool_t *ppo = pmr->pmr_pool; +struct ib_mr *mr = pmr->pmr_mr; pmr->pmr_mr =NULL ;kiblnd_pool_free_node (&ppo->ppo_pool, &pmr->pmr_list);
@@ -1802,9 +1801,9 @@ int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr) {kib_phys_mr_t *pmr; -struct list_head *node; -int rc; -int i; +struct list_head *node; +int rc; +int i; node =kiblnd_pool_alloc_node (&pps->pps_poolset);if (node =NULL ) {
@@ -1846,7 +1845,7 @@ int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev,static void kiblnd_destroy_pmr_pool (kib_pool_t *pool) {kib_pmr_pool_t *ppo =container_of (pool, kib_pmr_pool_t, ppo_pool); -kib_phys_mr_t *pmr; +kib_phys_mr_t *pmr;kib_phys_mr_t *tmp;LASSERT (pool->po_allocated =0 );
@@ -1881,10 +1880,10 @@ static inline int kiblnd_pmr_pool_size(int ncpts)static int kiblnd_create_pmr_pool (kib_poolset_t *ps,int size,kib_pool_t **pp_po) { -struct kib_pmr_pool *ppo; -struct kib_pool *pool; -kib_phys_mr_t *pmr; -int i; +struct kib_pmr_pool *ppo; +struct kib_pool *pool; +kib_phys_mr_t *pmr; +int i;LIBCFS_CPT_ALLOC (ppo,lnet_cpt_table (), ps->ps_cpt,sizeof (kib_pmr_pool_t));
@@ -1923,8 +1922,8 @@ static int kiblnd_create_pmr_pool(kib_poolset_t *ps, int size,static void kiblnd_destroy_tx_pool (kib_pool_t *pool) { -kib_tx_pool_t *tpo =container_of (pool, kib_tx_pool_t, tpo_pool); -int i; +kib_tx_pool_t *tpo =container_of (pool, kib_tx_pool_t, tpo_pool); +int i;LASSERT (pool->po_allocated =0 );
@@ -1979,9 +1978,9 @@ static int kiblnd_tx_pool_size(int ncpts)static int kiblnd_create_tx_pool (kib_poolset_t *ps,int size,kib_pool_t **pp_po) { -int i; -int npg; -kib_pool_t *pool; +int i; +int npg; +kib_pool_t *pool;kib_tx_pool_t *tpo;LIBCFS_CPT_ALLOC (tpo,lnet_cpt_table (), ps->ps_cpt,sizeof (*tpo));
@@ -2064,19 +2063,19 @@ static void kiblnd_tx_init(kib_pool_t *pool, struct list_head *node) {kib_tx_poolset_t *tps =container_of (pool->po_owner, kib_tx_poolset_t, tps_poolset); -kib_tx_t *tx =list_entry (node, kib_tx_t, tx_list); +kib_tx_t *tx =list_entry (node, kib_tx_t, tx_list); tx->tx_cookie = tps->tps_next_tx_cookie++; }static void kiblnd_net_fini_pools (kib_net_t *net) { -int i; +int i;cfs_cpt_for_each (i,lnet_cpt_table ()) { -kib_tx_poolset_t *tps; -kib_fmr_poolset_t *fps; -kib_pmr_poolset_t *pps; +kib_tx_poolset_t *tps; +kib_fmr_poolset_t *fps; +kib_pmr_poolset_t *pps;if (net->ibn_tx_ps !=NULL ) { tps = net->ibn_tx_ps[i];
@@ -2112,16 +2111,15 @@ static void kiblnd_net_fini_pools(kib_net_t *net)static int kiblnd_net_init_pools (kib_net_t *net,__u32 *cpts,int ncpts) { -unsigned long flags; -int cpt; -int rc; -int i; +unsigned long flags; +int cpt; +int rc; +int i;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);if (*kiblnd_tunables.kib_map_on_demand =0 && net->ibn_dev->ibd_hdev->ibh_nmrs =1 ) { -read_unlock_irqrestore (&kiblnd_data.kib_global_lock, - flags); +read_unlock_irqrestore (&kiblnd_data.kib_global_lock, flags); goto create_tx_pool; }
@@ -2241,7 +2239,7 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts)static int kiblnd_hdev_get_attr (kib_hca_dev_t *hdev) {struct ib_device_attr *attr; -int rc; +int rc;/* It's safe to assume a HCA can handle a page size * matching that of the native system */
@@ -2284,7 +2282,7 @@ static int kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)static void kiblnd_hdev_cleanup_mrs (kib_hca_dev_t *hdev) { -int i; +int i;if (hdev->ibh_nmrs =0 || hdev->ibh_mrs =NULL )return ;
@@ -2317,12 +2315,11 @@ void kiblnd_hdev_destroy(kib_hca_dev_t *hdev)static int kiblnd_hdev_setup_mrs (kib_hca_dev_t *hdev) {struct ib_mr *mr; -int i; -int rc; -__u64 mm_size; -__u64 mr_size; -int acflags =IB_ACCESS_LOCAL_WRITE | -IB_ACCESS_REMOTE_WRITE ; +int i; +int rc; +__u64 mm_size; +__u64 mr_size; +int acflags =IB_ACCESS_LOCAL_WRITE |IB_ACCESS_REMOTE_WRITE ; rc =kiblnd_hdev_get_attr (hdev);if (rc !=0 )
@@ -2371,11 +2368,11 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)for (i =0 ; i < hdev->ibh_nmrs; i++) {struct ib_phys_buf ipb; -__u64 iova; +__u64 iova; ipb.size = hdev->ibh_mr_size; ipb.addr = i * mr_size; - iova = ipb.addr; + iova = ipb.addr; mr =ib_reg_phys_mr (hdev->ibh_pd, &ipb,1 , acflags, &iova);if (IS_ERR (mr)) {
@@ -2406,10 +2403,10 @@ static int kiblnd_dummy_callback(struct rdma_cm_id *cmid, static int kiblnd_dev_need_failover(kib_dev_t *dev) { - struct rdma_cm_id *cmid; - struct sockaddr_in srcaddr; - struct sockaddr_in dstaddr; - int rc; + struct rdma_cm_id *cmid; + struct sockaddr_in srcaddr; + struct sockaddr_in dstaddr; + int rc; if (dev->ibd_hdev = NULL || /* initializing */ dev->ibd_hdev->ibh_cmid = NULL || /* listener is dead */
@@ -2435,7 +2432,7 @@ static int kiblnd_dev_need_failover(kib_dev_t *dev) }memset (&srcaddr,0 ,sizeof (srcaddr)); - srcaddr.sin_family =AF_INET ; + srcaddr.sin_family =AF_INET ; srcaddr.sin_addr.s_addr = (__force u32 )htonl (dev->ibd_ifip);memset (&dstaddr,0 ,sizeof (dstaddr));
@@ -2464,15 +2461,15 @@ int kiblnd_dev_failover(kib_dev_t *dev)LIST_HEAD (zombie_tpo);LIST_HEAD (zombie_ppo);LIST_HEAD (zombie_fpo); -struct rdma_cm_id *cmid =NULL ; -kib_hca_dev_t *hdev =NULL ; -kib_hca_dev_t *old; -struct ib_pd *pd; -kib_net_t *net; -struct sockaddr_in addr; -unsigned long flags; -int rc =0 ; -int i; +struct rdma_cm_id *cmid =NULL ; +kib_hca_dev_t *hdev =NULL ; +kib_hca_dev_t *old; +struct ib_pd *pd; +kib_net_t *net; +struct sockaddr_in addr; +unsigned long flags; +int rc =0 ; +int i; LASSERT(*kiblnd_tunables.kib_dev_failover > 1 || dev->ibd_can_failover ||
@@ -2614,11 +2611,11 @@ void kiblnd_destroy_dev(kib_dev_t *dev)static kib_dev_t *kiblnd_create_dev (char *ifname) {struct net_device *netdev; -kib_dev_t *dev; -__u32 netmask; -__u32 ip; -int up; -int rc; +kib_dev_t *dev; +__u32 netmask; +__u32 ip; +int up; +int rc; rc =libcfs_ipif_query (ifname, &up, &ip, &netmask);if (rc !=0 ) {
@@ -2665,8 +2662,8 @@ static kib_dev_t *kiblnd_create_dev(char *ifname)static void kiblnd_base_shutdown (void ) { -struct kib_sched_info *sched; -int i; +struct kib_sched_info *sched; +int i;LASSERT (list_empty (&kiblnd_data.kib_devs));
@@ -2732,10 +2729,10 @@ static void kiblnd_base_shutdown(void)void kiblnd_shutdown (lnet_ni_t *ni) { -kib_net_t *net = ni->ni_data; -rwlock_t *g_lock = &kiblnd_data.kib_global_lock; -int i; -unsigned long flags; +kib_net_t *net = ni->ni_data; +rwlock_t *g_lock = &kiblnd_data.kib_global_lock; +int i; +unsigned long flags;LASSERT (kiblnd_data.kib_init =IBLND_INIT_ALL );
@@ -2804,9 +2801,9 @@ out:static int kiblnd_base_startup (void ) { -struct kib_sched_info *sched; -int rc; -int i; +struct kib_sched_info *sched; +int rc; +int i;LASSERT (kiblnd_data.kib_init =IBLND_INIT_NOTHING );
@@ -2821,8 +2818,7 @@ static int kiblnd_base_startup(void) kiblnd_data.kib_peer_hash_size =IBLND_PEER_HASH_SIZE ;LIBCFS_ALLOC (kiblnd_data.kib_peers, -sizeof (struct list_head ) * - kiblnd_data.kib_peer_hash_size); +sizeof (struct list_head ) * kiblnd_data.kib_peer_hash_size);if (kiblnd_data.kib_peers =NULL ) goto failed;for (i =0 ; i < kiblnd_data.kib_peer_hash_size; i++)
@@ -2840,7 +2836,7 @@ static int kiblnd_base_startup(void) goto failed;cfs_percpt_for_each (sched, i, kiblnd_data.kib_scheds) { -int nthrs; +int nthrs;spin_lock_init (&sched->ibs_lock);INIT_LIST_HEAD (&sched->ibs_conns);
@@ -2893,9 +2889,9 @@ static int kiblnd_base_startup(void)static int kiblnd_start_schedulers (struct kib_sched_info *sched) { -int rc =0 ; -int nthrs; -int i; +int rc =0 ; +int nthrs; +int i;if (sched->ibs_nthreads =0 ) {if (*kiblnd_tunables.kib_nscheds >0 ) {
@@ -2913,8 +2909,8 @@ static int kiblnd_start_schedulers(struct kib_sched_info *sched) }for (i =0 ; i < nthrs; i++) { -long id; -char name[20 ]; +long id; +char name[20 ]; id =KIB_THREAD_ID (sched->ibs_cpt, sched->ibs_nthreads + i); snprintf(name, sizeof(name), "kiblnd_sd_%02ld_%02ld",
@@ -2935,9 +2931,9 @@ static int kiblnd_start_schedulers(struct kib_sched_info *sched)static int kiblnd_dev_start_threads (kib_dev_t *dev,int newdev,__u32 *cpts,int ncpts) { -int cpt; -int rc; -int i; +int cpt; +int rc; +int i;for (i =0 ; i < ncpts; i++) {struct kib_sched_info *sched;
@@ -2960,10 +2956,10 @@ static int kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts,static kib_dev_t *kiblnd_dev_search (char *ifname) { -kib_dev_t *alias =NULL ; -kib_dev_t *dev; -char *colon; -char *colon2; +kib_dev_t *alias =NULL ; +kib_dev_t *dev; +char *colon; +char *colon2; colon =strchr (ifname,':' );list_for_each_entry (dev, &kiblnd_data.kib_devs, ibd_list) {
@@ -2992,13 +2988,13 @@ static kib_dev_t *kiblnd_dev_search(char *ifname)int kiblnd_startup (lnet_ni_t *ni) { -char *ifname; -kib_dev_t *ibdev =NULL ; -kib_net_t *net; -struct timeval tv; -unsigned long flags; -int rc; -int newdev; +char *ifname; +kib_dev_t *ibdev =NULL ; +kib_net_t *net; +struct timeval tv; +unsigned long flags; +int rc; +int newdev;LASSERT (ni->ni_lnd = &the_o2iblnd);
@@ -3091,7 +3087,7 @@ static void __exit kiblnd_module_fini(void)static int __init kiblnd_module_init (void ) { -int rc; +int rc;CLASSERT (sizeof (kib_msg_t) <=IBLND_MSG_SIZE ); CLASSERT(offsetof(kib_msg_t,
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +349 -331
828 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +240 -242
876 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +24 -24
54 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 6/13 staging: lustre: lnet: socklnd: code cleanup - align spacing
In reply to Mike ShueyUnify variable declarations to use a single space. Also include several miscellaneous whitespace cleanups, particularly in socklnd.h.
--- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 468 ++++++++-------- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 560 +++++++++++--------- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 396 +++++++------- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 150 +++--- .../lustre/lnet/klnds/socklnd/socklnd_modparams.c | 33 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 128 +++--- 6 files changed, 899 insertions(+), 836 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +234 -234
@@ -49,8 +49,8 @@ ksock_nal_data_t ksocknal_data;static ksock_interface_t *ksocknal_ip2iface (lnet_ni_t *ni,__u32 ip) { -ksock_net_t *net = ni->ni_data; -int i; +ksock_net_t *net = ni->ni_data; +int i;ksock_interface_t *iface;for (i =0 ; i < net->ksnn_ninterfaces; i++) {
@@ -102,8 +102,8 @@ ksocknal_destroy_route(ksock_route_t *route)static int ksocknal_create_peer (ksock_peer_t **peerp,lnet_ni_t *ni,lnet_process_id_t id) { -ksock_net_t *net = ni->ni_data; -ksock_peer_t *peer; +ksock_net_t *net = ni->ni_data; +ksock_peer_t *peer;LASSERT (id.nid !=LNET_NID_ANY );LASSERT (id.pid !=LNET_PID_ANY );
@@ -149,7 +149,7 @@ ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)void ksocknal_destroy_peer (ksock_peer_t *peer) { -ksock_net_t *net = peer->ksnp_ni->ni_data; +ksock_net_t *net = peer->ksnp_ni->ni_data;CDEBUG (D_NET ,"peer %s %p deleted\n" ,libcfs_id2str (peer->ksnp_id), peer);
@@ -175,9 +175,9 @@ ksocknal_destroy_peer(ksock_peer_t *peer)ksock_peer_t *ksocknal_find_peer_locked (lnet_ni_t *ni,lnet_process_id_t id) { -struct list_head *peer_list =ksocknal_nid2peerlist (id.nid); -struct list_head *tmp; -ksock_peer_t *peer; +struct list_head *peer_list =ksocknal_nid2peerlist (id.nid); +struct list_head *tmp; +ksock_peer_t *peer;list_for_each (tmp, peer_list) {
@@ -203,7 +203,7 @@ ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id)ksock_peer_t *ksocknal_find_peer (lnet_ni_t *ni,lnet_process_id_t id) { -ksock_peer_t *peer; +ksock_peer_t *peer;read_lock (&ksocknal_data.ksnd_global_lock); peer =ksocknal_find_peer_locked (ni, id);
@@ -217,8 +217,8 @@ ksocknal_find_peer(lnet_ni_t *ni, lnet_process_id_t id)static void ksocknal_unlink_peer_locked (ksock_peer_t *peer) { -int i; -__u32 ip; +int i; +__u32 ip;ksock_interface_t *iface;for (i =0 ; i < peer->ksnp_n_passive_ips; i++) {
@@ -249,13 +249,13 @@ ksocknal_get_peer_info(lnet_ni_t *ni, int index, lnet_process_id_t *id, __u32 *myip, __u32 *peer_ip, int *port, int *conn_count, int *share_count) { -ksock_peer_t *peer; -struct list_head *ptmp; -ksock_route_t *route; -struct list_head *rtmp; -int i; -int j; -int rc = -ENOENT ; +ksock_peer_t *peer; +struct list_head *ptmp; +ksock_route_t *route; +struct list_head *rtmp; +int i; +int j; +int rc = -ENOENT ;read_lock (&ksocknal_data.ksnd_global_lock);
@@ -322,8 +322,8 @@ ksocknal_get_peer_info(lnet_ni_t *ni, int index,static void ksocknal_associate_route_conn_locked (ksock_route_t *route,ksock_conn_t *conn) { -ksock_peer_t *peer = route->ksnr_peer; -int type = conn->ksnc_type; +ksock_peer_t *peer = route->ksnr_peer; +int type = conn->ksnc_type;ksock_interface_t *iface; conn->ksnc_route = route;
@@ -366,9 +366,9 @@ ksocknal_associate_route_conn_locked(ksock_route_t *route, ksock_conn_t *conn)static void ksocknal_add_route_locked (ksock_peer_t *peer,ksock_route_t *route) { -struct list_head *tmp; -ksock_conn_t *conn; -ksock_route_t *route2; +struct list_head *tmp; +ksock_conn_t *conn; +ksock_route_t *route2;LASSERT (!peer->ksnp_closing);LASSERT (route->ksnr_peer ==NULL );
@@ -407,11 +407,11 @@ ksocknal_add_route_locked(ksock_peer_t *peer, ksock_route_t *route)static void ksocknal_del_route_locked (ksock_route_t *route) { -ksock_peer_t *peer = route->ksnr_peer; +ksock_peer_t *peer = route->ksnr_peer;ksock_interface_t *iface; -ksock_conn_t *conn; -struct list_head *ctmp; -struct list_head *cnxt; +ksock_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt;LASSERT (!route->ksnr_deleted);
@@ -447,12 +447,12 @@ ksocknal_del_route_locked(ksock_route_t *route)int ksocknal_add_peer (lnet_ni_t *ni,lnet_process_id_t id,__u32 ipaddr,int port) { -struct list_head *tmp; -ksock_peer_t *peer; -ksock_peer_t *peer2; -ksock_route_t *route; -ksock_route_t *route2; -int rc; +struct list_head *tmp; +ksock_peer_t *peer; +ksock_peer_t *peer2; +ksock_route_t *route; +ksock_route_t *route2; +int rc;if (id.nid ==LNET_NID_ANY || id.pid ==LNET_PID_ANY )
@@ -509,11 +509,11 @@ ksocknal_add_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ipaddr, int port)static void ksocknal_del_peer_locked (ksock_peer_t *peer,__u32 ip) { -ksock_conn_t *conn; -ksock_route_t *route; -struct list_head *tmp; -struct list_head *nxt; -int nshared; +ksock_conn_t *conn; +ksock_route_t *route; +struct list_head *tmp; +struct list_head *nxt; +int nshared;LASSERT (!peer->ksnp_closing);
@@ -565,13 +565,13 @@ static int ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip) {LIST_HEAD (zombies); -struct list_head *ptmp; -struct list_head *pnxt; -ksock_peer_t *peer; -int lo; -int hi; -int i; -int rc = -ENOENT ; +struct list_head *ptmp; +struct list_head *pnxt; +ksock_peer_t *peer; +int lo; +int hi; +int i; +int rc = -ENOENT ;write_lock_bh (&ksocknal_data.ksnd_global_lock);
@@ -623,11 +623,11 @@ ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip)static ksock_conn_t *ksocknal_get_conn_by_idx (lnet_ni_t *ni,int index) { -ksock_peer_t *peer; -struct list_head *ptmp; -ksock_conn_t *conn; -struct list_head *ctmp; -int i; +ksock_peer_t *peer; +struct list_head *ptmp; +ksock_conn_t *conn; +struct list_head *ctmp; +int i;read_lock (&ksocknal_data.ksnd_global_lock);
@@ -661,8 +661,8 @@ static ksock_sched_t * ksocknal_choose_scheduler_locked(unsigned int cpt) {struct ksock_sched_info *info = ksocknal_data.ksnd_sched_info[cpt]; -ksock_sched_t *sched; -int i; +ksock_sched_t *sched; +int i;LASSERT (info->ksi_nthreads >0 );
@@ -683,9 +683,9 @@ ksocknal_choose_scheduler_locked(unsigned int cpt)static int ksocknal_local_ipvec (lnet_ni_t *ni,__u32 *ipaddrs) { -ksock_net_t *net = ni->ni_data; -int i; -int nip; +ksock_net_t *net = ni->ni_data; +int i; +int nip;read_lock (&ksocknal_data.ksnd_global_lock);
@@ -711,12 +711,12 @@ ksocknal_local_ipvec(lnet_ni_t *ni, __u32 *ipaddrs)static int ksocknal_match_peerip (ksock_interface_t *iface,__u32 *ips,int nips) { -int best_netmatch =0 ; -int best_xor =0 ; -int best =-1 ; -int this_xor; -int this_netmatch; -int i; +int best_netmatch =0 ; +int best_xor =0 ; +int best =-1 ; +int this_xor; +int this_netmatch; +int i;for (i =0 ; i < nips; i++) {if (ips[i] ==0 )
@@ -743,19 +743,19 @@ ksocknal_match_peerip(ksock_interface_t *iface, __u32 *ips, int nips)static int ksocknal_select_ips (ksock_peer_t *peer,__u32 *peerips,int n_peerips) { -rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; -ksock_net_t *net = peer->ksnp_ni->ni_data; -ksock_interface_t *iface; -ksock_interface_t *best_iface; -int n_ips; -int i; -int j; -int k; -__u32 ip; -__u32 xor; -int this_netmatch; -int best_netmatch; -int best_npeers; +rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; +ksock_net_t *net = peer->ksnp_ni->ni_data; +ksock_interface_t *iface; +ksock_interface_t *best_iface; +int n_ips; +int i; +int j; +int k; +__u32 ip; +__u32 xor; +int this_netmatch; +int best_netmatch; +int best_npeers;/* CAVEAT EMPTOR: We do all our interface matching with an * exclusive hold of global lock at IRQ priority. We're only
@@ -846,19 +846,19 @@ static void ksocknal_create_routes(ksock_peer_t *peer, int port, __u32 *peer_ipaddrs, int npeer_ipaddrs) { -ksock_route_t *newroute =NULL ; -rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; -lnet_ni_t *ni = peer->ksnp_ni; -ksock_net_t *net = ni->ni_data; -struct list_head *rtmp; -ksock_route_t *route; -ksock_interface_t *iface; -ksock_interface_t *best_iface; -int best_netmatch; -int this_netmatch; -int best_nroutes; -int i; -int j; +ksock_route_t *newroute =NULL ; +rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; +lnet_ni_t *ni = peer->ksnp_ni; +ksock_net_t *net = ni->ni_data; +struct list_head *rtmp; +ksock_route_t *route; +ksock_interface_t *iface; +ksock_interface_t *best_iface; +int best_netmatch; +int this_netmatch; +int best_nroutes; +int i; +int j;/* CAVEAT EMPTOR: We do all our interface matching with an * exclusive hold of global lock at IRQ priority. We're only
@@ -963,10 +963,10 @@ ksocknal_create_routes(ksock_peer_t *peer, int port,int ksocknal_accept (lnet_ni_t *ni,struct socket *sock) { -ksock_connreq_t *cr; -int rc; -__u32 peer_ip; -int peer_port; +ksock_connreq_t *cr; +int rc; +__u32 peer_ip; +int peer_port; rc =libcfs_sock_getaddr (sock,1 , &peer_ip, &peer_port);LASSERT (rc ==0 );/* we succeeded before */
@@ -994,7 +994,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)static int ksocknal_connecting (ksock_peer_t *peer,__u32 ipaddr) { -ksock_route_t *route; +ksock_route_t *route;list_for_each_entry (route, &peer->ksnp_routes, ksnr_list) {
@@ -1008,23 +1008,23 @@ intksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, struct socket *sock, int type) { -rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; +rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock;LIST_HEAD (zombies); -lnet_process_id_t peerid; -struct list_head *tmp; -__u64 incarnation; -ksock_conn_t *conn; -ksock_conn_t *conn2; -ksock_peer_t *peer =NULL ; -ksock_peer_t *peer2; -ksock_sched_t *sched; +lnet_process_id_t peerid; +struct list_head *tmp; +__u64 incarnation; +ksock_conn_t *conn; +ksock_conn_t *conn2; +ksock_peer_t *peer =NULL ; +ksock_peer_t *peer2; +ksock_sched_t *sched;ksock_hello_msg_t *hello; -int cpt; -ksock_tx_t *tx; -ksock_tx_t *txtmp; -int rc; -int active; -char *warn =NULL ; +int cpt; +ksock_tx_t *tx; +ksock_tx_t *txtmp; +int rc; +int active; +char *warn =NULL ; active = (route !=NULL );
@@ -1396,10 +1396,10 @@ ksocknal_close_conn_locked(ksock_conn_t *conn, int error)/* This just does the immmediate housekeeping, and queues the * connection for the reaper to terminate. * Caller holds ksnd_global_lock exclusively in irq context */ -ksock_peer_t *peer = conn->ksnc_peer; -ksock_route_t *route; -ksock_conn_t *conn2; -struct list_head *tmp; +ksock_peer_t *peer = conn->ksnc_peer; +ksock_route_t *route; +ksock_conn_t *conn2; +struct list_head *tmp;LASSERT (peer->ksnp_error ==0 );LASSERT (!conn->ksnc_closing);
@@ -1479,7 +1479,7 @@ ksocknal_close_conn_locked(ksock_conn_t *conn, int error)void ksocknal_peer_failed (ksock_peer_t *peer) { -int notify =0 ; +int notify =0 ;unsigned long last_alive =0 ;/* There has been a connection failure or comms error; but I'll only
@@ -1506,9 +1506,9 @@ ksocknal_peer_failed(ksock_peer_t *peer)void ksocknal_finalize_zcreq (ksock_conn_t *conn) { -ksock_peer_t *peer = conn->ksnc_peer; -ksock_tx_t *tx; -ksock_tx_t *tmp; +ksock_peer_t *peer = conn->ksnc_peer; +ksock_tx_t *tx; +ksock_tx_t *tmp;LIST_HEAD (zlist);/* NB safe to finalize TXs because closing of socket will
@@ -1546,9 +1546,9 @@ ksocknal_terminate_conn(ksock_conn_t *conn)* disengage the socket from its callbacks and close it. * ksnc_refcount will eventually hit zero, and then the reaper will * destroy it. */ -ksock_peer_t *peer = conn->ksnc_peer; -ksock_sched_t *sched = conn->ksnc_scheduler; -int failed =0 ; +ksock_peer_t *peer = conn->ksnc_peer; +ksock_sched_t *sched = conn->ksnc_scheduler; +int failed =0 ;LASSERT (conn->ksnc_closing);
@@ -1617,7 +1617,7 @@ ksocknal_queue_zombie_conn(ksock_conn_t *conn)void ksocknal_destroy_conn (ksock_conn_t *conn) { -unsigned long last_rcv; +unsigned long last_rcv;/* Final coup-de-grace of the reaper */ CDEBUG (D_NET ,"connection %p\n" , conn);
@@ -1677,10 +1677,10 @@ ksocknal_destroy_conn(ksock_conn_t *conn)int ksocknal_close_peer_conns_locked (ksock_peer_t *peer,__u32 ipaddr,int why) { -ksock_conn_t *conn; -struct list_head *ctmp; -struct list_head *cnxt; -int count =0 ; +ksock_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt; +int count =0 ;list_for_each_safe (ctmp, cnxt, &peer->ksnp_conns) { conn =list_entry (ctmp, ksock_conn_t, ksnc_list);
@@ -1698,9 +1698,9 @@ ksocknal_close_peer_conns_locked(ksock_peer_t *peer, __u32 ipaddr, int why)int ksocknal_close_conn_and_siblings (ksock_conn_t *conn,int why) { -ksock_peer_t *peer = conn->ksnc_peer; -__u32 ipaddr = conn->ksnc_ipaddr; -int count; +ksock_peer_t *peer = conn->ksnc_peer; +__u32 ipaddr = conn->ksnc_ipaddr; +int count;write_lock_bh (&ksocknal_data.ksnd_global_lock);
@@ -1714,13 +1714,13 @@ ksocknal_close_conn_and_siblings(ksock_conn_t *conn, int why)int ksocknal_close_matching_conns (lnet_process_id_t id,__u32 ipaddr) { -ksock_peer_t *peer; -struct list_head *ptmp; -struct list_head *pnxt; -int lo; -int hi; -int i; -int count =0 ; +ksock_peer_t *peer; +struct list_head *ptmp; +struct list_head *pnxt; +int lo; +int hi; +int i; +int count =0 ;write_lock_bh (&ksocknal_data.ksnd_global_lock);
@@ -1762,7 +1762,7 @@ ksocknal_notify(lnet_ni_t *ni, lnet_nid_t gw_nid, int alive) {/* The router is telling me she's been notified of a change in * gateway state.... */ -lnet_process_id_t id = {0 }; +lnet_process_id_t id = {0 }; id.nid = gw_nid; id.pid =LNET_PID_ANY ;
@@ -1783,20 +1783,20 @@ ksocknal_notify(lnet_ni_t *ni, lnet_nid_t gw_nid, int alive)void ksocknal_query (lnet_ni_t *ni,lnet_nid_t nid,unsigned long *when) { -int connect =1 ; -unsigned long last_alive =0 ; -unsigned long now =cfs_time_current (); -ksock_peer_t *peer =NULL ; -rwlock_t *glock = &ksocknal_data.ksnd_global_lock; -lnet_process_id_t id = {.nid = nid, .pid =LUSTRE_SRV_LNET_PID }; +int connect =1 ; +unsigned long last_alive =0 ; +unsigned long now =cfs_time_current (); +ksock_peer_t *peer =NULL ; +rwlock_t *glock = &ksocknal_data.ksnd_global_lock; +lnet_process_id_t id = {.nid = nid, .pid =LUSTRE_SRV_LNET_PID };read_lock (glock); peer =ksocknal_find_peer_locked (ni, id);if (peer !=NULL ) { -struct list_head *tmp; -ksock_conn_t *conn; -int bufnob; +struct list_head *tmp; +ksock_conn_t *conn; +int bufnob;list_for_each (tmp, &peer->ksnp_conns) { conn =list_entry (tmp, ksock_conn_t, ksnc_list);
@@ -1844,10 +1844,10 @@ ksocknal_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)static void ksocknal_push_peer (ksock_peer_t *peer) { -int index; -int i; -struct list_head *tmp; -ksock_conn_t *conn; +int index; +int i; +struct list_head *tmp; +ksock_conn_t *conn;for (index =0 ; ; index++) {read_lock (&ksocknal_data.ksnd_global_lock);
@@ -1877,12 +1877,12 @@ ksocknal_push_peer(ksock_peer_t *peer)static int ksocknal_push (lnet_ni_t *ni,lnet_process_id_t id) { -ksock_peer_t *peer; -struct list_head *tmp; -int index; -int i; -int j; -int rc = -ENOENT ; +ksock_peer_t *peer; +struct list_head *tmp; +int index; +int i; +int j; +int rc = -ENOENT ;for (i =0 ; i < ksocknal_data.ksnd_peer_hash_size; i++) {for (j =0 ; ; j++) {
@@ -1926,15 +1926,15 @@ ksocknal_push(lnet_ni_t *ni, lnet_process_id_t id)static int ksocknal_add_interface (lnet_ni_t *ni,__u32 ipaddress,__u32 netmask) { -ksock_net_t *net = ni->ni_data; +ksock_net_t *net = ni->ni_data;ksock_interface_t *iface; -int rc; -int i; -int j; -struct list_head *ptmp; -ksock_peer_t *peer; -struct list_head *rtmp; -ksock_route_t *route; +int rc; +int i; +int j; +struct list_head *ptmp; +ksock_peer_t *peer; +struct list_head *rtmp; +ksock_route_t *route;if (ipaddress ==0 || netmask ==0 )
@@ -1988,12 +1988,12 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, __u32 netmask)static void ksocknal_peer_del_interface_locked (ksock_peer_t *peer,__u32 ipaddr) { -struct list_head *tmp; -struct list_head *nxt; -ksock_route_t *route; -ksock_conn_t *conn; -int i; -int j; +struct list_head *tmp; +struct list_head *nxt; +ksock_route_t *route; +ksock_conn_t *conn; +int i; +int j;for (i =0 ; i < peer->ksnp_n_passive_ips; i++)if (peer->ksnp_passive_ips[i] == ipaddr) {
@@ -2029,14 +2029,14 @@ ksocknal_peer_del_interface_locked(ksock_peer_t *peer, __u32 ipaddr)static int ksocknal_del_interface (lnet_ni_t *ni,__u32 ipaddress) { -ksock_net_t *net = ni->ni_data; -int rc = -ENOENT ; -struct list_head *tmp; -struct list_head *nxt; -ksock_peer_t *peer; -__u32 this_ip; -int i; -int j; +ksock_net_t *net = ni->ni_data; +int rc = -ENOENT ; +struct list_head *tmp; +struct list_head *nxt; +ksock_peer_t *peer; +__u32 this_ip; +int i; +int j;write_lock_bh (&ksocknal_data.ksnd_global_lock);
@@ -2114,11 +2114,11 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) data->ioc_u32[0]); /* IP address */case IOC_LIBCFS_GET_PEER : { -__u32 myip =0 ; -__u32 ip =0 ; -int port =0 ; -int conn_count =0 ; -int share_count =0 ; +__u32 myip =0 ; +__u32 ip =0 ; +int port =0 ; +int conn_count =0 ; +int share_count =0 ; rc = ksocknal_get_peer_info(ni, data->ioc_count, &id, &myip, &ip, &port,
@@ -2150,9 +2150,9 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) data->ioc_u32[0]); /* IP */case IOC_LIBCFS_GET_CONN : { -int txmem; -int rxmem; -int nagle; +int txmem; +int rxmem; +int nagle;ksock_conn_t *conn =ksocknal_get_conn_by_idx (ni, data->ioc_count);if (conn ==NULL )
@@ -2207,8 +2207,8 @@ ksocknal_free_buffers(void)LASSERT (atomic_read (&ksocknal_data.ksnd_nactive_txs) ==0 );if (ksocknal_data.ksnd_sched_info !=NULL ) { -struct ksock_sched_info *info; -int i; +struct ksock_sched_info *info; +int i;cfs_percpt_for_each (info, i, ksocknal_data.ksnd_sched_info) {if (info->ksi_scheds !=NULL ) {
@@ -2227,8 +2227,8 @@ ksocknal_free_buffers(void)spin_lock (&ksocknal_data.ksnd_tx_lock);if (!list_empty (&ksocknal_data.ksnd_idle_noop_txs)) { -struct list_head zlist; -ksock_tx_t *tx; +struct list_head zlist; +ksock_tx_t *tx;list_add (&zlist, &ksocknal_data.ksnd_idle_noop_txs);list_del_init (&ksocknal_data.ksnd_idle_noop_txs);
@@ -2248,9 +2248,9 @@ static voidksocknal_base_shutdown (void) {struct ksock_sched_info *info; -ksock_sched_t *sched; -int i; -int j; +ksock_sched_t *sched; +int i; +int j;CDEBUG (D_MALLOC ,"before NAL cleanup: kmem %d\n" ,atomic_read (&libcfs_kmemory));
@@ -2351,8 +2351,8 @@ static intksocknal_base_startup (void) {struct ksock_sched_info *info; -int rc; -int i; +int rc; +int i;LASSERT (ksocknal_data.ksnd_init ==SOCKNAL_INIT_NOTHING );LASSERT (ksocknal_data.ksnd_nnets ==0 );
@@ -2398,8 +2398,8 @@ ksocknal_base_startup(void) goto failed;cfs_percpt_for_each (info, i, ksocknal_data.ksnd_sched_info) { -ksock_sched_t *sched; -int nthrs; +ksock_sched_t *sched; +int nthrs; nthrs =cfs_cpt_weight (lnet_cpt_table (), i);if (*ksocknal_tunables.ksnd_nscheds >0 ) {
@@ -2430,9 +2430,9 @@ ksocknal_base_startup(void) } } - ksocknal_data.ksnd_connd_starting =0 ; - ksocknal_data.ksnd_connd_failed_stamp =0 ; - ksocknal_data.ksnd_connd_starting_stamp =get_seconds (); + ksocknal_data.ksnd_connd_starting =0 ; + ksocknal_data.ksnd_connd_failed_stamp =0 ; + ksocknal_data.ksnd_connd_starting_stamp =get_seconds ();/* must have at least 2 connds to remain responsive to accepts while * connecting */ if (*ksocknal_tunables.ksnd_nconnds <SOCKNAL_CONND_RESV +1 )
@@ -2482,9 +2482,9 @@ ksocknal_base_startup(void)static void ksocknal_debug_peerhash (lnet_ni_t *ni) { -ksock_peer_t *peer =NULL ; -struct list_head *tmp; -int i; +ksock_peer_t *peer =NULL ; +struct list_head *tmp; +int i;read_lock (&ksocknal_data.ksnd_global_lock);
@@ -2536,12 +2536,12 @@ ksocknal_debug_peerhash(lnet_ni_t *ni)void ksocknal_shutdown (lnet_ni_t *ni) { -ksock_net_t *net = ni->ni_data; -int i; +ksock_net_t *net = ni->ni_data; +int i;lnet_process_id_t anyid = {0 }; - anyid.nid =LNET_NID_ANY ; - anyid.pid =LNET_PID_ANY ; + anyid.nid =LNET_NID_ANY ; + anyid.pid =LNET_PID_ANY ;LASSERT (ksocknal_data.ksnd_init ==SOCKNAL_INIT_ALL );LASSERT (ksocknal_data.ksnd_nnets >0 );
@@ -2588,11 +2588,11 @@ ksocknal_shutdown(lnet_ni_t *ni)static int ksocknal_enumerate_interfaces (ksock_net_t *net) { -char **names; -int i; -int j; -int rc; -int n; +char **names; +int i; +int j; +int rc; +int n; n =libcfs_ipif_enumerate (&names);if (n <=0 ) {
@@ -2601,9 +2601,9 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) }for (i = j =0 ; i < n; i++) { -int up; -__u32 ip; -__u32 mask; +int up; +__u32 ip; +__u32 mask;if (!strcmp (names[i],"lo" ))/* skip the loopback IF */ continue ;
@@ -2645,15 +2645,15 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)static int ksocknal_search_new_ipif (ksock_net_t *net) { -int new_ipif =0 ; -int i; +int new_ipif =0 ; +int i;for (i =0 ; i < net->ksnn_ninterfaces; i++) { -char *ifnam = &net->ksnn_interfaces[i].ksni_name[0 ]; -char *colon =strchr (ifnam,':' ); -int found =0 ; -ksock_net_t *tmp; -int j; +char *ifnam = &net->ksnn_interfaces[i].ksni_name[0 ]; +char *colon =strchr (ifnam,':' ); +int found =0 ; +ksock_net_t *tmp; +int j;if (colon !=NULL )/* ignore alias device */ *colon =0 ;
@@ -2687,9 +2687,9 @@ ksocknal_search_new_ipif(ksock_net_t *net)static int ksocknal_start_schedulers (struct ksock_sched_info *info) { -int nthrs; -int rc =0 ; -int i; +int nthrs; +int rc =0 ; +int i;if (info->ksi_nthreads ==0 ) {if (*ksocknal_tunables.ksnd_nscheds >0 ) {
@@ -2708,9 +2708,9 @@ ksocknal_start_schedulers(struct ksock_sched_info *info) }for (i =0 ; i < nthrs; i++) { -long id; -char name[20 ]; -ksock_sched_t *sched; +long id; +char name[20 ]; +ksock_sched_t *sched; id =KSOCK_THREAD_ID (info->ksi_cpt, info->ksi_nthreads + i); sched = &info->ksi_scheds[KSOCK_THREAD_SID (id)]; snprintf(name, sizeof(name), "socknal_sd%02d_%02d",
@@ -2733,14 +2733,14 @@ ksocknal_start_schedulers(struct ksock_sched_info *info)static int ksocknal_net_start_threads (ksock_net_t *net,__u32 *cpts,int ncpts) { -int newif =ksocknal_search_new_ipif (net); -int rc; -int i; +int newif =ksocknal_search_new_ipif (net); +int rc; +int i;LASSERT (ncpts >0 && ncpts <=cfs_cpt_number (lnet_cpt_table ()));for (i =0 ; i < ncpts; i++) { -struct ksock_sched_info *info; +struct ksock_sched_info *info;int cpt = (cpts ==NULL ) ? i : cpts[i];LASSERT (cpt <cfs_cpt_number (lnet_cpt_table ()));
@@ -2759,9 +2759,9 @@ ksocknal_net_start_threads(ksock_net_t *net, __u32 *cpts, int ncpts)int ksocknal_startup (lnet_ni_t *ni) { -ksock_net_t *net; -int rc; -int i; +ksock_net_t *net; +int rc; +int i;LASSERT (ni->ni_lnd == &the_ksocklnd);
@@ -2791,7 +2791,7 @@ ksocknal_startup(lnet_ni_t *ni) net->ksnn_ninterfaces =1 ; }else {for (i =0 ; i <LNET_MAX_INTERFACES ; i++) { -int up; +int up;if (ni->ni_interfaces[i] ==NULL )break ;
@@ -2851,7 +2851,7 @@ ksocknal_module_fini(void)static int __init ksocknal_module_init (void ) { -int rc; +int rc;/* check ksnr_connected/connecting field large enough */ CLASSERT (SOCKLND_CONN_NTYPES <=4 );
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +313 -247
649 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +198 -198
832 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +75 -75
285 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +15 -18
@@ -145,40 +145,37 @@ ksock_tunables_t ksocknal_tunables;int ksocknal_tunables_init (void ) { -/* initialize ksocknal_tunables structure */ - ksocknal_tunables.ksnd_timeout = &sock_timeout; - ksocknal_tunables.ksnd_nscheds = &nscheds; - ksocknal_tunables.ksnd_nconnds = &nconnds; - ksocknal_tunables.ksnd_nconnds_max = &nconnds_max; + ksocknal_tunables.ksnd_timeout = &sock_timeout; + ksocknal_tunables.ksnd_nscheds = &nscheds; + ksocknal_tunables.ksnd_nconnds = &nconnds; + ksocknal_tunables.ksnd_nconnds_max = &nconnds_max; ksocknal_tunables.ksnd_min_reconnectms = &min_reconnectms; ksocknal_tunables.ksnd_max_reconnectms = &max_reconnectms; - ksocknal_tunables.ksnd_eager_ack = &eager_ack; - ksocknal_tunables.ksnd_typed_conns = &typed_conns; - ksocknal_tunables.ksnd_min_bulk = &min_bulk; + ksocknal_tunables.ksnd_eager_ack = &eager_ack; + ksocknal_tunables.ksnd_typed_conns = &typed_conns; + ksocknal_tunables.ksnd_min_bulk = &min_bulk; ksocknal_tunables.ksnd_tx_buffer_size = &tx_buffer_size; ksocknal_tunables.ksnd_rx_buffer_size = &rx_buffer_size; - ksocknal_tunables.ksnd_nagle = &nagle; - ksocknal_tunables.ksnd_round_robin = &round_robin; - ksocknal_tunables.ksnd_keepalive = &keepalive; + ksocknal_tunables.ksnd_nagle = &nagle; + ksocknal_tunables.ksnd_round_robin = &round_robin; + ksocknal_tunables.ksnd_keepalive = &keepalive; ksocknal_tunables.ksnd_keepalive_idle = &keepalive_idle; ksocknal_tunables.ksnd_keepalive_count = &keepalive_count; ksocknal_tunables.ksnd_keepalive_intvl = &keepalive_intvl; - ksocknal_tunables.ksnd_credits = &credits; + ksocknal_tunables.ksnd_credits = &credits; ksocknal_tunables.ksnd_peertxcredits = &peer_credits; ksocknal_tunables.ksnd_peerrtrcredits = &peer_buffer_credits; - ksocknal_tunables.ksnd_peertimeout = &peer_timeout; - ksocknal_tunables.ksnd_enable_csum = &enable_csum; + ksocknal_tunables.ksnd_peertimeout = &peer_timeout; + ksocknal_tunables.ksnd_enable_csum = &enable_csum; ksocknal_tunables.ksnd_inject_csum_error = &inject_csum_error; ksocknal_tunables.ksnd_nonblk_zcack = &nonblk_zcack; ksocknal_tunables.ksnd_zc_min_payload = &zc_min_payload; - ksocknal_tunables.ksnd_zc_recv = &zc_recv; + ksocknal_tunables.ksnd_zc_recv = &zc_recv; ksocknal_tunables.ksnd_zc_recv_min_nfrags = &zc_recv_min_nfrags; - -#if SOCKNAL_VERSION_DEBUG - ksocknal_tunables.ksnd_protocol = &protocol; + ksocknal_tunables.ksnd_protocol = &protocol;#endif if (*ksocknal_tunables.ksnd_zc_min_payload < (2 <<10 ))
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +64 -64
213 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 6/13 staging: lustre: lnet: socklnd: code cleanup - align spacing
In reply to Mike ShueyUnify variable declarations to use a single space. Also include several miscellaneous whitespace cleanups, particularly in socklnd.h.
--- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 468 ++++++++-------- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 560 +++++++++++--------- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 396 +++++++------- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 150 +++--- .../lustre/lnet/klnds/socklnd/socklnd_modparams.c | 33 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 128 +++--- 6 files changed, 899 insertions(+), 836 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +234 -234
@@ -49,8 +49,8 @@ ksock_nal_data_t ksocknal_data;static ksock_interface_t *ksocknal_ip2iface (lnet_ni_t *ni,__u32 ip) { -ksock_net_t *net = ni->ni_data; -int i; +ksock_net_t *net = ni->ni_data; +int i;ksock_interface_t *iface;for (i =0 ; i < net->ksnn_ninterfaces; i++) {
@@ -102,8 +102,8 @@ ksocknal_destroy_route(ksock_route_t *route)static int ksocknal_create_peer (ksock_peer_t **peerp,lnet_ni_t *ni,lnet_process_id_t id) { -ksock_net_t *net = ni->ni_data; -ksock_peer_t *peer; +ksock_net_t *net = ni->ni_data; +ksock_peer_t *peer;LASSERT (id.nid !=LNET_NID_ANY );LASSERT (id.pid !=LNET_PID_ANY );
@@ -149,7 +149,7 @@ ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)void ksocknal_destroy_peer (ksock_peer_t *peer) { -ksock_net_t *net = peer->ksnp_ni->ni_data; +ksock_net_t *net = peer->ksnp_ni->ni_data;CDEBUG (D_NET ,"peer %s %p deleted\n" ,libcfs_id2str (peer->ksnp_id), peer);
@@ -175,9 +175,9 @@ ksocknal_destroy_peer(ksock_peer_t *peer)ksock_peer_t *ksocknal_find_peer_locked (lnet_ni_t *ni,lnet_process_id_t id) { -struct list_head *peer_list =ksocknal_nid2peerlist (id.nid); -struct list_head *tmp; -ksock_peer_t *peer; +struct list_head *peer_list =ksocknal_nid2peerlist (id.nid); +struct list_head *tmp; +ksock_peer_t *peer;list_for_each (tmp, peer_list) {
@@ -203,7 +203,7 @@ ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id)ksock_peer_t *ksocknal_find_peer (lnet_ni_t *ni,lnet_process_id_t id) { -ksock_peer_t *peer; +ksock_peer_t *peer;read_lock (&ksocknal_data.ksnd_global_lock); peer =ksocknal_find_peer_locked (ni, id);
@@ -217,8 +217,8 @@ ksocknal_find_peer(lnet_ni_t *ni, lnet_process_id_t id)static void ksocknal_unlink_peer_locked (ksock_peer_t *peer) { -int i; -__u32 ip; +int i; +__u32 ip;ksock_interface_t *iface;for (i =0 ; i < peer->ksnp_n_passive_ips; i++) {
@@ -249,13 +249,13 @@ ksocknal_get_peer_info(lnet_ni_t *ni, int index, lnet_process_id_t *id, __u32 *myip, __u32 *peer_ip, int *port, int *conn_count, int *share_count) { -ksock_peer_t *peer; -struct list_head *ptmp; -ksock_route_t *route; -struct list_head *rtmp; -int i; -int j; -int rc = -ENOENT ; +ksock_peer_t *peer; +struct list_head *ptmp; +ksock_route_t *route; +struct list_head *rtmp; +int i; +int j; +int rc = -ENOENT ;read_lock (&ksocknal_data.ksnd_global_lock);
@@ -322,8 +322,8 @@ ksocknal_get_peer_info(lnet_ni_t *ni, int index,static void ksocknal_associate_route_conn_locked (ksock_route_t *route,ksock_conn_t *conn) { -ksock_peer_t *peer = route->ksnr_peer; -int type = conn->ksnc_type; +ksock_peer_t *peer = route->ksnr_peer; +int type = conn->ksnc_type;ksock_interface_t *iface; conn->ksnc_route = route;
@@ -366,9 +366,9 @@ ksocknal_associate_route_conn_locked(ksock_route_t *route, ksock_conn_t *conn)static void ksocknal_add_route_locked (ksock_peer_t *peer,ksock_route_t *route) { -struct list_head *tmp; -ksock_conn_t *conn; -ksock_route_t *route2; +struct list_head *tmp; +ksock_conn_t *conn; +ksock_route_t *route2;LASSERT (!peer->ksnp_closing);LASSERT (route->ksnr_peer ==NULL );
@@ -407,11 +407,11 @@ ksocknal_add_route_locked(ksock_peer_t *peer, ksock_route_t *route)static void ksocknal_del_route_locked (ksock_route_t *route) { -ksock_peer_t *peer = route->ksnr_peer; +ksock_peer_t *peer = route->ksnr_peer;ksock_interface_t *iface; -ksock_conn_t *conn; -struct list_head *ctmp; -struct list_head *cnxt; +ksock_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt;LASSERT (!route->ksnr_deleted);
@@ -447,12 +447,12 @@ ksocknal_del_route_locked(ksock_route_t *route)int ksocknal_add_peer (lnet_ni_t *ni,lnet_process_id_t id,__u32 ipaddr,int port) { -struct list_head *tmp; -ksock_peer_t *peer; -ksock_peer_t *peer2; -ksock_route_t *route; -ksock_route_t *route2; -int rc; +struct list_head *tmp; +ksock_peer_t *peer; +ksock_peer_t *peer2; +ksock_route_t *route; +ksock_route_t *route2; +int rc;if (id.nid ==LNET_NID_ANY || id.pid ==LNET_PID_ANY )
@@ -509,11 +509,11 @@ ksocknal_add_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ipaddr, int port)static void ksocknal_del_peer_locked (ksock_peer_t *peer,__u32 ip) { -ksock_conn_t *conn; -ksock_route_t *route; -struct list_head *tmp; -struct list_head *nxt; -int nshared; +ksock_conn_t *conn; +ksock_route_t *route; +struct list_head *tmp; +struct list_head *nxt; +int nshared;LASSERT (!peer->ksnp_closing);
@@ -565,13 +565,13 @@ static int ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip) {LIST_HEAD (zombies); -struct list_head *ptmp; -struct list_head *pnxt; -ksock_peer_t *peer; -int lo; -int hi; -int i; -int rc = -ENOENT ; +struct list_head *ptmp; +struct list_head *pnxt; +ksock_peer_t *peer; +int lo; +int hi; +int i; +int rc = -ENOENT ;write_lock_bh (&ksocknal_data.ksnd_global_lock);
@@ -623,11 +623,11 @@ ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip)static ksock_conn_t *ksocknal_get_conn_by_idx (lnet_ni_t *ni,int index) { -ksock_peer_t *peer; -struct list_head *ptmp; -ksock_conn_t *conn; -struct list_head *ctmp; -int i; +ksock_peer_t *peer; +struct list_head *ptmp; +ksock_conn_t *conn; +struct list_head *ctmp; +int i;read_lock (&ksocknal_data.ksnd_global_lock);
@@ -661,8 +661,8 @@ static ksock_sched_t * ksocknal_choose_scheduler_locked(unsigned int cpt) {struct ksock_sched_info *info = ksocknal_data.ksnd_sched_info[cpt]; -ksock_sched_t *sched; -int i; +ksock_sched_t *sched; +int i;LASSERT (info->ksi_nthreads >0 );
@@ -683,9 +683,9 @@ ksocknal_choose_scheduler_locked(unsigned int cpt)static int ksocknal_local_ipvec (lnet_ni_t *ni,__u32 *ipaddrs) { -ksock_net_t *net = ni->ni_data; -int i; -int nip; +ksock_net_t *net = ni->ni_data; +int i; +int nip;read_lock (&ksocknal_data.ksnd_global_lock);
@@ -711,12 +711,12 @@ ksocknal_local_ipvec(lnet_ni_t *ni, __u32 *ipaddrs)static int ksocknal_match_peerip (ksock_interface_t *iface,__u32 *ips,int nips) { -int best_netmatch =0 ; -int best_xor =0 ; -int best =-1 ; -int this_xor; -int this_netmatch; -int i; +int best_netmatch =0 ; +int best_xor =0 ; +int best =-1 ; +int this_xor; +int this_netmatch; +int i;for (i =0 ; i < nips; i++) {if (ips[i] ==0 )
@@ -743,19 +743,19 @@ ksocknal_match_peerip(ksock_interface_t *iface, __u32 *ips, int nips)static int ksocknal_select_ips (ksock_peer_t *peer,__u32 *peerips,int n_peerips) { -rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; -ksock_net_t *net = peer->ksnp_ni->ni_data; -ksock_interface_t *iface; -ksock_interface_t *best_iface; -int n_ips; -int i; -int j; -int k; -__u32 ip; -__u32 xor; -int this_netmatch; -int best_netmatch; -int best_npeers; +rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; +ksock_net_t *net = peer->ksnp_ni->ni_data; +ksock_interface_t *iface; +ksock_interface_t *best_iface; +int n_ips; +int i; +int j; +int k; +__u32 ip; +__u32 xor; +int this_netmatch; +int best_netmatch; +int best_npeers;/* CAVEAT EMPTOR: We do all our interface matching with an * exclusive hold of global lock at IRQ priority. We're only
@@ -846,19 +846,19 @@ static void ksocknal_create_routes(ksock_peer_t *peer, int port, __u32 *peer_ipaddrs, int npeer_ipaddrs) { -ksock_route_t *newroute =NULL ; -rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; -lnet_ni_t *ni = peer->ksnp_ni; -ksock_net_t *net = ni->ni_data; -struct list_head *rtmp; -ksock_route_t *route; -ksock_interface_t *iface; -ksock_interface_t *best_iface; -int best_netmatch; -int this_netmatch; -int best_nroutes; -int i; -int j; +ksock_route_t *newroute =NULL ; +rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; +lnet_ni_t *ni = peer->ksnp_ni; +ksock_net_t *net = ni->ni_data; +struct list_head *rtmp; +ksock_route_t *route; +ksock_interface_t *iface; +ksock_interface_t *best_iface; +int best_netmatch; +int this_netmatch; +int best_nroutes; +int i; +int j;/* CAVEAT EMPTOR: We do all our interface matching with an * exclusive hold of global lock at IRQ priority. We're only
@@ -963,10 +963,10 @@ ksocknal_create_routes(ksock_peer_t *peer, int port,int ksocknal_accept (lnet_ni_t *ni,struct socket *sock) { -ksock_connreq_t *cr; -int rc; -__u32 peer_ip; -int peer_port; +ksock_connreq_t *cr; +int rc; +__u32 peer_ip; +int peer_port; rc =libcfs_sock_getaddr (sock,1 , &peer_ip, &peer_port);LASSERT (rc ==0 );/* we succeeded before */
@@ -994,7 +994,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)static int ksocknal_connecting (ksock_peer_t *peer,__u32 ipaddr) { -ksock_route_t *route; +ksock_route_t *route;list_for_each_entry (route, &peer->ksnp_routes, ksnr_list) {
@@ -1008,23 +1008,23 @@ intksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route, struct socket *sock, int type) { -rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; +rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock;LIST_HEAD (zombies); -lnet_process_id_t peerid; -struct list_head *tmp; -__u64 incarnation; -ksock_conn_t *conn; -ksock_conn_t *conn2; -ksock_peer_t *peer =NULL ; -ksock_peer_t *peer2; -ksock_sched_t *sched; +lnet_process_id_t peerid; +struct list_head *tmp; +__u64 incarnation; +ksock_conn_t *conn; +ksock_conn_t *conn2; +ksock_peer_t *peer =NULL ; +ksock_peer_t *peer2; +ksock_sched_t *sched;ksock_hello_msg_t *hello; -int cpt; -ksock_tx_t *tx; -ksock_tx_t *txtmp; -int rc; -int active; -char *warn =NULL ; +int cpt; +ksock_tx_t *tx; +ksock_tx_t *txtmp; +int rc; +int active; +char *warn =NULL ; active = (route !=NULL );
@@ -1396,10 +1396,10 @@ ksocknal_close_conn_locked(ksock_conn_t *conn, int error)/* This just does the immmediate housekeeping, and queues the * connection for the reaper to terminate. * Caller holds ksnd_global_lock exclusively in irq context */ -ksock_peer_t *peer = conn->ksnc_peer; -ksock_route_t *route; -ksock_conn_t *conn2; -struct list_head *tmp; +ksock_peer_t *peer = conn->ksnc_peer; +ksock_route_t *route; +ksock_conn_t *conn2; +struct list_head *tmp;LASSERT (peer->ksnp_error ==0 );LASSERT (!conn->ksnc_closing);
@@ -1479,7 +1479,7 @@ ksocknal_close_conn_locked(ksock_conn_t *conn, int error)void ksocknal_peer_failed (ksock_peer_t *peer) { -int notify =0 ; +int notify =0 ;unsigned long last_alive =0 ;/* There has been a connection failure or comms error; but I'll only
@@ -1506,9 +1506,9 @@ ksocknal_peer_failed(ksock_peer_t *peer)void ksocknal_finalize_zcreq (ksock_conn_t *conn) { -ksock_peer_t *peer = conn->ksnc_peer; -ksock_tx_t *tx; -ksock_tx_t *tmp; +ksock_peer_t *peer = conn->ksnc_peer; +ksock_tx_t *tx; +ksock_tx_t *tmp;LIST_HEAD (zlist);/* NB safe to finalize TXs because closing of socket will
@@ -1546,9 +1546,9 @@ ksocknal_terminate_conn(ksock_conn_t *conn)* disengage the socket from its callbacks and close it. * ksnc_refcount will eventually hit zero, and then the reaper will * destroy it. */ -ksock_peer_t *peer = conn->ksnc_peer; -ksock_sched_t *sched = conn->ksnc_scheduler; -int failed =0 ; +ksock_peer_t *peer = conn->ksnc_peer; +ksock_sched_t *sched = conn->ksnc_scheduler; +int failed =0 ;LASSERT (conn->ksnc_closing);
@@ -1617,7 +1617,7 @@ ksocknal_queue_zombie_conn(ksock_conn_t *conn)void ksocknal_destroy_conn (ksock_conn_t *conn) { -unsigned long last_rcv; +unsigned long last_rcv;/* Final coup-de-grace of the reaper */ CDEBUG (D_NET ,"connection %p\n" , conn);
@@ -1677,10 +1677,10 @@ ksocknal_destroy_conn(ksock_conn_t *conn)int ksocknal_close_peer_conns_locked (ksock_peer_t *peer,__u32 ipaddr,int why) { -ksock_conn_t *conn; -struct list_head *ctmp; -struct list_head *cnxt; -int count =0 ; +ksock_conn_t *conn; +struct list_head *ctmp; +struct list_head *cnxt; +int count =0 ;list_for_each_safe (ctmp, cnxt, &peer->ksnp_conns) { conn =list_entry (ctmp, ksock_conn_t, ksnc_list);
@@ -1698,9 +1698,9 @@ ksocknal_close_peer_conns_locked(ksock_peer_t *peer, __u32 ipaddr, int why)int ksocknal_close_conn_and_siblings (ksock_conn_t *conn,int why) { -ksock_peer_t *peer = conn->ksnc_peer; -__u32 ipaddr = conn->ksnc_ipaddr; -int count; +ksock_peer_t *peer = conn->ksnc_peer; +__u32 ipaddr = conn->ksnc_ipaddr; +int count;write_lock_bh (&ksocknal_data.ksnd_global_lock);
@@ -1714,13 +1714,13 @@ ksocknal_close_conn_and_siblings(ksock_conn_t *conn, int why)int ksocknal_close_matching_conns (lnet_process_id_t id,__u32 ipaddr) { -ksock_peer_t *peer; -struct list_head *ptmp; -struct list_head *pnxt; -int lo; -int hi; -int i; -int count =0 ; +ksock_peer_t *peer; +struct list_head *ptmp; +struct list_head *pnxt; +int lo; +int hi; +int i; +int count =0 ;write_lock_bh (&ksocknal_data.ksnd_global_lock);
@@ -1762,7 +1762,7 @@ ksocknal_notify(lnet_ni_t *ni, lnet_nid_t gw_nid, int alive) {/* The router is telling me she's been notified of a change in * gateway state.... */ -lnet_process_id_t id = {0 }; +lnet_process_id_t id = {0 }; id.nid = gw_nid; id.pid =LNET_PID_ANY ;
@@ -1783,20 +1783,20 @@ ksocknal_notify(lnet_ni_t *ni, lnet_nid_t gw_nid, int alive)void ksocknal_query (lnet_ni_t *ni,lnet_nid_t nid,unsigned long *when) { -int connect =1 ; -unsigned long last_alive =0 ; -unsigned long now =cfs_time_current (); -ksock_peer_t *peer =NULL ; -rwlock_t *glock = &ksocknal_data.ksnd_global_lock; -lnet_process_id_t id = {.nid = nid, .pid =LUSTRE_SRV_LNET_PID }; +int connect =1 ; +unsigned long last_alive =0 ; +unsigned long now =cfs_time_current (); +ksock_peer_t *peer =NULL ; +rwlock_t *glock = &ksocknal_data.ksnd_global_lock; +lnet_process_id_t id = {.nid = nid, .pid =LUSTRE_SRV_LNET_PID };read_lock (glock); peer =ksocknal_find_peer_locked (ni, id);if (peer !=NULL ) { -struct list_head *tmp; -ksock_conn_t *conn; -int bufnob; +struct list_head *tmp; +ksock_conn_t *conn; +int bufnob;list_for_each (tmp, &peer->ksnp_conns) { conn =list_entry (tmp, ksock_conn_t, ksnc_list);
@@ -1844,10 +1844,10 @@ ksocknal_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)static void ksocknal_push_peer (ksock_peer_t *peer) { -int index; -int i; -struct list_head *tmp; -ksock_conn_t *conn; +int index; +int i; +struct list_head *tmp; +ksock_conn_t *conn;for (index =0 ; ; index++) {read_lock (&ksocknal_data.ksnd_global_lock);
@@ -1877,12 +1877,12 @@ ksocknal_push_peer(ksock_peer_t *peer)static int ksocknal_push (lnet_ni_t *ni,lnet_process_id_t id) { -ksock_peer_t *peer; -struct list_head *tmp; -int index; -int i; -int j; -int rc = -ENOENT ; +ksock_peer_t *peer; +struct list_head *tmp; +int index; +int i; +int j; +int rc = -ENOENT ;for (i =0 ; i < ksocknal_data.ksnd_peer_hash_size; i++) {for (j =0 ; ; j++) {
@@ -1926,15 +1926,15 @@ ksocknal_push(lnet_ni_t *ni, lnet_process_id_t id)static int ksocknal_add_interface (lnet_ni_t *ni,__u32 ipaddress,__u32 netmask) { -ksock_net_t *net = ni->ni_data; +ksock_net_t *net = ni->ni_data;ksock_interface_t *iface; -int rc; -int i; -int j; -struct list_head *ptmp; -ksock_peer_t *peer; -struct list_head *rtmp; -ksock_route_t *route; +int rc; +int i; +int j; +struct list_head *ptmp; +ksock_peer_t *peer; +struct list_head *rtmp; +ksock_route_t *route;if (ipaddress ==0 || netmask ==0 )
@@ -1988,12 +1988,12 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, __u32 netmask)static void ksocknal_peer_del_interface_locked (ksock_peer_t *peer,__u32 ipaddr) { -struct list_head *tmp; -struct list_head *nxt; -ksock_route_t *route; -ksock_conn_t *conn; -int i; -int j; +struct list_head *tmp; +struct list_head *nxt; +ksock_route_t *route; +ksock_conn_t *conn; +int i; +int j;for (i =0 ; i < peer->ksnp_n_passive_ips; i++)if (peer->ksnp_passive_ips[i] == ipaddr) {
@@ -2029,14 +2029,14 @@ ksocknal_peer_del_interface_locked(ksock_peer_t *peer, __u32 ipaddr)static int ksocknal_del_interface (lnet_ni_t *ni,__u32 ipaddress) { -ksock_net_t *net = ni->ni_data; -int rc = -ENOENT ; -struct list_head *tmp; -struct list_head *nxt; -ksock_peer_t *peer; -__u32 this_ip; -int i; -int j; +ksock_net_t *net = ni->ni_data; +int rc = -ENOENT ; +struct list_head *tmp; +struct list_head *nxt; +ksock_peer_t *peer; +__u32 this_ip; +int i; +int j;write_lock_bh (&ksocknal_data.ksnd_global_lock);
@@ -2114,11 +2114,11 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) data->ioc_u32[0]); /* IP address */case IOC_LIBCFS_GET_PEER : { -__u32 myip =0 ; -__u32 ip =0 ; -int port =0 ; -int conn_count =0 ; -int share_count =0 ; +__u32 myip =0 ; +__u32 ip =0 ; +int port =0 ; +int conn_count =0 ; +int share_count =0 ; rc = ksocknal_get_peer_info(ni, data->ioc_count, &id, &myip, &ip, &port,
@@ -2150,9 +2150,9 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) data->ioc_u32[0]); /* IP */case IOC_LIBCFS_GET_CONN : { -int txmem; -int rxmem; -int nagle; +int txmem; +int rxmem; +int nagle;ksock_conn_t *conn =ksocknal_get_conn_by_idx (ni, data->ioc_count);if (conn ==NULL )
@@ -2207,8 +2207,8 @@ ksocknal_free_buffers(void)LASSERT (atomic_read (&ksocknal_data.ksnd_nactive_txs) ==0 );if (ksocknal_data.ksnd_sched_info !=NULL ) { -struct ksock_sched_info *info; -int i; +struct ksock_sched_info *info; +int i;cfs_percpt_for_each (info, i, ksocknal_data.ksnd_sched_info) {if (info->ksi_scheds !=NULL ) {
@@ -2227,8 +2227,8 @@ ksocknal_free_buffers(void)spin_lock (&ksocknal_data.ksnd_tx_lock);if (!list_empty (&ksocknal_data.ksnd_idle_noop_txs)) { -struct list_head zlist; -ksock_tx_t *tx; +struct list_head zlist; +ksock_tx_t *tx;list_add (&zlist, &ksocknal_data.ksnd_idle_noop_txs);list_del_init (&ksocknal_data.ksnd_idle_noop_txs);
@@ -2248,9 +2248,9 @@ static voidksocknal_base_shutdown (void) {struct ksock_sched_info *info; -ksock_sched_t *sched; -int i; -int j; +ksock_sched_t *sched; +int i; +int j;CDEBUG (D_MALLOC ,"before NAL cleanup: kmem %d\n" ,atomic_read (&libcfs_kmemory));
@@ -2351,8 +2351,8 @@ static intksocknal_base_startup (void) {struct ksock_sched_info *info; -int rc; -int i; +int rc; +int i;LASSERT (ksocknal_data.ksnd_init ==SOCKNAL_INIT_NOTHING );LASSERT (ksocknal_data.ksnd_nnets ==0 );
@@ -2398,8 +2398,8 @@ ksocknal_base_startup(void) goto failed;cfs_percpt_for_each (info, i, ksocknal_data.ksnd_sched_info) { -ksock_sched_t *sched; -int nthrs; +ksock_sched_t *sched; +int nthrs; nthrs =cfs_cpt_weight (lnet_cpt_table (), i);if (*ksocknal_tunables.ksnd_nscheds >0 ) {
@@ -2430,9 +2430,9 @@ ksocknal_base_startup(void) } } - ksocknal_data.ksnd_connd_starting =0 ; - ksocknal_data.ksnd_connd_failed_stamp =0 ; - ksocknal_data.ksnd_connd_starting_stamp =get_seconds (); + ksocknal_data.ksnd_connd_starting =0 ; + ksocknal_data.ksnd_connd_failed_stamp =0 ; + ksocknal_data.ksnd_connd_starting_stamp =get_seconds ();/* must have at least 2 connds to remain responsive to accepts while * connecting */ if (*ksocknal_tunables.ksnd_nconnds <SOCKNAL_CONND_RESV +1 )
@@ -2482,9 +2482,9 @@ ksocknal_base_startup(void)static void ksocknal_debug_peerhash (lnet_ni_t *ni) { -ksock_peer_t *peer =NULL ; -struct list_head *tmp; -int i; +ksock_peer_t *peer =NULL ; +struct list_head *tmp; +int i;read_lock (&ksocknal_data.ksnd_global_lock);
@@ -2536,12 +2536,12 @@ ksocknal_debug_peerhash(lnet_ni_t *ni)void ksocknal_shutdown (lnet_ni_t *ni) { -ksock_net_t *net = ni->ni_data; -int i; +ksock_net_t *net = ni->ni_data; +int i;lnet_process_id_t anyid = {0 }; - anyid.nid =LNET_NID_ANY ; - anyid.pid =LNET_PID_ANY ; + anyid.nid =LNET_NID_ANY ; + anyid.pid =LNET_PID_ANY ;LASSERT (ksocknal_data.ksnd_init ==SOCKNAL_INIT_ALL );LASSERT (ksocknal_data.ksnd_nnets >0 );
@@ -2588,11 +2588,11 @@ ksocknal_shutdown(lnet_ni_t *ni)static int ksocknal_enumerate_interfaces (ksock_net_t *net) { -char **names; -int i; -int j; -int rc; -int n; +char **names; +int i; +int j; +int rc; +int n; n =libcfs_ipif_enumerate (&names);if (n <=0 ) {
@@ -2601,9 +2601,9 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) }for (i = j =0 ; i < n; i++) { -int up; -__u32 ip; -__u32 mask; +int up; +__u32 ip; +__u32 mask;if (!strcmp (names[i],"lo" ))/* skip the loopback IF */ continue ;
@@ -2645,15 +2645,15 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)static int ksocknal_search_new_ipif (ksock_net_t *net) { -int new_ipif =0 ; -int i; +int new_ipif =0 ; +int i;for (i =0 ; i < net->ksnn_ninterfaces; i++) { -char *ifnam = &net->ksnn_interfaces[i].ksni_name[0 ]; -char *colon =strchr (ifnam,':' ); -int found =0 ; -ksock_net_t *tmp; -int j; +char *ifnam = &net->ksnn_interfaces[i].ksni_name[0 ]; +char *colon =strchr (ifnam,':' ); +int found =0 ; +ksock_net_t *tmp; +int j;if (colon !=NULL )/* ignore alias device */ *colon =0 ;
@@ -2687,9 +2687,9 @@ ksocknal_search_new_ipif(ksock_net_t *net)static int ksocknal_start_schedulers (struct ksock_sched_info *info) { -int nthrs; -int rc =0 ; -int i; +int nthrs; +int rc =0 ; +int i;if (info->ksi_nthreads ==0 ) {if (*ksocknal_tunables.ksnd_nscheds >0 ) {
@@ -2708,9 +2708,9 @@ ksocknal_start_schedulers(struct ksock_sched_info *info) }for (i =0 ; i < nthrs; i++) { -long id; -char name[20 ]; -ksock_sched_t *sched; +long id; +char name[20 ]; +ksock_sched_t *sched; id =KSOCK_THREAD_ID (info->ksi_cpt, info->ksi_nthreads + i); sched = &info->ksi_scheds[KSOCK_THREAD_SID (id)]; snprintf(name, sizeof(name), "socknal_sd%02d_%02d",
@@ -2733,14 +2733,14 @@ ksocknal_start_schedulers(struct ksock_sched_info *info)static int ksocknal_net_start_threads (ksock_net_t *net,__u32 *cpts,int ncpts) { -int newif =ksocknal_search_new_ipif (net); -int rc; -int i; +int newif =ksocknal_search_new_ipif (net); +int rc; +int i;LASSERT (ncpts >0 && ncpts <=cfs_cpt_number (lnet_cpt_table ()));for (i =0 ; i < ncpts; i++) { -struct ksock_sched_info *info; +struct ksock_sched_info *info;int cpt = (cpts ==NULL ) ? i : cpts[i];LASSERT (cpt <cfs_cpt_number (lnet_cpt_table ()));
@@ -2759,9 +2759,9 @@ ksocknal_net_start_threads(ksock_net_t *net, __u32 *cpts, int ncpts)int ksocknal_startup (lnet_ni_t *ni) { -ksock_net_t *net; -int rc; -int i; +ksock_net_t *net; +int rc; +int i;LASSERT (ni->ni_lnd == &the_ksocklnd);
@@ -2791,7 +2791,7 @@ ksocknal_startup(lnet_ni_t *ni) net->ksnn_ninterfaces =1 ; }else {for (i =0 ; i <LNET_MAX_INTERFACES ; i++) { -int up; +int up;if (ni->ni_interfaces[i] ==NULL )break ;
@@ -2851,7 +2851,7 @@ ksocknal_module_fini(void)static int __init ksocknal_module_init (void ) { -int rc; +int rc;/* check ksnr_connected/connecting field large enough */ CLASSERT (SOCKLND_CONN_NTYPES <=4 );
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +313 -247
649 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +198 -198
832 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +75 -75
285 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +15 -18
@@ -145,40 +145,37 @@ ksock_tunables_t ksocknal_tunables;int ksocknal_tunables_init (void ) { -/* initialize ksocknal_tunables structure */ - ksocknal_tunables.ksnd_timeout = &sock_timeout; - ksocknal_tunables.ksnd_nscheds = &nscheds; - ksocknal_tunables.ksnd_nconnds = &nconnds; - ksocknal_tunables.ksnd_nconnds_max = &nconnds_max; + ksocknal_tunables.ksnd_timeout = &sock_timeout; + ksocknal_tunables.ksnd_nscheds = &nscheds; + ksocknal_tunables.ksnd_nconnds = &nconnds; + ksocknal_tunables.ksnd_nconnds_max = &nconnds_max; ksocknal_tunables.ksnd_min_reconnectms = &min_reconnectms; ksocknal_tunables.ksnd_max_reconnectms = &max_reconnectms; - ksocknal_tunables.ksnd_eager_ack = &eager_ack; - ksocknal_tunables.ksnd_typed_conns = &typed_conns; - ksocknal_tunables.ksnd_min_bulk = &min_bulk; + ksocknal_tunables.ksnd_eager_ack = &eager_ack; + ksocknal_tunables.ksnd_typed_conns = &typed_conns; + ksocknal_tunables.ksnd_min_bulk = &min_bulk; ksocknal_tunables.ksnd_tx_buffer_size = &tx_buffer_size; ksocknal_tunables.ksnd_rx_buffer_size = &rx_buffer_size; - ksocknal_tunables.ksnd_nagle = &nagle; - ksocknal_tunables.ksnd_round_robin = &round_robin; - ksocknal_tunables.ksnd_keepalive = &keepalive; + ksocknal_tunables.ksnd_nagle = &nagle; + ksocknal_tunables.ksnd_round_robin = &round_robin; + ksocknal_tunables.ksnd_keepalive = &keepalive; ksocknal_tunables.ksnd_keepalive_idle = &keepalive_idle; ksocknal_tunables.ksnd_keepalive_count = &keepalive_count; ksocknal_tunables.ksnd_keepalive_intvl = &keepalive_intvl; - ksocknal_tunables.ksnd_credits = &credits; + ksocknal_tunables.ksnd_credits = &credits; ksocknal_tunables.ksnd_peertxcredits = &peer_credits; ksocknal_tunables.ksnd_peerrtrcredits = &peer_buffer_credits; - ksocknal_tunables.ksnd_peertimeout = &peer_timeout; - ksocknal_tunables.ksnd_enable_csum = &enable_csum; + ksocknal_tunables.ksnd_peertimeout = &peer_timeout; + ksocknal_tunables.ksnd_enable_csum = &enable_csum; ksocknal_tunables.ksnd_inject_csum_error = &inject_csum_error; ksocknal_tunables.ksnd_nonblk_zcack = &nonblk_zcack; ksocknal_tunables.ksnd_zc_min_payload = &zc_min_payload; - ksocknal_tunables.ksnd_zc_recv = &zc_recv; + ksocknal_tunables.ksnd_zc_recv = &zc_recv; ksocknal_tunables.ksnd_zc_recv_min_nfrags = &zc_recv_min_nfrags; - -#if SOCKNAL_VERSION_DEBUG - ksocknal_tunables.ksnd_protocol = &protocol; + ksocknal_tunables.ksnd_protocol = &protocol;#endif if (*ksocknal_tunables.ksnd_zc_min_payload < (2 <<10 ))
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +64 -64
213 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 7/13 staging: lustre: lnet: selftest: code cleanup - variable spacing, indentation
In reply to Mike ShueyUnify spacing in variable declarations, and align indentation in headers. General whitespace cleanups.
--- drivers/staging/lustre/lnet/selftest/brw_test.c | 60 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 54 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 124 +++++---- drivers/staging/lustre/lnet/selftest/conrpc.h | 34 ++-- drivers/staging/lustre/lnet/selftest/console.c | 246 +++++++++--------- drivers/staging/lustre/lnet/selftest/console.h | 186 +++++++------- drivers/staging/lustre/lnet/selftest/framework.c | 160 ++++++------ drivers/staging/lustre/lnet/selftest/module.c | 10 +- drivers/staging/lustre/lnet/selftest/ping_test.c | 24 +- drivers/staging/lustre/lnet/selftest/rpc.c | 150 ++++++------ drivers/staging/lustre/lnet/selftest/rpc.h | 141 +++++----- drivers/staging/lustre/lnet/selftest/selftest.h | 311 +++++++++++----------- drivers/staging/lustre/lnet/selftest/timer.c | 20 +- drivers/staging/lustre/lnet/selftest/timer.h | 16 +- 14 files changed, 769 insertions(+), 767 deletions(-)
drivers/staging/lustre/lnet/selftest/brw_test.c +30 -30
@@ -91,7 +91,7 @@ brw_client_init(sfw_test_instance_t *tsi) len = npg *PAGE_CACHE_SIZE ; }else { -test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; +test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;/* I should never get this step if it's unknown feature * because make_session will reject unknown feature */
@@ -223,7 +223,7 @@ bad_data:static void brw_fill_bulk (srpc_bulk_t *bk,int pattern,__u64 magic) { -int i; +int i;struct page *pg;for (i =0 ; i < bk->bk_niov; i++) {
@@ -235,7 +235,7 @@ brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic)static int brw_check_bulk (srpc_bulk_t *bk,int pattern,__u64 magic) { -int i; +int i;struct page *pg;for (i =0 ; i < bk->bk_niov; i++) {
@@ -254,16 +254,16 @@ static intbrw_client_prep_rpc (sfw_test_unit_t *tsu, lnet_process_id_t dest, srpc_client_rpc_t **rpcpp) { -srpc_bulk_t *bulk = tsu->tsu_private; +srpc_bulk_t *bulk = tsu->tsu_private;sfw_test_instance_t *tsi = tsu->tsu_instance; -sfw_session_t *sn = tsi->tsi_batch->bat_session; -srpc_client_rpc_t *rpc; -srpc_brw_reqst_t *req; -int flags; -int npg; -int len; -int opc; -int rc; +sfw_session_t *sn = tsi->tsi_batch->bat_session; +srpc_client_rpc_t *rpc; +srpc_brw_reqst_t *req; +int flags; +int npg; +int len; +int opc; +int rc;LASSERT (sn !=NULL );LASSERT (bulk !=NULL );
@@ -277,7 +277,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, len = npg *PAGE_CACHE_SIZE ; }else { -test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; +test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;/* I should never get this step if it's unknown feature * because make_session will reject unknown feature */
@@ -311,12 +311,12 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,static void brw_client_done_rpc (sfw_test_unit_t *tsu,srpc_client_rpc_t *rpc) { -__u64 magic =BRW_MAGIC ; +__u64 magic =BRW_MAGIC ;sfw_test_instance_t *tsi = tsu->tsu_instance; -sfw_session_t *sn = tsi->tsi_batch->bat_session; -srpc_msg_t *msg = &rpc->crpc_replymsg; -srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; -srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; +sfw_session_t *sn = tsi->tsi_batch->bat_session; +srpc_msg_t *msg = &rpc->crpc_replymsg; +srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; +srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;LASSERT (sn !=NULL );
@@ -380,10 +380,10 @@ brw_server_rpc_done(srpc_server_rpc_t *rpc)static int brw_bulk_ready (srpc_server_rpc_t *rpc,int status) { -__u64 magic =BRW_MAGIC ; +__u64 magic =BRW_MAGIC ;srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply;srpc_brw_reqst_t *reqst; -srpc_msg_t *reqstmsg; +srpc_msg_t *reqstmsg;LASSERT (rpc->srpc_bulk !=NULL );LASSERT (rpc->srpc_reqstbuf !=NULL );
@@ -416,13 +416,13 @@ brw_bulk_ready(srpc_server_rpc_t *rpc, int status)static int brw_server_handle (struct srpc_server_rpc *rpc) { -struct srpc_service *sv = rpc->srpc_scd->scd_svc; -srpc_msg_t *replymsg = &rpc->srpc_replymsg; -srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; +struct srpc_service *sv = rpc->srpc_scd->scd_svc; +srpc_msg_t *replymsg = &rpc->srpc_replymsg; +srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg;srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply;srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst; -int npg; -int rc; +int npg; +int rc;LASSERT (sv->sv_id ==SRPC_SERVICE_BRW );
@@ -490,17 +490,17 @@ brw_server_handle(struct srpc_server_rpc *rpc)sfw_test_client_ops_t brw_test_client;void brw_init_test_client (void ) { - brw_test_client.tso_init = brw_client_init; - brw_test_client.tso_fini = brw_client_fini; - brw_test_client.tso_prep_rpc = brw_client_prep_rpc; - brw_test_client.tso_done_rpc = brw_client_done_rpc; + brw_test_client.tso_init = brw_client_init; + brw_test_client.tso_fini = brw_client_fini; + brw_test_client.tso_prep_rpc = brw_client_prep_rpc; + brw_test_client.tso_done_rpc = brw_client_done_rpc; };srpc_service_t brw_test_service;void brw_init_test_service (void ) { - brw_test_service.sv_id =SRPC_SERVICE_BRW ; + brw_test_service.sv_id =SRPC_SERVICE_BRW ; brw_test_service.sv_name ="brw_test" ; brw_test_service.sv_handler = brw_server_handle; brw_test_service.sv_bulk_ready = brw_bulk_ready;
drivers/staging/lustre/lnet/selftest/conctl.c +27 -27
118 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/conrpc.c +64 -60
259 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/conrpc.h +16 -18
@@ -64,31 +64,29 @@ struct lstcon_test;struct lstcon_node ;typedef struct lstcon_rpc { -struct list_head crp_link;/* chain on rpc transaction */ +struct list_head crp_link;/* chain on rpc transaction */ srpc_client_rpc_t *crp_rpc;/* client rpc */ -struct lstcon_node *crp_node;/* destination node */ +struct lstcon_node *crp_node;/* destination node */ struct lstcon_rpc_trans *crp_trans;/* conrpc transaction */ -unsigned int crp_posted:1 ;/* rpc is posted */ -unsigned int crp_finished:1 ;/* rpc is finished */ -unsigned int crp_unpacked:1 ;/* reply is unpacked */ +unsigned int crp_posted:1 ;/* rpc is posted */ +unsigned int crp_finished:1 ;/* rpc is finished */ +unsigned int crp_unpacked:1 ;/* reply is unpacked */ /** RPC is embedded in other structure and can't free it */ -unsigned int crp_embedded:1 ; -int crp_status;/* console rpc errors */ -unsigned long crp_stamp;/* replied time stamp */ +unsigned int crp_embedded:1 ; +int crp_status;/* console rpc errors */ +unsigned long crp_stamp;/* replied time stamp */ }lstcon_rpc_t ;typedef 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 */ -/* features mask is uptodate */ -unsigned tas_feats_updated; -/* test features mask */ -unsigned tas_features; -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 */ +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 */ +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 */ }lstcon_rpc_trans_t ;#define LST_TRANS_PRIVATE 0x1000
drivers/staging/lustre/lnet/selftest/console.c +123 -123
529 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/console.h +94 -92
213 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/framework.c +80 -80
368 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/module.c +5 -5
@@ -39,7 +39,7 @@#include "selftest.h" enum { -LST_INIT_NONE =0 , +LST_INIT_NONE =0 ,LST_INIT_WI_SERIAL ,LST_INIT_WI_TEST ,LST_INIT_RPC ,
@@ -58,7 +58,7 @@ struct cfs_wi_sched **lst_sched_test;static void lnet_selftest_fini (void ) { -int i; +int i;switch (lst_init_step) {case LST_INIT_CONSOLE :
@@ -92,9 +92,9 @@ lnet_selftest_fini(void)static int lnet_selftest_init (void ) { -int nscheds; -int rc; -int i; +int nscheds; +int rc; +int i; rc =cfs_wi_sched_create ("lst_s" ,lnet_cpt_table (),CFS_CPT_ANY ,1 , &lst_sched_serial);
drivers/staging/lustre/lnet/selftest/ping_test.c +12 -12
@@ -73,7 +73,7 @@ static void ping_client_fini(sfw_test_instance_t *tsi) {sfw_session_t *sn = tsi->tsi_batch->bat_session; -int errors; +int errors;LASSERT (sn !=NULL );LASSERT (tsi->tsi_is_client);
@@ -89,11 +89,11 @@ static intping_client_prep_rpc (sfw_test_unit_t *tsu, lnet_process_id_t dest, srpc_client_rpc_t **rpc) { -srpc_ping_reqst_t *req; +srpc_ping_reqst_t *req;sfw_test_instance_t *tsi = tsu->tsu_instance; -sfw_session_t *sn = tsi->tsi_batch->bat_session; -struct timeval tv; -int rc; +sfw_session_t *sn = tsi->tsi_batch->bat_session; +struct timeval tv; +int rc;LASSERT (sn !=NULL );LASSERT ((sn->sn_features & ~LST_FEATS_MASK ) ==0 );
@@ -121,10 +121,10 @@ static void ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) {sfw_test_instance_t *tsi = tsu->tsu_instance; -sfw_session_t *sn = tsi->tsi_batch->bat_session; -srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; -srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; -struct timeval tv; +sfw_session_t *sn = tsi->tsi_batch->bat_session; +srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; +srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; +struct timeval tv;LASSERT (sn !=NULL );
@@ -171,9 +171,9 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)static int ping_server_handle (struct srpc_server_rpc *rpc) { -struct srpc_service *sv = rpc->srpc_scd->scd_svc; -srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; -srpc_msg_t *replymsg = &rpc->srpc_replymsg; +struct srpc_service *sv = rpc->srpc_scd->scd_svc; +srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; +srpc_msg_t *replymsg = &rpc->srpc_replymsg;srpc_ping_reqst_t *req = &reqstmsg->msg_body.ping_reqst;srpc_ping_reply_t *rep = &rpc->srpc_replymsg.msg_body.ping_reply;
drivers/staging/lustre/lnet/selftest/rpc.c +75 -75
299 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/rpc.h +67 -74
218 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/selftest.h +158 -153
458 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/timer.c +10 -10
@@ -50,7 +50,7 @@* sorted by increasing expiry time. The number of slots is 2**7 (128), * 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_MINPOLL 3/* log2 min poll interval (8 s) */ #define STTIMER_SLOTTIME (1 << STTIMER_MINPOLL)#define STTIMER_SLOTTIMEMASK (~(STTIMER_SLOTTIME - 1))#define STTIMER_NSLOTS (1 << 7)
@@ -58,13 +58,13 @@ (STTIMER_NSLOTS - 1))])static struct st_timer_data { -spinlock_t stt_lock; -/* start time of the slot processed previously */ -unsigned long stt_prev_slot; -struct list_head stt_hash[STTIMER_NSLOTS ]; -int stt_shuttingdown; -wait_queue_head_t stt_waitq; -int stt_nthreads; +spinlock_t stt_lock; +unsigned long stt_prev_slot;/* start time of the slot processed +* previously */ +struct list_head stt_hash[STTIMER_NSLOTS ]; +int stt_shuttingdown; +wait_queue_head_t stt_waitq; +int stt_nthreads; } stt_data;void
@@ -124,7 +124,7 @@ stt_del_timer(stt_timer_t *timer)static int stt_expire_list (struct list_head *slot,unsigned long now) { -int expired =0 ; +int expired =0 ;stt_timer_t *timer;while (!list_empty (slot)) {
@@ -148,7 +148,7 @@ stt_expire_list(struct list_head *slot, unsigned long now)static int stt_check_timers (unsigned long *last) { -int expired =0 ; +int expired =0 ;unsigned long now;unsigned long this_slot;
drivers/staging/lustre/lnet/selftest/timer.h +8 -8
@@ -39,15 +39,15 @@#define __SELFTEST_TIMER_H__typedef struct { -struct list_head stt_list; -unsigned long stt_expires; -void (*stt_func) (void *); -void *stt_data; +struct list_head stt_list; +unsigned long stt_expires; +void (*stt_func) (void *); +void *stt_data; }stt_timer_t ; -void stt_add_timer (stt_timer_t *timer); -int stt_del_timer (stt_timer_t *timer); -int stt_startup (void ); -void stt_shutdown (void ); +void stt_add_timer (stt_timer_t *timer); +int stt_del_timer (stt_timer_t *timer); +int stt_startup (void ); +void stt_shutdown (void );#endif /* __SELFTEST_TIMER_H__ */
Signature · 1 line
1.7.1
PATCH v4 7/13 staging: lustre: lnet: selftest: code cleanup - variable spacing, indentation
In reply to Mike ShueyUnify spacing in variable declarations, and align indentation in headers. General whitespace cleanups.
--- drivers/staging/lustre/lnet/selftest/brw_test.c | 60 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 54 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 124 +++++---- drivers/staging/lustre/lnet/selftest/conrpc.h | 34 ++-- drivers/staging/lustre/lnet/selftest/console.c | 246 +++++++++--------- drivers/staging/lustre/lnet/selftest/console.h | 186 +++++++------- drivers/staging/lustre/lnet/selftest/framework.c | 160 ++++++------ drivers/staging/lustre/lnet/selftest/module.c | 10 +- drivers/staging/lustre/lnet/selftest/ping_test.c | 24 +- drivers/staging/lustre/lnet/selftest/rpc.c | 150 ++++++------ drivers/staging/lustre/lnet/selftest/rpc.h | 141 +++++----- drivers/staging/lustre/lnet/selftest/selftest.h | 311 +++++++++++----------- drivers/staging/lustre/lnet/selftest/timer.c | 20 +- drivers/staging/lustre/lnet/selftest/timer.h | 16 +- 14 files changed, 769 insertions(+), 767 deletions(-)
drivers/staging/lustre/lnet/selftest/brw_test.c +30 -30
@@ -91,7 +91,7 @@ brw_client_init(sfw_test_instance_t *tsi) len = npg *PAGE_CACHE_SIZE ; }else { -test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; +test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;/* I should never get this step if it's unknown feature * because make_session will reject unknown feature */
@@ -223,7 +223,7 @@ bad_data:static void brw_fill_bulk (srpc_bulk_t *bk,int pattern,__u64 magic) { -int i; +int i;struct page *pg;for (i =0 ; i < bk->bk_niov; i++) {
@@ -235,7 +235,7 @@ brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic)static int brw_check_bulk (srpc_bulk_t *bk,int pattern,__u64 magic) { -int i; +int i;struct page *pg;for (i =0 ; i < bk->bk_niov; i++) {
@@ -254,16 +254,16 @@ static intbrw_client_prep_rpc (sfw_test_unit_t *tsu, lnet_process_id_t dest, srpc_client_rpc_t **rpcpp) { -srpc_bulk_t *bulk = tsu->tsu_private; +srpc_bulk_t *bulk = tsu->tsu_private;sfw_test_instance_t *tsi = tsu->tsu_instance; -sfw_session_t *sn = tsi->tsi_batch->bat_session; -srpc_client_rpc_t *rpc; -srpc_brw_reqst_t *req; -int flags; -int npg; -int len; -int opc; -int rc; +sfw_session_t *sn = tsi->tsi_batch->bat_session; +srpc_client_rpc_t *rpc; +srpc_brw_reqst_t *req; +int flags; +int npg; +int len; +int opc; +int rc;LASSERT (sn !=NULL );LASSERT (bulk !=NULL );
@@ -277,7 +277,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, len = npg *PAGE_CACHE_SIZE ; }else { -test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; +test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;/* I should never get this step if it's unknown feature * because make_session will reject unknown feature */
@@ -311,12 +311,12 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu,static void brw_client_done_rpc (sfw_test_unit_t *tsu,srpc_client_rpc_t *rpc) { -__u64 magic =BRW_MAGIC ; +__u64 magic =BRW_MAGIC ;sfw_test_instance_t *tsi = tsu->tsu_instance; -sfw_session_t *sn = tsi->tsi_batch->bat_session; -srpc_msg_t *msg = &rpc->crpc_replymsg; -srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; -srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; +sfw_session_t *sn = tsi->tsi_batch->bat_session; +srpc_msg_t *msg = &rpc->crpc_replymsg; +srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; +srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;LASSERT (sn !=NULL );
@@ -380,10 +380,10 @@ brw_server_rpc_done(srpc_server_rpc_t *rpc)static int brw_bulk_ready (srpc_server_rpc_t *rpc,int status) { -__u64 magic =BRW_MAGIC ; +__u64 magic =BRW_MAGIC ;srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply;srpc_brw_reqst_t *reqst; -srpc_msg_t *reqstmsg; +srpc_msg_t *reqstmsg;LASSERT (rpc->srpc_bulk !=NULL );LASSERT (rpc->srpc_reqstbuf !=NULL );
@@ -416,13 +416,13 @@ brw_bulk_ready(srpc_server_rpc_t *rpc, int status)static int brw_server_handle (struct srpc_server_rpc *rpc) { -struct srpc_service *sv = rpc->srpc_scd->scd_svc; -srpc_msg_t *replymsg = &rpc->srpc_replymsg; -srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; +struct srpc_service *sv = rpc->srpc_scd->scd_svc; +srpc_msg_t *replymsg = &rpc->srpc_replymsg; +srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg;srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply;srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst; -int npg; -int rc; +int npg; +int rc;LASSERT (sv->sv_id ==SRPC_SERVICE_BRW );
@@ -490,17 +490,17 @@ brw_server_handle(struct srpc_server_rpc *rpc)sfw_test_client_ops_t brw_test_client;void brw_init_test_client (void ) { - brw_test_client.tso_init = brw_client_init; - brw_test_client.tso_fini = brw_client_fini; - brw_test_client.tso_prep_rpc = brw_client_prep_rpc; - brw_test_client.tso_done_rpc = brw_client_done_rpc; + brw_test_client.tso_init = brw_client_init; + brw_test_client.tso_fini = brw_client_fini; + brw_test_client.tso_prep_rpc = brw_client_prep_rpc; + brw_test_client.tso_done_rpc = brw_client_done_rpc; };srpc_service_t brw_test_service;void brw_init_test_service (void ) { - brw_test_service.sv_id =SRPC_SERVICE_BRW ; + brw_test_service.sv_id =SRPC_SERVICE_BRW ; brw_test_service.sv_name ="brw_test" ; brw_test_service.sv_handler = brw_server_handle; brw_test_service.sv_bulk_ready = brw_bulk_ready;
drivers/staging/lustre/lnet/selftest/conctl.c +27 -27
118 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/conrpc.c +64 -60
259 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/conrpc.h +16 -18
@@ -64,31 +64,29 @@ struct lstcon_test;struct lstcon_node ;typedef struct lstcon_rpc { -struct list_head crp_link;/* chain on rpc transaction */ +struct list_head crp_link;/* chain on rpc transaction */ srpc_client_rpc_t *crp_rpc;/* client rpc */ -struct lstcon_node *crp_node;/* destination node */ +struct lstcon_node *crp_node;/* destination node */ struct lstcon_rpc_trans *crp_trans;/* conrpc transaction */ -unsigned int crp_posted:1 ;/* rpc is posted */ -unsigned int crp_finished:1 ;/* rpc is finished */ -unsigned int crp_unpacked:1 ;/* reply is unpacked */ +unsigned int crp_posted:1 ;/* rpc is posted */ +unsigned int crp_finished:1 ;/* rpc is finished */ +unsigned int crp_unpacked:1 ;/* reply is unpacked */ /** RPC is embedded in other structure and can't free it */ -unsigned int crp_embedded:1 ; -int crp_status;/* console rpc errors */ -unsigned long crp_stamp;/* replied time stamp */ +unsigned int crp_embedded:1 ; +int crp_status;/* console rpc errors */ +unsigned long crp_stamp;/* replied time stamp */ }lstcon_rpc_t ;typedef 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 */ -/* features mask is uptodate */ -unsigned tas_feats_updated; -/* test features mask */ -unsigned tas_features; -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 */ +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 */ +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 */ }lstcon_rpc_trans_t ;#define LST_TRANS_PRIVATE 0x1000
drivers/staging/lustre/lnet/selftest/console.c +123 -123
529 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/console.h +94 -92
213 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/framework.c +80 -80
368 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/module.c +5 -5
@@ -39,7 +39,7 @@#include "selftest.h" enum { -LST_INIT_NONE =0 , +LST_INIT_NONE =0 ,LST_INIT_WI_SERIAL ,LST_INIT_WI_TEST ,LST_INIT_RPC ,
@@ -58,7 +58,7 @@ struct cfs_wi_sched **lst_sched_test;static void lnet_selftest_fini (void ) { -int i; +int i;switch (lst_init_step) {case LST_INIT_CONSOLE :
@@ -92,9 +92,9 @@ lnet_selftest_fini(void)static int lnet_selftest_init (void ) { -int nscheds; -int rc; -int i; +int nscheds; +int rc; +int i; rc =cfs_wi_sched_create ("lst_s" ,lnet_cpt_table (),CFS_CPT_ANY ,1 , &lst_sched_serial);
drivers/staging/lustre/lnet/selftest/ping_test.c +12 -12
@@ -73,7 +73,7 @@ static void ping_client_fini(sfw_test_instance_t *tsi) {sfw_session_t *sn = tsi->tsi_batch->bat_session; -int errors; +int errors;LASSERT (sn !=NULL );LASSERT (tsi->tsi_is_client);
@@ -89,11 +89,11 @@ static intping_client_prep_rpc (sfw_test_unit_t *tsu, lnet_process_id_t dest, srpc_client_rpc_t **rpc) { -srpc_ping_reqst_t *req; +srpc_ping_reqst_t *req;sfw_test_instance_t *tsi = tsu->tsu_instance; -sfw_session_t *sn = tsi->tsi_batch->bat_session; -struct timeval tv; -int rc; +sfw_session_t *sn = tsi->tsi_batch->bat_session; +struct timeval tv; +int rc;LASSERT (sn !=NULL );LASSERT ((sn->sn_features & ~LST_FEATS_MASK ) ==0 );
@@ -121,10 +121,10 @@ static void ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) {sfw_test_instance_t *tsi = tsu->tsu_instance; -sfw_session_t *sn = tsi->tsi_batch->bat_session; -srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; -srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; -struct timeval tv; +sfw_session_t *sn = tsi->tsi_batch->bat_session; +srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; +srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; +struct timeval tv;LASSERT (sn !=NULL );
@@ -171,9 +171,9 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)static int ping_server_handle (struct srpc_server_rpc *rpc) { -struct srpc_service *sv = rpc->srpc_scd->scd_svc; -srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; -srpc_msg_t *replymsg = &rpc->srpc_replymsg; +struct srpc_service *sv = rpc->srpc_scd->scd_svc; +srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; +srpc_msg_t *replymsg = &rpc->srpc_replymsg;srpc_ping_reqst_t *req = &reqstmsg->msg_body.ping_reqst;srpc_ping_reply_t *rep = &rpc->srpc_replymsg.msg_body.ping_reply;
drivers/staging/lustre/lnet/selftest/rpc.c +75 -75
299 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/rpc.h +67 -74
218 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/selftest.h +158 -153
458 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/timer.c +10 -10
@@ -50,7 +50,7 @@* sorted by increasing expiry time. The number of slots is 2**7 (128), * 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_MINPOLL 3/* log2 min poll interval (8 s) */ #define STTIMER_SLOTTIME (1 << STTIMER_MINPOLL)#define STTIMER_SLOTTIMEMASK (~(STTIMER_SLOTTIME - 1))#define STTIMER_NSLOTS (1 << 7)
@@ -58,13 +58,13 @@ (STTIMER_NSLOTS - 1))])static struct st_timer_data { -spinlock_t stt_lock; -/* start time of the slot processed previously */ -unsigned long stt_prev_slot; -struct list_head stt_hash[STTIMER_NSLOTS ]; -int stt_shuttingdown; -wait_queue_head_t stt_waitq; -int stt_nthreads; +spinlock_t stt_lock; +unsigned long stt_prev_slot;/* start time of the slot processed +* previously */ +struct list_head stt_hash[STTIMER_NSLOTS ]; +int stt_shuttingdown; +wait_queue_head_t stt_waitq; +int stt_nthreads; } stt_data;void
@@ -124,7 +124,7 @@ stt_del_timer(stt_timer_t *timer)static int stt_expire_list (struct list_head *slot,unsigned long now) { -int expired =0 ; +int expired =0 ;stt_timer_t *timer;while (!list_empty (slot)) {
@@ -148,7 +148,7 @@ stt_expire_list(struct list_head *slot, unsigned long now)static int stt_check_timers (unsigned long *last) { -int expired =0 ; +int expired =0 ;unsigned long now;unsigned long this_slot;
drivers/staging/lustre/lnet/selftest/timer.h +8 -8
@@ -39,15 +39,15 @@#define __SELFTEST_TIMER_H__typedef struct { -struct list_head stt_list; -unsigned long stt_expires; -void (*stt_func) (void *); -void *stt_data; +struct list_head stt_list; +unsigned long stt_expires; +void (*stt_func) (void *); +void *stt_data; }stt_timer_t ; -void stt_add_timer (stt_timer_t *timer); -int stt_del_timer (stt_timer_t *timer); -int stt_startup (void ); -void stt_shutdown (void ); +void stt_add_timer (stt_timer_t *timer); +int stt_del_timer (stt_timer_t *timer); +int stt_startup (void ); +void stt_shutdown (void );#endif /* __SELFTEST_TIMER_H__ */
Signature · 1 line
1.7.1
PATCH v4 8/13 staging: lustre: lnet: remove LNET_MUTEX_LOCK macro
In reply to Mike ShueyLNET_MUTEX_LOCK and LNET_MUTEX_UNLOCK are verbose wrappers to mutex_lock and mutex_unlock. Get rid of these.
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 2 - drivers/staging/lustre/lnet/lnet/api-ni.c | 26 ++++++++++---------- drivers/staging/lustre/lnet/lnet/module.c | 12 ++++---- 3 files changed, 19 insertions(+), 21 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +0 -2
@@ -172,8 +172,6 @@ lnet_net_lock_current(void)#define lnet_eq_wait_unlock () spin_unlock(&the_lnet.ln_eq_wait_lock)#define lnet_ni_lock (ni) spin_lock(&(ni)->ni_lock)#define lnet_ni_unlock (ni) spin_unlock(&(ni)->ni_lock) -#define LNET_MUTEX_LOCK (m) mutex_lock(m) -#define LNET_MUTEX_UNLOCK (m) mutex_unlock(m)#define MAX_PORTALS 64
drivers/staging/lustre/lnet/lnet/api-ni.c +13 -13
@@ -282,7 +282,7 @@ lnet_find_lnd_by_type(int type)void lnet_register_lnd (lnd_t *lnd) { -LNET_MUTEX_LOCK (&the_lnet.ln_lnd_mutex); +mutex_lock (&the_lnet.ln_lnd_mutex);LASSERT (the_lnet.ln_init);LASSERT (libcfs_isknown_lnd (lnd->lnd_type));
@@ -293,14 +293,14 @@ lnet_register_lnd(lnd_t *lnd)CDEBUG (D_NET ,"%s LND registered\n" ,libcfs_lnd2str (lnd->lnd_type)); -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex); }EXPORT_SYMBOL (lnet_register_lnd);void lnet_unregister_lnd (lnd_t *lnd) { -LNET_MUTEX_LOCK (&the_lnet.ln_lnd_mutex); +mutex_lock (&the_lnet.ln_lnd_mutex);LASSERT (the_lnet.ln_init);LASSERT (lnet_find_lnd_by_type (lnd->lnd_type) = lnd);
@@ -309,7 +309,7 @@ lnet_unregister_lnd(lnd_t *lnd)list_del (&lnd->lnd_list);CDEBUG (D_NET ,"%s LND unregistered\n" ,libcfs_lnd2str (lnd->lnd_type)); -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex); }EXPORT_SYMBOL (lnet_unregister_lnd);
@@ -1055,18 +1055,18 @@ lnet_startup_lndnis(void) goto failed; } -LNET_MUTEX_LOCK (&the_lnet.ln_lnd_mutex); +mutex_lock (&the_lnet.ln_lnd_mutex); lnd =lnet_find_lnd_by_type (lnd_type);if (lnd =NULL ) { -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex); rc =request_module ("%s" ,libcfs_lnd2modname (lnd_type)); -LNET_MUTEX_LOCK (&the_lnet.ln_lnd_mutex); +mutex_lock (&the_lnet.ln_lnd_mutex); lnd =lnet_find_lnd_by_type (lnd_type);if (lnd =NULL ) { -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex);CERROR ("Can't load LND %s, module %s, rc=%d\n" ,libcfs_lnd2str (lnd_type),libcfs_lnd2modname (lnd_type), rc);
@@ -1082,7 +1082,7 @@ lnet_startup_lndnis(void) rc = (lnd->lnd_startup)(ni); -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex);if (rc !=0 ) { LCONSOLE_ERROR_MSG(0x105, "Error %d starting up LNI %s\n",
@@ -1272,7 +1272,7 @@ LNetNIInit(lnet_pid_t requested_pid)int im_a_router =0 ;int rc; -LNET_MUTEX_LOCK (&the_lnet.ln_api_mutex); +mutex_lock (&the_lnet.ln_api_mutex);LASSERT (the_lnet.ln_init);CDEBUG (D_OTHER ,"refs %d\n" , the_lnet.ln_refcount);
@@ -1343,7 +1343,7 @@ LNetNIInit(lnet_pid_t requested_pid) failed0:LASSERT (rc <0 ); out: -LNET_MUTEX_UNLOCK (&the_lnet.ln_api_mutex); +mutex_unlock (&the_lnet.ln_api_mutex);return rc; }EXPORT_SYMBOL (LNetNIInit);
@@ -1360,7 +1360,7 @@ EXPORT_SYMBOL(LNetNIInit);int LNetNIFini (void ) { -LNET_MUTEX_LOCK (&the_lnet.ln_api_mutex); +mutex_lock (&the_lnet.ln_api_mutex);LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -1383,7 +1383,7 @@ LNetNIFini(void)lnet_unprepare (); } -LNET_MUTEX_UNLOCK (&the_lnet.ln_api_mutex); +mutex_unlock (&the_lnet.ln_api_mutex);return 0 ; }EXPORT_SYMBOL (LNetNIFini);
drivers/staging/lustre/lnet/lnet/module.c +6 -6
@@ -49,7 +49,7 @@ lnet_configure(void *arg)/* 'arg' only there so I can be passed to cfs_create_thread() */ int rc =0 ; -LNET_MUTEX_LOCK (&lnet_config_mutex); +mutex_lock (&lnet_config_mutex);if (!the_lnet.ln_niinit_self) { rc =LNetNIInit (LUSTRE_SRV_LNET_PID );
@@ -59,7 +59,7 @@ lnet_configure(void *arg) } } -LNET_MUTEX_UNLOCK (&lnet_config_mutex); +mutex_unlock (&lnet_config_mutex);return rc; }
@@ -68,18 +68,18 @@ lnet_unconfigure(void) {int refcount; -LNET_MUTEX_LOCK (&lnet_config_mutex); +mutex_lock (&lnet_config_mutex);if (the_lnet.ln_niinit_self) { the_lnet.ln_niinit_self =0 ;LNetNIFini (); } -LNET_MUTEX_LOCK (&the_lnet.ln_api_mutex); +mutex_lock (&the_lnet.ln_api_mutex); refcount = the_lnet.ln_refcount; -LNET_MUTEX_UNLOCK (&the_lnet.ln_api_mutex); +mutex_unlock (&the_lnet.ln_api_mutex); -LNET_MUTEX_UNLOCK (&lnet_config_mutex); +mutex_unlock (&lnet_config_mutex);return (refcount =0 ) ?0 : -EBUSY ; }
Signature · 1 line
1.7.1
PATCH v4 8/13 staging: lustre: lnet: remove LNET_MUTEX_LOCK macro
In reply to Mike ShueyLNET_MUTEX_LOCK and LNET_MUTEX_UNLOCK are verbose wrappers to mutex_lock and mutex_unlock. Get rid of these.
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 2 - drivers/staging/lustre/lnet/lnet/api-ni.c | 26 ++++++++++---------- drivers/staging/lustre/lnet/lnet/module.c | 12 ++++---- 3 files changed, 19 insertions(+), 21 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +0 -2
@@ -172,8 +172,6 @@ lnet_net_lock_current(void)#define lnet_eq_wait_unlock () spin_unlock(&the_lnet.ln_eq_wait_lock)#define lnet_ni_lock (ni) spin_lock(&(ni)->ni_lock)#define lnet_ni_unlock (ni) spin_unlock(&(ni)->ni_lock) -#define LNET_MUTEX_LOCK (m) mutex_lock(m) -#define LNET_MUTEX_UNLOCK (m) mutex_unlock(m)#define MAX_PORTALS 64
drivers/staging/lustre/lnet/lnet/api-ni.c +13 -13
@@ -282,7 +282,7 @@ lnet_find_lnd_by_type(int type)void lnet_register_lnd (lnd_t *lnd) { -LNET_MUTEX_LOCK (&the_lnet.ln_lnd_mutex); +mutex_lock (&the_lnet.ln_lnd_mutex);LASSERT (the_lnet.ln_init);LASSERT (libcfs_isknown_lnd (lnd->lnd_type));
@@ -293,14 +293,14 @@ lnet_register_lnd(lnd_t *lnd)CDEBUG (D_NET ,"%s LND registered\n" ,libcfs_lnd2str (lnd->lnd_type)); -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex); }EXPORT_SYMBOL (lnet_register_lnd);void lnet_unregister_lnd (lnd_t *lnd) { -LNET_MUTEX_LOCK (&the_lnet.ln_lnd_mutex); +mutex_lock (&the_lnet.ln_lnd_mutex);LASSERT (the_lnet.ln_init);LASSERT (lnet_find_lnd_by_type (lnd->lnd_type) = lnd);
@@ -309,7 +309,7 @@ lnet_unregister_lnd(lnd_t *lnd)list_del (&lnd->lnd_list);CDEBUG (D_NET ,"%s LND unregistered\n" ,libcfs_lnd2str (lnd->lnd_type)); -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex); }EXPORT_SYMBOL (lnet_unregister_lnd);
@@ -1055,18 +1055,18 @@ lnet_startup_lndnis(void) goto failed; } -LNET_MUTEX_LOCK (&the_lnet.ln_lnd_mutex); +mutex_lock (&the_lnet.ln_lnd_mutex); lnd =lnet_find_lnd_by_type (lnd_type);if (lnd =NULL ) { -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex); rc =request_module ("%s" ,libcfs_lnd2modname (lnd_type)); -LNET_MUTEX_LOCK (&the_lnet.ln_lnd_mutex); +mutex_lock (&the_lnet.ln_lnd_mutex); lnd =lnet_find_lnd_by_type (lnd_type);if (lnd =NULL ) { -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex);CERROR ("Can't load LND %s, module %s, rc=%d\n" ,libcfs_lnd2str (lnd_type),libcfs_lnd2modname (lnd_type), rc);
@@ -1082,7 +1082,7 @@ lnet_startup_lndnis(void) rc = (lnd->lnd_startup)(ni); -LNET_MUTEX_UNLOCK (&the_lnet.ln_lnd_mutex); +mutex_unlock (&the_lnet.ln_lnd_mutex);if (rc !=0 ) { LCONSOLE_ERROR_MSG(0x105, "Error %d starting up LNI %s\n",
@@ -1272,7 +1272,7 @@ LNetNIInit(lnet_pid_t requested_pid)int im_a_router =0 ;int rc; -LNET_MUTEX_LOCK (&the_lnet.ln_api_mutex); +mutex_lock (&the_lnet.ln_api_mutex);LASSERT (the_lnet.ln_init);CDEBUG (D_OTHER ,"refs %d\n" , the_lnet.ln_refcount);
@@ -1343,7 +1343,7 @@ LNetNIInit(lnet_pid_t requested_pid) failed0:LASSERT (rc <0 ); out: -LNET_MUTEX_UNLOCK (&the_lnet.ln_api_mutex); +mutex_unlock (&the_lnet.ln_api_mutex);return rc; }EXPORT_SYMBOL (LNetNIInit);
@@ -1360,7 +1360,7 @@ EXPORT_SYMBOL(LNetNIInit);int LNetNIFini (void ) { -LNET_MUTEX_LOCK (&the_lnet.ln_api_mutex); +mutex_lock (&the_lnet.ln_api_mutex);LASSERT (the_lnet.ln_init);LASSERT (the_lnet.ln_refcount >0 );
@@ -1383,7 +1383,7 @@ LNetNIFini(void)lnet_unprepare (); } -LNET_MUTEX_UNLOCK (&the_lnet.ln_api_mutex); +mutex_unlock (&the_lnet.ln_api_mutex);return 0 ; }EXPORT_SYMBOL (LNetNIFini);
drivers/staging/lustre/lnet/lnet/module.c +6 -6
@@ -49,7 +49,7 @@ lnet_configure(void *arg)/* 'arg' only there so I can be passed to cfs_create_thread() */ int rc =0 ; -LNET_MUTEX_LOCK (&lnet_config_mutex); +mutex_lock (&lnet_config_mutex);if (!the_lnet.ln_niinit_self) { rc =LNetNIInit (LUSTRE_SRV_LNET_PID );
@@ -59,7 +59,7 @@ lnet_configure(void *arg) } } -LNET_MUTEX_UNLOCK (&lnet_config_mutex); +mutex_unlock (&lnet_config_mutex);return rc; }
@@ -68,18 +68,18 @@ lnet_unconfigure(void) {int refcount; -LNET_MUTEX_LOCK (&lnet_config_mutex); +mutex_lock (&lnet_config_mutex);if (the_lnet.ln_niinit_self) { the_lnet.ln_niinit_self =0 ;LNetNIFini (); } -LNET_MUTEX_LOCK (&the_lnet.ln_api_mutex); +mutex_lock (&the_lnet.ln_api_mutex); refcount = the_lnet.ln_refcount; -LNET_MUTEX_UNLOCK (&the_lnet.ln_api_mutex); +mutex_unlock (&the_lnet.ln_api_mutex); -LNET_MUTEX_UNLOCK (&lnet_config_mutex); +mutex_unlock (&lnet_config_mutex);return (refcount =0 ) ?0 : -EBUSY ; }
Signature · 1 line
1.7.1
PATCH v4 9/13 staging: lustre: lnet: lnet: remove dead code, fix checkpatch.pl issue
In reply to Mike ShueySome debug code was left in the tree, blocked by a #if 0. Also kicked out checkpatch.pl warnings. Remove it.
--- drivers/staging/lustre/lnet/lnet/lib-msg.c | 17 ----------------- 1 files changed, 0 insertions(+), 17 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-msg.c +0 -17
@@ -444,23 +444,6 @@ lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int status)if (msg =NULL )return ; -#if 0 -CDEBUG (D_WARNING ,"%s msg->%s Flags:%s%s%s%s%s%s%s%s%s%s%s txp %s rxp %s\n" , -lnet_msgtyp2str (msg->msg_type),libcfs_id2str (msg->msg_target), - msg->msg_target_is_router ?"t" :"" , - msg->msg_routing ?"X" :"" , - msg->msg_ack ?"A" :"" , - msg->msg_sending ?"S" :"" , - msg->msg_receiving ?"R" :"" , - msg->msg_delayed ?"d" :"" , - msg->msg_txcredit ?"C" :"" , - msg->msg_peertxcredit ?"c" :"" , - msg->msg_rtrcredit ?"F" :"" , - msg->msg_peerrtrcredit ?"f" :"" , - msg->msg_onactivelist ?"!" :"" , - msg->msg_txpeer =NULL ?"<none>" :libcfs_nid2str (msg->msg_txpeer->lp_nid), - msg->msg_rxpeer =NULL ?"<none>" :libcfs_nid2str (msg->msg_rxpeer->lp_nid)); -#endif msg->msg_ev.status = status;if (msg->msg_md !=NULL ) {
Signature · 1 line
1.7.1
PATCH v4 9/13 staging: lustre: lnet: lnet: remove dead code, fix checkpatch.pl issue
In reply to Mike ShueySome debug code was left in the tree, blocked by a #if 0. Also kicked out checkpatch.pl warnings. Remove it.
--- drivers/staging/lustre/lnet/lnet/lib-msg.c | 17 ----------------- 1 files changed, 0 insertions(+), 17 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-msg.c +0 -17
@@ -444,23 +444,6 @@ lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int status)if (msg =NULL )return ; -#if 0 -CDEBUG (D_WARNING ,"%s msg->%s Flags:%s%s%s%s%s%s%s%s%s%s%s txp %s rxp %s\n" , -lnet_msgtyp2str (msg->msg_type),libcfs_id2str (msg->msg_target), - msg->msg_target_is_router ?"t" :"" , - msg->msg_routing ?"X" :"" , - msg->msg_ack ?"A" :"" , - msg->msg_sending ?"S" :"" , - msg->msg_receiving ?"R" :"" , - msg->msg_delayed ?"d" :"" , - msg->msg_txcredit ?"C" :"" , - msg->msg_peertxcredit ?"c" :"" , - msg->msg_rtrcredit ?"F" :"" , - msg->msg_peerrtrcredit ?"f" :"" , - msg->msg_onactivelist ?"!" :"" , - msg->msg_txpeer =NULL ?"<none>" :libcfs_nid2str (msg->msg_txpeer->lp_nid), - msg->msg_rxpeer =NULL ?"<none>" :libcfs_nid2str (msg->msg_rxpeer->lp_nid)); -#endif msg->msg_ev.status = status;if (msg->msg_md !=NULL ) {
Signature · 1 line
1.7.1
PATCH v4 10/13 staging: lustre: lnet: lnet: checkpatch.pl fixes
In reply to Mike ShueyFix many checkpatch.pl warnings.
--- drivers/staging/lustre/lnet/lnet/acceptor.c | 69 ++++++++++++++--------- drivers/staging/lustre/lnet/lnet/api-ni.c | 18 ++++-- drivers/staging/lustre/lnet/lnet/config.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-eq.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 9 ++- drivers/staging/lustre/lnet/lnet/router.c | 17 ++++-- drivers/staging/lustre/lnet/lnet/router_proc.c | 16 ++++-- 8 files changed, 88 insertions(+), 51 deletions(-)
drivers/staging/lustre/lnet/lnet/acceptor.c +42 -27
@@ -99,38 +99,42 @@ lnet_connect_console_error(int rc, lnet_nid_t peer_nid,switch (rc) {/* "normal" errors */ case -ECONNREFUSED : -CNETERR ("Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +CNETERR ( +"Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , +libcfs_nid2str (peer_nid), &peer_ip, peer_port);break ;case -EHOSTUNREACH :case -ENETUNREACH : -CNETERR ("Connection to %s at host %pI4h was unreachable: the network or that node may be down, or Lustre may be misconfigured.\n" , +CNETERR ( +"Connection to %s at host %pI4h was unreachable: the network or that node may be down, or Lustre may be misconfigured.\n" ,libcfs_nid2str (peer_nid), &peer_ip);break ;case -ETIMEDOUT : -CNETERR ("Connection to %s at host %pI4h on port %d took too long: that node may be hung or experiencing high load.\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +CNETERR ( +"Connection to %s at host %pI4h on port %d took too long: that node may be hung or experiencing high load.\n" , +libcfs_nid2str (peer_nid), &peer_ip, peer_port);break ;case -ECONNRESET : -LCONSOLE_ERROR_MSG (0x11b ,"Connection to %s at host %pI4h on port %d was reset: is it running a compatible version of Lustre and is %s one of its NIDs?\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port, -libcfs_nid2str (peer_nid)); +LCONSOLE_ERROR_MSG (0x11b , +"Connection to %s at host %pI4h on port %d was reset: is it running a compatible version of Lustre and is %s one of its NIDs?\n" , +libcfs_nid2str (peer_nid), &peer_ip, + peer_port,libcfs_nid2str (peer_nid));break ;case -EPROTO : -LCONSOLE_ERROR_MSG (0x11c ,"Protocol error connecting to %s at host %pI4h on port %d: is it running a compatible version of Lustre?\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +LCONSOLE_ERROR_MSG (0x11c , +"Protocol error connecting to %s at host %pI4h on port %d: is it running a compatible version of Lustre?\n" , +libcfs_nid2str (peer_nid), &peer_ip, + peer_port);break ;case -EADDRINUSE : -LCONSOLE_ERROR_MSG (0x11d ,"No privileged ports available to connect to %s at host %pI4h on port %d\n" , +LCONSOLE_ERROR_MSG (0x11d , +"No privileged ports available to connect to %s at host %pI4h on port %d\n" ,libcfs_nid2str (peer_nid), &peer_ip, peer_port);break ;default : -LCONSOLE_ERROR_MSG (0x11e ,"Unexpected error %d connecting to %s at host %pI4h on port %d\n" , +LCONSOLE_ERROR_MSG (0x11e , +"Unexpected error %d connecting to %s at host %pI4h on port %d\n" , rc,libcfs_nid2str (peer_nid), &peer_ip, peer_port);break ;
@@ -238,7 +242,8 @@ lnet_accept(struct socket *sock, __u32 magic) accept_timeout);if (rc !=0 ) -CERROR ("Error sending magic+version in response to LNET magic from %pI4h: %d\n" , +CERROR ( +"Error sending magic+version in response to LNET magic from %pI4h: %d\n" , &peer_ip, rc);return -EPROTO ; }
@@ -250,7 +255,8 @@ lnet_accept(struct socket *sock, __u32 magic)else str ="unrecognised" ; -LCONSOLE_ERROR_MSG (0x11f ,"Refusing connection from %pI4h magic %08x: %s acceptor protocol\n" , +LCONSOLE_ERROR_MSG (0x11f , +"Refusing connection from %pI4h magic %08x: %s acceptor protocol\n" , &peer_ip, magic, str);return -EPROTO ; }
@@ -261,7 +267,8 @@ lnet_accept(struct socket *sock, __u32 magic)sizeof (cr.acr_version), accept_timeout);if (rc !=0 ) { -CERROR ("Error %d reading connection request version from %pI4h\n" , +CERROR ( +"Error %d reading connection request version from %pI4h\n" , rc, &peer_ip);return -EIO ; }
@@ -284,7 +291,8 @@ lnet_accept(struct socket *sock, __u32 magic) accept_timeout);if (rc !=0 ) -CERROR ("Error sending magic+version in response to version %d from %pI4h: %d\n" , +CERROR ( +"Error sending magic+version in response to version %d from %pI4h: %d\n" , peer_version, &peer_ip, rc);return -EPROTO ; }
@@ -294,7 +302,8 @@ lnet_accept(struct socket *sock, __u32 magic) offsetof(lnet_acceptor_connreq_t , acr_nid), accept_timeout);if (rc !=0 ) { -CERROR ("Error %d reading connection request from %pI4h\n" , +CERROR ( +"Error %d reading connection request from %pI4h\n" , rc, &peer_ip);return -EIO ; }
@@ -307,7 +316,8 @@ lnet_accept(struct socket *sock, __u32 magic) ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */if (ni !=NULL )lnet_ni_decref (ni); -LCONSOLE_ERROR_MSG (0x120 ,"Refusing connection from %pI4h for %s: No matching NI\n" , +LCONSOLE_ERROR_MSG (0x120 , +"Refusing connection from %pI4h for %s: No matching NI\n" , &peer_ip,libcfs_nid2str (cr.acr_nid));return -EPERM ; }
@@ -315,7 +325,8 @@ lnet_accept(struct socket *sock, __u32 magic)if (ni->ni_lnd->lnd_accept =NULL ) {/* This catches a request for the loopback LND */ lnet_ni_decref (ni); -LCONSOLE_ERROR_MSG (0x121 ,"Refusing connection from %pI4h for %s: NI doesn not accept IP connections\n" , +LCONSOLE_ERROR_MSG (0x121 , +"Refusing connection from %pI4h for %s: NI doesn not accept IP connections\n" , &peer_ip,libcfs_nid2str (cr.acr_nid));return -EPERM ; }
@@ -347,10 +358,12 @@ lnet_acceptor(void *arg) 0, accept_port, accept_backlog);if (rc !=0 ) {if (rc = -EADDRINUSE ) -LCONSOLE_ERROR_MSG (0x122 ,"Can't start acceptor on port %d: port already in use\n" , +LCONSOLE_ERROR_MSG (0x122 , +"Can't start acceptor on port %d: port already in use\n" , accept_port);else -LCONSOLE_ERROR_MSG (0x123 ,"Can't start acceptor on port %d: unexpected error %d\n" , +LCONSOLE_ERROR_MSG (0x123 , +"Can't start acceptor on port %d: unexpected error %d\n" , accept_port, rc); lnet_acceptor_state.pta_sock =NULL ;
@@ -390,7 +403,8 @@ lnet_acceptor(void *arg) }if (secure && peer_port >LNET_ACCEPTOR_MAX_RESERVED_PORT ) { -CERROR ("Refusing connection from %pI4h: insecure port %d\n" , +CERROR ( +"Refusing connection from %pI4h: insecure port %d\n" , &peer_ip, peer_port); goto failed; }
@@ -398,7 +412,8 @@ lnet_acceptor(void *arg) rc =libcfs_sock_read (newsock, &magic,sizeof (magic), accept_timeout);if (rc !=0 ) { -CERROR ("Error %d reading connection request from %pI4h\n" , +CERROR ( +"Error %d reading connection request from %pI4h\n" , rc, &peer_ip); goto failed; }
drivers/staging/lustre/lnet/lnet/api-ni.c +12 -6
@@ -74,7 +74,8 @@ lnet_get_networks(void)int rc;if (*networks !=0 && *ip2nets !=0 ) { -LCONSOLE_ERROR_MSG (0x101 ,"Please specify EITHER 'networks' or 'ip2nets' but not both at once\n" ); +LCONSOLE_ERROR_MSG (0x101 , +"Please specify EITHER 'networks' or 'ip2nets' but not both at once\n" );return NULL ; }
@@ -189,7 +190,8 @@ static void lnet_assert_wire_constants(void)/* Checks for struct ptl_handle_wire_t */ CLASSERT ((int )sizeof (lnet_handle_wire_t) =16 ); CLASSERT((int)offsetof(lnet_handle_wire_t, wh_interface_cookie) = 0); -CLASSERT ((int )sizeof (((lnet_handle_wire_t *)0 )->wh_interface_cookie) =8 ); +CLASSERT ((int )sizeof (((lnet_handle_wire_t *)0 )->wh_interface_cookie) = +8 ); CLASSERT((int)offsetof(lnet_handle_wire_t, wh_object_cookie) = 8);CLASSERT ((int )sizeof (((lnet_handle_wire_t *)0 )->wh_object_cookie) =8 );
@@ -1085,7 +1087,8 @@ lnet_startup_lndnis(void)mutex_unlock (&the_lnet.ln_lnd_mutex);if (rc !=0 ) { -LCONSOLE_ERROR_MSG (0x105 ,"Error %d starting up LNI %s\n" , +LCONSOLE_ERROR_MSG (0x105 , +"Error %d starting up LNI %s\n" , rc,libcfs_lnd2str (lnd->lnd_type));lnet_net_lock (LNET_LOCK_EX ); lnd->lnd_refcount--;
@@ -1141,7 +1144,8 @@ lnet_startup_lndnis(void)if (the_lnet.ln_eq_waitni !=NULL && nicount >1 ) { lnd_type = the_lnet.ln_eq_waitni->ni_lnd->lnd_type; -LCONSOLE_ERROR_MSG (0x109 ,"LND %s can only run single-network\n" , +LCONSOLE_ERROR_MSG (0x109 , +"LND %s can only run single-network\n" ,libcfs_lnd2str (lnd_type)); goto failed; }
@@ -1187,7 +1191,8 @@ LNetInit(void)LASSERT (the_lnet.ln_cpt_number >0 );if (the_lnet.ln_cpt_number >LNET_CPT_MAX ) {/* we are under risk of consuming all lh_cookie */ -CERROR ("Can't have %d CPTs for LNet (max allowed is %d), please change setting of CPT-table and retry\n" , +CERROR ( +"Can't have %d CPTs for LNet (max allowed is %d), please change setting of CPT-table and retry\n" , the_lnet.ln_cpt_number,LNET_CPT_MAX );return -1 ; }
@@ -1749,7 +1754,8 @@ lnet_ping_target_fini(void) }int -lnet_ping (lnet_process_id_t id,int timeout_ms,lnet_process_id_t *ids,int n_ids) +lnet_ping (lnet_process_id_t id,int timeout_ms,lnet_process_id_t *ids, +int n_ids) {lnet_handle_eq_t eqh;lnet_handle_md_t mdh;
drivers/staging/lustre/lnet/lnet/config.c +1 -1
@@ -27,7 +27,7 @@* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * -* Copyright (c) 2012, Intel Corporation. +* Copyright (c) 2012, 2014, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/
drivers/staging/lustre/lnet/lnet/lib-eq.c +3 -1
@@ -82,7 +82,9 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, count =cfs_power2_roundup (count);if (callback !=LNET_EQ_HANDLER_NONE && count !=0 ) -CWARN ("EQ callback is guaranteed to get every event, do you still want to set eqcount %d for polling event which will have locking overhead? Please contact with developer to confirm\n" , count); +CWARN ( +"EQ callback is guaranteed to get every event, do you still want to set eqcount %d for polling event which will have locking overhead? Please contact with developer to confirm\n" , + count);/* count can be 0 if only need callback, we can eliminate * overhead of enqueue event */
drivers/staging/lustre/lnet/lnet/lib-md.c +2 -2
@@ -144,7 +144,7 @@ lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink) lmd->md_length = total_length; -if ((umd->options &LNET_MD_MAX_SIZE ) !=0 &&/* max size used */ +if ((umd->options &LNET_MD_MAX_SIZE ) !=0 &&/* max size used */ (umd->max_size <0 || umd->max_size > total_length))/* illegal max_size */ return -EINVAL ;
@@ -154,7 +154,7 @@ lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink) lmd->md_iov.iov[0 ].iov_base = umd->start; lmd->md_iov.iov[0 ].iov_len = umd->length; -if ((umd->options &LNET_MD_MAX_SIZE ) !=0 &&/* max size used */ +if ((umd->options &LNET_MD_MAX_SIZE ) !=0 &&/* max size used */ (umd->max_size <0 || umd->max_size > (int )umd->length))/* illegal max_size */ return -EINVAL ;
drivers/staging/lustre/lnet/lnet/lib-ptl.c +6 -3
@@ -184,7 +184,8 @@ lnet_try_match_md(lnet_libmd_t *md, mlength = info->mi_rlength; }else if ((md->md_options &LNET_MD_TRUNCATE ) =0 ) {/* this packet _really_ is too big */ -CERROR ("Matching packet from %s, match %llu length %d too big: %d left, %d allowed\n" , +CERROR ( +"Matching packet from %s, match %llu length %d too big: %d left, %d allowed\n" ,libcfs_id2str (info->mi_id), info->mi_mbits, info->mi_rlength, md->md_length - offset, mlength);
@@ -192,7 +193,8 @@ lnet_try_match_md(lnet_libmd_t *md, }/* Commit to this ME/MD */ -CDEBUG (D_NET ,"Incoming %s index %x from %s of length %d/%d into md %#llx [%d] + %d\n" , +CDEBUG (D_NET , +"Incoming %s index %x from %s of length %d/%d into md %#llx [%d] + %d\n" , (info->mi_opc =LNET_MD_OP_PUT ) ?"put" :"get" , info->mi_portal,libcfs_id2str (info->mi_id), mlength, info->mi_rlength, md->md_lh.lh_cookie, md->md_niov, offset);
@@ -685,7 +687,8 @@ lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md,if ((rc &LNET_MATCHMD_OK ) !=0 ) {list_add_tail (&msg->msg_list, matches); -CDEBUG (D_NET ,"Resuming delayed PUT from %s portal %d match %llu offset %d length %d.\n" , +CDEBUG (D_NET , +"Resuming delayed PUT from %s portal %d match %llu offset %d length %d.\n" ,libcfs_id2str (info.mi_id), info.mi_portal, info.mi_mbits, info.mi_roffset, info.mi_rlength);
drivers/staging/lustre/lnet/lnet/router.c +11 -6
@@ -456,7 +456,8 @@ lnet_check_routes(void)lnet_net_unlock (cpt); -CERROR ("Routes to %s via %s and %s not supported\n" , +CERROR ( +"Routes to %s via %s and %s not supported\n" ,libcfs_net2str (net),libcfs_nid2str (nid1),libcfs_nid2str (nid2));
@@ -1020,7 +1021,8 @@ lnet_router_checker_start(void)if (check_routers_before_use && dead_router_check_interval <=0 ) { -LCONSOLE_ERROR_MSG (0x10a ,"'dead_router_check_interval' must be set if 'check_routers_before_use' is set\n" ); +LCONSOLE_ERROR_MSG (0x10a , +"'dead_router_check_interval' must be set if 'check_routers_before_use' is set\n" );return -EINVAL ; }
@@ -1321,7 +1323,8 @@ lnet_rtrpool_alloc_bufs(lnet_rtrbufpool_t *rbp, int nbufs, int cpt) rb =lnet_new_rtrbuf (rbp, cpt);if (rb =NULL ) { -CERROR ("Failed to allocate %d router bufs of %d pages\n" , +CERROR ( +"Failed to allocate %d router bufs of %d pages\n" , nbufs, rbp->rbp_npages);return -ENOMEM ; }
@@ -1451,7 +1454,8 @@ lnet_rtrpools_alloc(int im_a_router) }else if (!strcmp (forwarding,"enabled" )) {/* explicitly enabled */ }else { -LCONSOLE_ERROR_MSG (0x10b ,"'forwarding' not set to either 'enabled' or 'disabled'\n" ); +LCONSOLE_ERROR_MSG (0x10b , +"'forwarding' not set to either 'enabled' or 'disabled'\n" );return -EINVAL ; }
@@ -1511,7 +1515,7 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when)unsigned long now =cfs_time_current ();int cpt =lnet_cpt_of_nid (nid); -LASSERT (!in_interrupt ()); +LASSERT (!in_interrupt ()); CDEBUG(D_NET, "%s notifying %s: %s\n", (ni = NULL) ? "userspace" : libcfs_nid2str(ni->ni_nid),
@@ -1528,7 +1532,8 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when)/* can't do predictions... */ if (cfs_time_after (when, now)) { -CWARN ("Ignoring prediction from %s of %s %s %ld seconds in the future\n" , +CWARN ( +"Ignoring prediction from %s of %s %s %ld seconds in the future\n" , (ni =NULL ) ?"userspace" :libcfs_nid2str (ni->ni_nid),libcfs_nid2str (nid), alive ?"up" :"down" ,cfs_duration_sec (cfs_time_sub (when, now)));
drivers/staging/lustre/lnet/lnet/router_proc.c +8 -5
@@ -49,7 +49,8 @@ enum {*/ #define LNET_PROC_CPT_BITS (LNET_CPT_BITS + 1)/* change version, 16 bits or 8 bits */ -#define LNET_PROC_VER_BITS max_t(size_t, min_t(size_t, LNET_LOFFT_BITS, 64) / 4, 8) +#define LNET_PROC_VER_BITS max_t(size_t, min_t(size_t, LNET_LOFFT_BITS, \ + 64) / 4, 8)#define LNET_PROC_HASH_BITS LNET_PEER_HASH_BITS/*
@@ -396,7 +397,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write, nrefs, nrtrrefs, alive_cnt, alive ?"up" :"down" , last_ping, pingsent, -cfs_duration_sec (cfs_time_sub (deadline, now)), +cfs_duration_sec ( +cfs_time_sub (deadline, + now)), down_ni, libcfs_nid2str(nid));LASSERT (tmpstr + tmpsiz - s >0 ); }
@@ -791,17 +794,20 @@ static struct lnet_portal_rotors portal_rotors[] = { { .pr_value = LNET_PTL_ROTOR_ON, .pr_name = "ON", - .pr_desc ="round-robin dispatch all PUT messages for wildcard portals" + .pr_desc +"round-robin dispatch all PUT messages for wildcard portals" }, { .pr_value = LNET_PTL_ROTOR_RR_RT, .pr_name = "RR_RT", - .pr_desc ="round-robin dispatch routed PUT message for wildcard portals" + .pr_desc +"round-robin dispatch routed PUT message for wildcard portals" }, { .pr_value = LNET_PTL_ROTOR_HASH_RT, .pr_name = "HASH_RT", - .pr_desc ="dispatch routed PUT message by hashing source NID for wildcard portals" + .pr_desc +"dispatch routed PUT message by hashing source NID for wildcard portals" }, { .pr_value = -1,
Signature · 1 line
1.7.1
Joe Perches
maintainerRe: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 1 line · Mike Shuey
Fix many checkpatch.pl warnings.
[]
drivers/staging/lustre/lnet/lnet/acceptor.c
Quoted 1 line
drivers/staging/lustre/lnet/lnet/acceptor.c +0
-0
[]
drivers/staging/lustre/lnet/lnet/acceptor.c lnet_connect_console_error(int rc, lnet_nid_t peer_nid, · line 104
Quoted 10 lines
drivers/staging/lustre/lnet/lnet/acceptor.c +3
-3@@ -99,38 +99,42 @@ lnet_connect_console_error(int rc, lnet_nid_t peer_nid,switch (rc) {/* "normal" errors */ case -ECONNREFUSED : -CNETERR ("Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +CNETERR ( +"Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , +libcfs_nid2str (peer_nid), &peer_ip, peer_port);
These are not improvements and checkpatch messages aren't dicta.
Please don't convert code unless the conversion makes it better for a human reader.
These don't.
Re: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 18 lines · Joe Perches
Quoted 1 line · Mike Shuey
Fix many checkpatch.pl warnings.
[]
drivers/staging/lustre/lnet/lnet/acceptor.c
Quoted 1 line
drivers/staging/lustre/lnet/lnet/acceptor.c +0
-0[]
drivers/staging/lustre/lnet/lnet/acceptor.c lnet_connect_console_error(int rc, lnet_nid_t peer_nid, · line 104
Quoted 10 lines
drivers/staging/lustre/lnet/lnet/acceptor.c +3
-3@@ -99,38 +99,42 @@ lnet_connect_console_error(int rc, lnet_nid_t peer_nid,switch (rc) {/* "normal" errors */ case -ECONNREFUSED : -CNETERR ("Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +CNETERR ( +"Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , +libcfs_nid2str (peer_nid), &peer_ip, peer_port);These are not improvements and checkpatch messages aren't dicta.
Quoted 4 lines
Please don't convert code unless the conversion makes it better for a human reader.
These don't.
I haven't looked into it, but perhaps there is a standard kernel printing function that these could be converted to directly?
julia
PATCH v4 10/13 staging: lustre: lnet: lnet: checkpatch.pl fixes
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
--
Mike Shuey
Quoted 9 lines · Julia Lawall
Quoted 4 lines · Joe Perches
Quoted 1 line · Mike Shuey
Fix many checkpatch.pl warnings.
[]
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/staging/lustre/lnet/lnet/acceptor.c
Quoted 2 lines
Quoted 2 lines
[]
Review lnet_connect_console_error(int rc, lnet_nid_t
Quoted 1 line
(quoted diff) +0
-0@@ -99,38 +99,42 @@ lnet_connect_console_error(int rc, lnet_nid_t
peer_nid,
Quoted 4 lines
Quoted 4 lines
drivers/staging/lustre/lnet/lnet/acceptor.c lnet_connect_console_error(int rc, lnet_nid_t peer_nid,
Quoted 4 lines
drivers/staging/lustre/lnet/lnet/acceptor.c +0
-1switch (rc) {/* "normal" errors */ case -ECONNREFUSED : - CNETERR("Connection to %s at host %pI4h on port %d was
refused: check that Lustre is running on that node.\n",
Quoted 4 lines
Quoted 4 lines
drivers/staging/lustre/lnet/lnet/acceptor.c lnet_connect_console_error(int rc, lnet_nid_t peer_nid,
Quoted 4 lines
drivers/staging/lustre/lnet/lnet/acceptor.c +2
-2-libcfs_nid2str (peer_nid), - &peer_ip, peer_port); + CNETERR( + "Connection to %s at host %pI4h on port %d was
refused: check that Lustre is running on that node.\n",
Quoted 7 lines
Quoted 7 lines
Review lnet_connect_console_error(int rc, lnet_nid_t · line 104
Quoted 1 line
(quoted diff) +1
-0+ libcfs_nid2str(peer_nid), &peer_ip, peer_port);These are not improvements and checkpatch messages aren't dicta.
Please don't convert code unless the conversion makes it better for a human reader.
Quoted 6 lines
Quoted 1 line
These don't.
I haven't looked into it, but perhaps there is a standard kernel printing function that these could be converted to directly?
julia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20150521/6a2a74fc/attachment.htm>
Joe Perches
maintainerRe: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 9 lines · Michael Shuey
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
Yes, many other bits of code use custom debugging macros.
A good general form is to add a either a generic level or bitmask macro and use a single entry like:
my_dbg([optional_ptr,] <level|bitmap>, fmt, ...)
so that <level|bitmap> can be tested against some
variable set by MODULE_PARM_DESC controls.
So, CNETERR(...) might be lustre_dbg(ptr, NETERR, fmt, ...)
though I don't know what use the ptr might have.
Re: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
In reply to Michael ShueyQuoted 9 lines · Michael Shuey
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
Once you decide what to do, you can use Coccinelle to make the changes for you. So you shouldn't be put off by the number of code sites to change.
The normal functions are pr_err, pr_warn, etc. Perhaps you can follow Joe's suggestions if you really need something more complicated.
julia
Quoted 43 lines
--
Mike ShueyQuoted 9 lines · Julia Lawall
Quoted 4 lines · Joe Perches
Quoted 1 line · Mike Shuey
Fix many checkpatch.pl warnings.
[]
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/staging/lustre/lnet/lnet/acceptor.cQuoted 2 lines
Quoted 2 lines
[]
Review lnet_connect_console_error(int rc, lnet_nid_t
Quoted 1 line
(quoted diff) +0
-0@@ -99,38 +99,42 @@ lnet_connect_console_error(int rc, lnet_nid_t
peer_nid,Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/staging/lustre/lnet/lnet/acceptor.c +0
-0switch (rc) { /* "normal" errors */case
-ECONNREFUSED:
- CNETERR("Connection to %s at host %pI4h on port %d wasrefused: check that Lustre is running on that node.\n",
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
-
libcfs_nid2str(peer_nid),
-&peer_ip,peer_port);
+ CNETERR(
+ "Connection to %s at host %pI4h on port %d wasrefused: check that Lustre is running on that node.\n",
Quoted 13 lines
Quoted 8 lines
Quoted 1 line
+
libcfs_nid2str(peer_nid),&peer_ip,peer_port);These are not improvements and checkpatch messages aren't dicta.
Please don't convert code unless the conversion makes it better for a human reader.
These don't.
I haven't looked into it, but perhaps there is a standard kernel printing function that these could be converted to directly?
julia
Re: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 12 lines · Julia Lawall
Quoted 9 lines · Michael Shuey
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
Quoted 5 lines
Once you decide what to do, you can use Coccinelle to make the changes for you. So you shouldn't be put off by the number of code sites to change.
The normal functions are
pr_err,pr_warn, etc. Perhaps you can follow Joe's suggestions if you really need something more complicated.
Ideally leaving CERROR/CDEBUG in Lustre would be desirable from my perspective. It allows you fine grained control about what to collect and what to output into a (quite finite) kernel buffer (and over a quite slow serial console) and at the same time if you need more info, there's a buffer you can fetch separately that can grow much bigger and there's even a way to run a special daemon to scrub the buffer eagerly so none of it is lost.
Bye,
Oleg
Joe Perches
maintainerRe: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 14 lines · Oleg
Quoted 12 lines · Julia Lawall
Quoted 9 lines · Michael Shuey
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
Quoted 7 lines
Quoted 5 lines
Once you decide what to do, you can use Coccinelle to make the changes for you. So you shouldn't be put off by the number of code sites to change.
The normal functions are
pr_err,pr_warn, etc. Perhaps you can follow Joe's suggestions if you really need something more complicated.Ideally leaving CERROR/CDEBUG in Lustre would be desirable from my perspective.
My issue with CERROR is the name is little misleading.
It's actually a debugging message.
#define CERROR(format, ...) CDEBUG_LIMIT(D_ERROR, format, ## __VA_ARGS__)
I think it'd be clearer as
lustre_debug(ERROR, ...
even if the name and use style is a little longer.
Quoted 5 lines
It allows you fine grained control about what to collect and what to output into a (quite finite) kernel buffer (and over a quite slow serial console) and at the same time if you need more info, there's a buffer you can fetch separately that can grow much bigger and there's even a way to run a special daemon to scrub the buffer eagerly so none of it is lost.
Re: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 18 lines · Joe Perches
Quoted 17 lines · Oleg
Quoted 15 lines · Julia Lawall
Quoted 9 lines · Michael Shuey
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
Once you decide what to do, you can use Coccinelle to make the changes for you. So you shouldn't be put off by the number of code sites to change.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The normal functions are
pr_err,pr_warn, etc. Perhaps you can follow Joe's suggestions if you really need something more complicated.Ideally leaving CERROR/CDEBUG in Lustre would be desirable from my perspective.
My issue with CERROR is the name is little misleading.
It's actually a debugging message.
#defineCERROR(format, ...)CDEBUG_LIMIT(D_ERROR, format, ## __VA_ARGS__)
Except it's not a debugging message.
There is a clear distinction.
CERROR is something that get's printed on the console, because it's believed to be serious error (At least that's how the theory for it's usage goes). It also gets rate-limited so that the console does not get overflown. (but the debug buffer gets the full version).
(there's also LCONSOLE that always get's printed, but it does not get the prefixes like line numbers and stuff).
CDEBUG on the other hand is a debugging message (of which ERROR messages are sort of a subset (D_ERROR mask)). You can fine-tune those to be noops or to go into console or to debug buffer only. Most of those are doing nothing because they are off in the default debug mask, until actually enabled.
That CERROR usees CDEBUG underneath is just to share some common infrastructure.
Quoted 3 lines
I think it'd be clearer as
lustre_debug(ERROR, ...even if the name and use style is a little longer.
I wonder what is more clear about that in your opinion ve lustre_error/lustre_debug?
Bye,
Oleg
Joe Perches
maintainerRe: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 23 lines · Oleg
Quoted 21 lines · Joe Perches
Quoted 20 lines · Oleg
Quoted 17 lines · Julia Lawall
Quoted 9 lines · Michael Shuey
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
Once you decide what to do, you can use Coccinelle to make the changes for you. So you shouldn't be put off by the number of code sites to change.
The normal functions are
pr_err,pr_warn, etc. Perhaps you can follow Joe's suggestions if you really need something more complicated.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Ideally leaving CERROR/CDEBUG in Lustre would be desirable from my perspective.
My issue with CERROR is the name is little misleading.
It's actually a debugging message.
#defineCERROR(format, ...)CDEBUG_LIMIT(D_ERROR, format, ## __VA_ARGS__)Except it's not a debugging message.
There is a clear distinction.
Not really. If the first reading sjows that the mechanism it goes through is called CDEBUG, a reasonable expectation should be that it's a debugging message.
Quoted 12 lines
CERROR is something that get's printed on the console, because it's believed to be serious error (At least that's how the theory for it's usage goes). It also gets rate-limited so that the console does not get overflown. (but the debug buffer gets the full version).
(there's also LCONSOLE that always get's printed, but it does not get the prefixes like line numbers and stuff).CDEBUG on the other hand is a debugging message (of which ERROR messages are sort of a subset (
D_ERRORmask)). You can fine-tune those to be noops or to go into console or to debug buffer only. Most of those are doing nothing because they are off in the default debug mask, until actually enabled.
Quoted 8 lines
That CERROR usees CDEBUG underneath is just to share some common infrastructure.
Quoted 3 lines
I think it'd be clearer as
lustre_debug(ERROR, ...even if the name and use style is a little longer.
I wonder what is more clear about that in your opinion ve lustre_error/lustre_debug?
The fact that you have to explain this shows that it's at least misleading unless you completely understand the code.
It'd be more intelligible if this CERROR became lustre_err and the actual debugging uses were lustre_dbg
Perhaps it needs a better explanation somewhere not in the code but in some external documentation. I haven't looked.
Re: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 30 lines · Joe Perches
Quoted 29 lines · Oleg
Quoted 26 lines · Joe Perches
Quoted 14 lines · Oleg
Quoted 12 lines · Julia Lawall
Quoted 9 lines · Michael Shuey
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
Quoted 7 lines
Quoted 5 lines
Once you decide what to do, you can use Coccinelle to make the changes for you. So you shouldn't be put off by the number of code sites to change.
The normal functions are
pr_err,pr_warn, etc. Perhaps you can follow Joe's suggestions if you really need something more complicated.Ideally leaving CERROR/CDEBUG in Lustre would be desirable from my perspective.
My issue with CERROR is the name is little misleading.
It's actually a debugging message.
#defineCERROR(format, ...)CDEBUG_LIMIT(D_ERROR, format, ## __VA_ARGS__)
Quoted 6 lines
Quoted 2 lines
Except it's not a debugging message.
There is a clear distinction.Not really. If the first reading sjows that the mechanism it goes through is called CDEBUG, a reasonable expectation should be that it's a debugging message.
Well, various pr_err/pr_dbg for example, go through printk in the end too. Do that make them the same?
Quoted 19 lines
Quoted 19 lines
CERROR is something that get's printed on the console, because it's believed to be serious error (At least that's how the theory for it's usage goes). It also gets rate-limited so that the console does not get overflown. (but the debug buffer gets the full version).
(there's also LCONSOLE that always get's printed, but it does not get the prefixes like line numbers and stuff).CDEBUG on the other hand is a debugging message (of which ERROR messages are sort of a subset (
D_ERRORmask)). You can fine-tune those to be noops or to go into console or to debug buffer only. Most of those are doing nothing because they are off in the default debug mask, until actually enabled.That CERROR usees CDEBUG underneath is just to share some common infrastructure.
Quoted 3 lines
I think it'd be clearer as
lustre_debug(ERROR, ...even if the name and use style is a little longer.
Quoted 6 lines
Quoted 2 lines
I wonder what is more clear about that in your opinion ve lustre_error/lustre_debug?
The fact that you have to explain this shows that it's at least misleading unless you completely understand the code.
Or you know, you might take the function name at the face value
and assume that CERROR means it's an error and CDEBUG means it's a debug message?
Quoted 2 lines
It'd be more intelligible if this CERROR became
lustre_errand the actual debugging uses werelustre_dbg
But the actual underlying call is hidden by the macro anyway and you never get to see it. You see CDEBUG/CERROR and how is that different from lustre_debug/lustre_err?
Quoted 3 lines
Perhaps it needs a better explanation somewhere not in the code but in some external documentation. I haven't looked.
Joe Perches
maintainerRe: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 32 lines · Oleg
Quoted 31 lines · Joe Perches
Quoted 29 lines · Oleg
Quoted 17 lines · Joe Perches
Quoted 16 lines · Oleg
Quoted 15 lines · Julia Lawall
Quoted 9 lines · Michael Shuey
That's a task (of many) I've been putting on the back burner until the code is cleaner. It's also a HUGE change, since there are debug macros everywhere, and they all check a #define'd mask to see if they should fire, and the behavior is likely governed by parts of the lustre user land tools as well.
Suggestions are welcome. Do other parts of the linux kernel define complex debugging macros like these, or is this a lustre-ism? Any suggestions on how to handle this more in line with existing drivers?
Once you decide what to do, you can use Coccinelle to make the changes for you. So you shouldn't be put off by the number of code sites to change.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The normal functions are
pr_err,pr_warn, etc. Perhaps you can follow Joe's suggestions if you really need something more complicated.Ideally leaving CERROR/CDEBUG in Lustre would be desirable from my perspective.
My issue with CERROR is the name is little misleading.
It's actually a debugging message.
#defineCERROR(format, ...)CDEBUG_LIMIT(D_ERROR, format, ## __VA_ARGS__)Except it's not a debugging message.
There is a clear distinction.
Quoted 6 lines
Quoted 3 lines
Not really. If the first reading shows that the mechanism it goes through is called CDEBUG, a reasonable expectation should be that it's a debugging message.
Well, various pr_err/pr_dbg for example, go through printk in the end too. Do that make them the same?
No, because each is labeled with the KERN_<level> that it uses.
[]
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
I wonder what is more clear about that in your opinion ve lustre_error/lustre_debug?
The fact that you have to explain this shows that it's at least misleading unless you completely understand the code.
Or you know, you might take the function name at the face value
and assume that CERROR means it's an error and CDEBUG means it's a debug message?
Maybe, but I think that it'd be better if the mechanism it uses was more plainly named something like lustre_log.
Re: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 7 lines · Joe Perches
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
I wonder what is more clear about that in your opinion ve lustre_error/lustre_debug?
The fact that you have to explain this shows that it's at least misleading unless you completely understand the code.
Quoted 5 lines
Quoted 2 lines
Or you know, you might take the function name at the face value
and assume that CERROR means it's an error and CDEBUG means it's a debug message?Maybe, but I think that it'd be better if the mechanism it uses was more plainly named something like
lustre_log.
While the idea seems good, the biggest obstacle here is such that there's already a thing called lustre log (llog for short too) - it's kind of a distributed journal of operations.
Its there a different synonym, I wonder?
Joe Perches
maintainerRe: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 11 lines · Oleg
Quoted 10 lines · Joe Perches
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
I wonder what is more clear about that in your opinion ve lustre_error/lustre_debug?
The fact that you have to explain this shows that it's at least misleading unless you completely understand the code.
Or you know, you might take the function name at the face value
and assume that CERROR means it's an error and CDEBUG means it's a debug message?
Quoted 8 lines
Quoted 2 lines
Maybe, but I think that it'd be better if the mechanism it uses was more plainly named something like
lustre_log.While the idea seems good, the biggest obstacle here is such that there's already a thing called lustre log (llog for short too) - it's kind of a distributed journal of operations.
Its there a different synonym, I wonder?
Maybe: lustre_printk, lustre_logmsg, lustre_output
RE: [HPDD-discuss] [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Since it is not actually doing a printk - at least, not necessarily - I like lustre_logmsg. lustre_output seems too vague.
- Patrick
________________________________________
From: HPDD-discuss [[email protected]] on behalf of Joe Perches [[email protected]]
Sent: Friday, May 22, 2015 7:36 PM
To: Drokin, Oleg
Cc: <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; Julia Lawall; <[email protected]>; <[email protected]>
Subject: Re: [HPDD-discuss] [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 11 lines · Oleg
Quoted 10 lines · Joe Perches
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
I wonder what is more clear about that in your opinion ve lustre_error/lustre_debug?
The fact that you have to explain this shows that it's at least misleading unless you completely understand the code.
Or you know, you might take the function name at the face value
and assume that CERROR means it's an error and CDEBUG means it's a debug message?
Quoted 8 lines
Quoted 2 lines
Maybe, but I think that it'd be better if the mechanism it uses was more plainly named something like
lustre_log.While the idea seems good, the biggest obstacle here is such that there's already a thing called lustre log (llog for short too) - it's kind of a distributed journal of operations.
Its there a different synonym, I wonder?
Maybe: lustre_printk, lustre_logmsg, lustre_output
_______________________________________________
HPDD-discuss mailing list
[email protected]
https://lists.01.org/mailman/listinfo/hpdd-discuss
A message that is not in the archive (sent off-list or not yet received): CABqvwjs=S1VrCHe7M4JnDikGBVN3yqjNMrtSA=UvftGmxSasRQ@mail.gmail.com
Joe Perches
maintainerRe: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 3 lines · Michael Shuey
Any suggestions on other checkpatch warnings? Most of what remains are "don't introduce new typedefs" warnings - should these be removed as well, or am I safe to leave these?
I'm personally not a big fan of non-enum typedefs unless the typedef hides some arch or size specific information that's otherwise hard to handle.
I think struct/function/native type equivalent typedefs are better removed.
coccinelle is a good tool for this.
I rather like enum typedefs, but that's not a common view in lk land.
Quoted 3 lines
I ask because these changes will be huge, and
are unlikely to improve readability (but I don't know where the kernel community stands on having billions of typedefs everywhere.
I counted slightly less than billions. I got 281.
Re: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
In reply to a message not in the archiveRemoval of lustre-added typedefs is worthwhile, actually.
I scraped the surface some time ago, but could not complete it back then.
Quoted 33 lines · Michael Shuey
I've been killing off a *lot* of checkpatch warnings, and I'm probably getting a tad overzealous. I'll drop these from the patch series next time I rebase, and avoid doing this in the future. Thanks for the input.
Any suggestions on other checkpatch warnings? Most of what remains are "don't introduce new typedefs" warnings - should these be removed as well, or am I safe to leave these? I ask because these changes will be huge, and are unlikely to improve readability (but I don't know where the kernel community stands on having billions of typedefs everywhere.
--
Mike ShueyOn Thu, May 21, 2015 at 5:00 PM, Joe Perches <[email protected]> wrote:
Quoted 1 line · Mike Shuey
Fix many checkpatch.pl warnings.
[]
drivers/staging/lustre/lnet/lnet/acceptor.c
Quoted 1 line
drivers/staging/lustre/lnet/lnet/acceptor.c +0
-0[]
drivers/staging/lustre/lnet/lnet/acceptor.c lnet_connect_console_error(int rc, lnet_nid_t peer_nid, · line 104
Quoted 10 lines
drivers/staging/lustre/lnet/lnet/acceptor.c +3
-3@@ -99,38 +99,42 @@ lnet_connect_console_error(int rc, lnet_nid_t peer_nid,switch (rc) {/* "normal" errors */ case -ECONNREFUSED : -CNETERR ("Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +CNETERR ( +"Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , +libcfs_nid2str (peer_nid), &peer_ip, peer_port);These are not improvements and checkpatch messages aren't dicta.
Please don't convert code unless the conversion makes it better for a human reader.
These don't.
Re: [PATCH v4 10/13] staging: lustre: lnet: lnet: checkpatch.pl fixes
Quoted 8 lines · Oleg
Removal of lustre-added typedefs is worthwhile, actually.
I scraped the surface some time ago, but could not complete it back then.Quoted 3 lines · Michael Shuey
I've been killing off a *lot* of checkpatch warnings, and I'm probably getting a tad overzealous. I'll drop these from the patch series next time I rebase, and avoid doing this in the future. Thanks for the input.
Any suggestions on other checkpatch warnings? Most of what remains are "don't introduce new typedefs" warnings - should these be removed as well, or am I safe to leave these? I ask because these changes will be huge, and are unlikely to improve readability (but I don't know where the kernel community stands on having billions of typedefs everywhere.
There is discussion in the kernel documentation about typedefs. Typedefs on structure types are particularly discouraged, to my recollection.
julia
Quoted 36 lines
Quoted 23 lines
--
Mike ShueyOn Thu, May 21, 2015 at 5:00 PM, Joe Perches <[email protected]> wrote:
Quoted 1 line · Mike Shuey
Fix many checkpatch.pl warnings.
[]
drivers/staging/lustre/lnet/lnet/acceptor.c
Quoted 1 line
drivers/staging/lustre/lnet/lnet/acceptor.c +0
-0[]
drivers/staging/lustre/lnet/lnet/acceptor.c lnet_connect_console_error(int rc, lnet_nid_t peer_nid, · line 104
Quoted 10 lines
drivers/staging/lustre/lnet/lnet/acceptor.c +3
-3@@ -99,38 +99,42 @@ lnet_connect_console_error(int rc, lnet_nid_t peer_nid,switch (rc) {/* "normal" errors */ case -ECONNREFUSED : -CNETERR ("Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +CNETERR ( +"Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , +libcfs_nid2str (peer_nid), &peer_ip, peer_port);These are not improvements and checkpatch messages aren't dicta.
Quoted 7 lines
Please don't convert code unless the conversion makes it better for a human reader.
These don't.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Joe Perches
maintainerPATCH 1/1 checkpatch: Categorize some long line length checks
In reply to Joe PerchesMany lines of code extend beyond the maximum line length. Some of these are possibly justified by use type.
For instance:
structure definitions where comments are added per member like
struct foo {
type member; /* some long description */
}
And lines that don't fit the typical logging message style where a string constant is used like:
SOME_MACRO(args, "Some long string");
Categorize these long line types so that checkpatch can use a command-line --ignore=<type> option to avoid emitting some long line warnings.
Comment the code a bit better too.
--- scripts/checkpatch.pl | 54 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-)
scripts/checkpatch.pl +44 -10
@@ -2510,16 +2510,50 @@ sub process { # check we are in a valid source file if not then ignore this hunk next if ($realfile !~ /\.(h|c|s|S|pl|sh|dtsi|dts)$/); -#line length limit - if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && - $rawline !~ /^.\s*\*\s*\@$Ident\s/ && - !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?$String\s*(?:|,|\)\s*;)\s*$/ || - $line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ || - $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) && - $length > $max_line_length) - { - WARN("LONG_LINE", - "line over $max_line_length characters\n" . $herecurr); +# line length limit (with some exclusions) +# +# There are 3 different line length message types: +# LONG_LINE_COMMENT a comment starts before but extends beyond length +# LONG_LINE_STRING a string starts before but extends beyond length +# LONG_LINE all other lines longer than $max_line_length +# +# if LONG_LINE is ignored, the other 2 types are also ignored +# +# LONG_LINE has a few types of lines that may extend beyong $max_line_length +# kernel-doc arguments +# logging functions like pr_info that end in a string +# lines with a single string +# #defines that are a single string + + if ($length > $max_line_length) { + my $msg_type = ""; + + # comment starts before $max_line_length + if ($line =~ /([\s$;]+)$/ && + length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { + $msg_type = "LONG_LINE_COMMENT" + + # quoted string starts before $max_line_length + } elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ && + length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { + $msg_type = "LONG_LINE_STRING" + + # general long longs + # exclude kernel-doc argument lines + } elsif ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && + $rawline !~ /^.\s*\*\s*\@$Ident\s/ && + # exclude logging functions that end in a string + !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?$String\s*(?:|,|\)\s*;)\s*$/ || + # exclude lines with only strings + $line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ || + # exclude #defines with only strings + $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/)) { + $msg_type = "LONG_LINE"; + } + if ($msg_type ne "" && show_type("LONG_LINE")) { + WARN($msg_type, + "line over $max_line_length characters\n" . $herecurr); + } } # check for adding lines without a newline.
Re: [PATCH] checkpatch: Categorize some long line length checks
Quoted 9 lines · Joe Perches
Many lines of code extend beyond the maximum line length. Some of these are possibly justified by use type.
For instance:
structure definitions where comments are added per member like
struct foo {
type member; /* some long description */
I'm not super fond of the comment one. Perhaps people could express themselves more concisely, or put the details elsewhere?
julia
Quoted 90 lines
}
And lines that don't fit the typical logging message style where a string constant is used like:
SOME_MACRO(args, "Some long string");Categorize these long line types so that checkpatch can use a command-line --ignore=<type> option to avoid emitting some long line warnings.
Comment the code a bit better too.
Signed-off-by Joe Perches <[email protected]>--- scripts/checkpatch.pl | 54 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-)scripts/checkpatch.pl +44
-11@@ -2510,16 +2510,50 @@ sub process { # check we are in a valid source file if not then ignore this hunk next if ($realfile !~ /\.(h|c|s|S|pl|sh|dtsi|dts)$/); -#line length limit - if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && - $rawline !~ /^.\s*\*\s*\@$Ident\s/ && - !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?$String\s*(?:|,|\)\s*;)\s*$/ || - $line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ || - $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) && - $length > $max_line_length) - { - WARN("LONG_LINE", - "line over $max_line_length characters\n" . $herecurr); +# line length limit (with some exclusions) +# +# There are 3 different line length message types: +# LONG_LINE_COMMENT a comment starts before but extends beyond length +# LONG_LINE_STRING a string starts before but extends beyond length +# LONG_LINE all other lines longer than $max_line_length +# +# if LONG_LINE is ignored, the other 2 types are also ignored +# +# LONG_LINE has a few types of lines that may extend beyong $max_line_length +# kernel-doc arguments +# logging functions like pr_info that end in a string +# lines with a single string +# #defines that are a single string + + if ($length > $max_line_length) { + my $msg_type = ""; + + # comment starts before $max_line_length + if ($line =~ /([\s$;]+)$/ && + length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { + $msg_type = "LONG_LINE_COMMENT" + + # quoted string starts before $max_line_length + } elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ && + length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { + $msg_type = "LONG_LINE_STRING" + + # general long longs + # exclude kernel-doc argument lines + } elsif ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && + $rawline !~ /^.\s*\*\s*\@$Ident\s/ && + # exclude logging functions that end in a string + !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?$String\s*(?:|,|\)\s*;)\s*$/ || + # exclude lines with only strings + $line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ || + # exclude #defines with only strings + $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/)) { + $msg_type = "LONG_LINE"; + } + if ($msg_type ne "" && show_type("LONG_LINE")) { + WARN($msg_type, + "line over $max_line_length characters\n" . $herecurr); + } } # check for adding lines without a newline. --To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Joe Perches
maintainerRe: [PATCH] checkpatch: Categorize some long line length checks
Quoted 6 lines · Julia Lawall
Quoted 5 lines · Joe Perches
Many lines of code extend beyond the maximum line length. Some of these are possibly justified by use type.
For instance:
Quoted 7 lines
Quoted 4 lines
structure definitions where comments are added per member like
struct foo {
type member; /* some long description */I'm not super fond of the comment one. Perhaps people could express themselves more concisely, or put the details elsewhere?
Concision is good, straining for brevity or bad formatting isn't.
I've seen a lot of ugly patches lately to "fix" code like this by making it worse.
By default, there is still a long_line warning for this style. It arguably could be appropriate to keep some lines like this and this makes it easy to tell people "add --ignore=<type>".
This patch shouldn't be applied right now anyway.
I think the idea is OK, but this implementation could be improved and clarified by moving the current exclusions before the classifications.
Anyone else have an opinion?
I'll send a V2 later unless there are more comments.
Re: [PATCH] checkpatch: Categorize some long line length checks
I feel like the lustre headers could be fit into 80 characters without losing very much.
No one uses the complicated options on checkpatch anyway, they just grep away the warnings they don't like. Newbies especially don't use them.
regards,
dan carpenter
Joe Perches
maintainerRe: [PATCH] checkpatch: Categorize some long line length checks
Quoted 2 lines · Dan Carpenter
I feel like the lustre headers could be fit into 80 characters without losing very much.
Maybe.
Quoted 2 lines
No one uses the complicated options on checkpatch anyway, they just grep away the warnings they don't like.
That'd be false. Other projects like u-boot do.
Quoted 1 line
Newbies especially don't use them.
True, but capability exclusion doesn't seem the
right path.
Re: [PATCH] checkpatch: Categorize some long line length checks
Quoted 5 lines · Joe Perches
Quoted 2 lines · Dan Carpenter
No one uses the complicated options on checkpatch anyway, they just grep away the warnings they don't like.
That'd be false. Other projects like u-boot do.
Ah. Ok.
regards,
dan carpenter
Joe Perches
maintainerPATCH v2 1/1 checkpatch: Categorize some long line length checks
In reply to Joe PerchesMany lines of code extend beyond the maximum line length. Some of these are possibly justified by use type.
For instance:
structure definitions where comments are added per member like:
struct foo {
type member; /* some long description */
And lines that don't fit the typical logging message style where a string constant is used like:
SOME_MACRO(args, "Some long string");
Categorize these long line types so that checkpatch can use a command-line --ignore=<type> option to avoid emitting some long line warnings.
One of the existing checkpatch exclusions allowed kernel-doc argument documentation to exceed 80 columns because old versions of kernel-doc required single line documentation. The requirement was removed in 2009 so remove that exclusion.
Add documentation to make the test a bit clearer.
--- scripts/checkpatch.pl | 60 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 10 deletions(-)
scripts/checkpatch.pl +50 -10
@@ -2510,16 +2510,56 @@ sub process { # check we are in a valid source file if not then ignore this hunk next if ($realfile !~ /\.(h|c|s|S|pl|sh|dtsi|dts)$/); -#line length limit - if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && - $rawline !~ /^.\s*\*\s*\@$Ident\s/ && - !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?$String\s*(?:|,|\)\s*;)\s*$/ || - $line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ || - $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) && - $length > $max_line_length) - { - WARN("LONG_LINE", - "line over $max_line_length characters\n" . $herecurr); +# line length limit (with some exclusions) +# +# There are a few types of lines that may extend beyond $max_line_length: +# logging functions like pr_info that end in a string +# lines with a single string +# #defines that are a single string +# +# There are 3 different line length message types: +# LONG_LINE_COMMENT a comment starts before but extends beyond $max_linelength +# LONG_LINE_STRING a string starts before but extends beyond $max_line_length +# LONG_LINE all other lines longer than $max_line_length +# +# if LONG_LINE is ignored, the other 2 types are also ignored +# + + if ($length > $max_line_length) { + my $msg_type = "LONG_LINE"; + + # Check the allowed long line types first + + # logging functions that end in a string that starts + # before $max_line_length + if ($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(?:KERN_\S+\s*|[^"]*))?($String\s*(?:|,|\)\s*;)\s*)$/ && + length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { + $msg_type = ""; + + # lines with only strings (w/ possible termination) + # #defines with only strings + } elsif ($line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ || + $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) { + $msg_type = ""; + + # Otherwise set the alternate message types + + # a comment starts before $max_line_length + } elsif ($line =~ /($;[\s$;]*)$/ && + length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { + $msg_type = "LONG_LINE_COMMENT" + + # a quoted string starts before $max_line_length + } elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ && + length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { + $msg_type = "LONG_LINE_STRING" + } + + if ($msg_type ne "" && + (show_type("LONG_LINE") || show_type($msg_type))) { + WARN($msg_type, + "line over $max_line_length characters\n" . $herecurr); + } } # check for adding lines without a newline.
PATCH v4 10/13 staging: lustre: lnet: lnet: checkpatch.pl fixes
In reply to Mike ShueyFix many checkpatch.pl warnings.
--- drivers/staging/lustre/lnet/lnet/acceptor.c | 69 ++++++++++++++--------- drivers/staging/lustre/lnet/lnet/api-ni.c | 18 ++++-- drivers/staging/lustre/lnet/lnet/config.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-eq.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 9 ++- drivers/staging/lustre/lnet/lnet/router.c | 17 ++++-- drivers/staging/lustre/lnet/lnet/router_proc.c | 16 ++++-- 8 files changed, 88 insertions(+), 51 deletions(-)
drivers/staging/lustre/lnet/lnet/acceptor.c +42 -27
@@ -99,38 +99,42 @@ lnet_connect_console_error(int rc, lnet_nid_t peer_nid,switch (rc) {/* "normal" errors */ case -ECONNREFUSED : -CNETERR ("Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +CNETERR ( +"Connection to %s at host %pI4h on port %d was refused: check that Lustre is running on that node.\n" , +libcfs_nid2str (peer_nid), &peer_ip, peer_port);break ;case -EHOSTUNREACH :case -ENETUNREACH : -CNETERR ("Connection to %s at host %pI4h was unreachable: the network or that node may be down, or Lustre may be misconfigured.\n" , +CNETERR ( +"Connection to %s at host %pI4h was unreachable: the network or that node may be down, or Lustre may be misconfigured.\n" ,libcfs_nid2str (peer_nid), &peer_ip);break ;case -ETIMEDOUT : -CNETERR ("Connection to %s at host %pI4h on port %d took too long: that node may be hung or experiencing high load.\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +CNETERR ( +"Connection to %s at host %pI4h on port %d took too long: that node may be hung or experiencing high load.\n" , +libcfs_nid2str (peer_nid), &peer_ip, peer_port);break ;case -ECONNRESET : -LCONSOLE_ERROR_MSG (0x11b ,"Connection to %s at host %pI4h on port %d was reset: is it running a compatible version of Lustre and is %s one of its NIDs?\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port, -libcfs_nid2str (peer_nid)); +LCONSOLE_ERROR_MSG (0x11b , +"Connection to %s at host %pI4h on port %d was reset: is it running a compatible version of Lustre and is %s one of its NIDs?\n" , +libcfs_nid2str (peer_nid), &peer_ip, + peer_port,libcfs_nid2str (peer_nid));break ;case -EPROTO : -LCONSOLE_ERROR_MSG (0x11c ,"Protocol error connecting to %s at host %pI4h on port %d: is it running a compatible version of Lustre?\n" , -libcfs_nid2str (peer_nid), - &peer_ip, peer_port); +LCONSOLE_ERROR_MSG (0x11c , +"Protocol error connecting to %s at host %pI4h on port %d: is it running a compatible version of Lustre?\n" , +libcfs_nid2str (peer_nid), &peer_ip, + peer_port);break ;case -EADDRINUSE : -LCONSOLE_ERROR_MSG (0x11d ,"No privileged ports available to connect to %s at host %pI4h on port %d\n" , +LCONSOLE_ERROR_MSG (0x11d , +"No privileged ports available to connect to %s at host %pI4h on port %d\n" ,libcfs_nid2str (peer_nid), &peer_ip, peer_port);break ;default : -LCONSOLE_ERROR_MSG (0x11e ,"Unexpected error %d connecting to %s at host %pI4h on port %d\n" , +LCONSOLE_ERROR_MSG (0x11e , +"Unexpected error %d connecting to %s at host %pI4h on port %d\n" , rc,libcfs_nid2str (peer_nid), &peer_ip, peer_port);break ;
@@ -238,7 +242,8 @@ lnet_accept(struct socket *sock, __u32 magic) accept_timeout);if (rc !=0 ) -CERROR ("Error sending magic+version in response to LNET magic from %pI4h: %d\n" , +CERROR ( +"Error sending magic+version in response to LNET magic from %pI4h: %d\n" , &peer_ip, rc);return -EPROTO ; }
@@ -250,7 +255,8 @@ lnet_accept(struct socket *sock, __u32 magic)else str ="unrecognised" ; -LCONSOLE_ERROR_MSG (0x11f ,"Refusing connection from %pI4h magic %08x: %s acceptor protocol\n" , +LCONSOLE_ERROR_MSG (0x11f , +"Refusing connection from %pI4h magic %08x: %s acceptor protocol\n" , &peer_ip, magic, str);return -EPROTO ; }
@@ -261,7 +267,8 @@ lnet_accept(struct socket *sock, __u32 magic)sizeof (cr.acr_version), accept_timeout);if (rc !=0 ) { -CERROR ("Error %d reading connection request version from %pI4h\n" , +CERROR ( +"Error %d reading connection request version from %pI4h\n" , rc, &peer_ip);return -EIO ; }
@@ -284,7 +291,8 @@ lnet_accept(struct socket *sock, __u32 magic) accept_timeout);if (rc !=0 ) -CERROR ("Error sending magic+version in response to version %d from %pI4h: %d\n" , +CERROR ( +"Error sending magic+version in response to version %d from %pI4h: %d\n" , peer_version, &peer_ip, rc);return -EPROTO ; }
@@ -294,7 +302,8 @@ lnet_accept(struct socket *sock, __u32 magic) offsetof(lnet_acceptor_connreq_t , acr_nid), accept_timeout);if (rc !=0 ) { -CERROR ("Error %d reading connection request from %pI4h\n" , +CERROR ( +"Error %d reading connection request from %pI4h\n" , rc, &peer_ip);return -EIO ; }
@@ -307,7 +316,8 @@ lnet_accept(struct socket *sock, __u32 magic) ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */if (ni !=NULL )lnet_ni_decref (ni); -LCONSOLE_ERROR_MSG (0x120 ,"Refusing connection from %pI4h for %s: No matching NI\n" , +LCONSOLE_ERROR_MSG (0x120 , +"Refusing connection from %pI4h for %s: No matching NI\n" , &peer_ip,libcfs_nid2str (cr.acr_nid));return -EPERM ; }
@@ -315,7 +325,8 @@ lnet_accept(struct socket *sock, __u32 magic)if (ni->ni_lnd->lnd_accept =NULL ) {/* This catches a request for the loopback LND */ lnet_ni_decref (ni); -LCONSOLE_ERROR_MSG (0x121 ,"Refusing connection from %pI4h for %s: NI doesn not accept IP connections\n" , +LCONSOLE_ERROR_MSG (0x121 , +"Refusing connection from %pI4h for %s: NI doesn not accept IP connections\n" , &peer_ip,libcfs_nid2str (cr.acr_nid));return -EPERM ; }
@@ -347,10 +358,12 @@ lnet_acceptor(void *arg) 0, accept_port, accept_backlog);if (rc !=0 ) {if (rc = -EADDRINUSE ) -LCONSOLE_ERROR_MSG (0x122 ,"Can't start acceptor on port %d: port already in use\n" , +LCONSOLE_ERROR_MSG (0x122 , +"Can't start acceptor on port %d: port already in use\n" , accept_port);else -LCONSOLE_ERROR_MSG (0x123 ,"Can't start acceptor on port %d: unexpected error %d\n" , +LCONSOLE_ERROR_MSG (0x123 , +"Can't start acceptor on port %d: unexpected error %d\n" , accept_port, rc); lnet_acceptor_state.pta_sock =NULL ;
@@ -390,7 +403,8 @@ lnet_acceptor(void *arg) }if (secure && peer_port >LNET_ACCEPTOR_MAX_RESERVED_PORT ) { -CERROR ("Refusing connection from %pI4h: insecure port %d\n" , +CERROR ( +"Refusing connection from %pI4h: insecure port %d\n" , &peer_ip, peer_port); goto failed; }
@@ -398,7 +412,8 @@ lnet_acceptor(void *arg) rc =libcfs_sock_read (newsock, &magic,sizeof (magic), accept_timeout);if (rc !=0 ) { -CERROR ("Error %d reading connection request from %pI4h\n" , +CERROR ( +"Error %d reading connection request from %pI4h\n" , rc, &peer_ip); goto failed; }
drivers/staging/lustre/lnet/lnet/api-ni.c +12 -6
@@ -74,7 +74,8 @@ lnet_get_networks(void)int rc;if (*networks !=0 && *ip2nets !=0 ) { -LCONSOLE_ERROR_MSG (0x101 ,"Please specify EITHER 'networks' or 'ip2nets' but not both at once\n" ); +LCONSOLE_ERROR_MSG (0x101 , +"Please specify EITHER 'networks' or 'ip2nets' but not both at once\n" );return NULL ; }
@@ -189,7 +190,8 @@ static void lnet_assert_wire_constants(void)/* Checks for struct ptl_handle_wire_t */ CLASSERT ((int )sizeof (lnet_handle_wire_t) =16 ); CLASSERT((int)offsetof(lnet_handle_wire_t, wh_interface_cookie) = 0); -CLASSERT ((int )sizeof (((lnet_handle_wire_t *)0 )->wh_interface_cookie) =8 ); +CLASSERT ((int )sizeof (((lnet_handle_wire_t *)0 )->wh_interface_cookie) = +8 ); CLASSERT((int)offsetof(lnet_handle_wire_t, wh_object_cookie) = 8);CLASSERT ((int )sizeof (((lnet_handle_wire_t *)0 )->wh_object_cookie) =8 );
@@ -1085,7 +1087,8 @@ lnet_startup_lndnis(void)mutex_unlock (&the_lnet.ln_lnd_mutex);if (rc !=0 ) { -LCONSOLE_ERROR_MSG (0x105 ,"Error %d starting up LNI %s\n" , +LCONSOLE_ERROR_MSG (0x105 , +"Error %d starting up LNI %s\n" , rc,libcfs_lnd2str (lnd->lnd_type));lnet_net_lock (LNET_LOCK_EX ); lnd->lnd_refcount--;
@@ -1141,7 +1144,8 @@ lnet_startup_lndnis(void)if (the_lnet.ln_eq_waitni !=NULL && nicount >1 ) { lnd_type = the_lnet.ln_eq_waitni->ni_lnd->lnd_type; -LCONSOLE_ERROR_MSG (0x109 ,"LND %s can only run single-network\n" , +LCONSOLE_ERROR_MSG (0x109 , +"LND %s can only run single-network\n" ,libcfs_lnd2str (lnd_type)); goto failed; }
@@ -1187,7 +1191,8 @@ LNetInit(void)LASSERT (the_lnet.ln_cpt_number >0 );if (the_lnet.ln_cpt_number >LNET_CPT_MAX ) {/* we are under risk of consuming all lh_cookie */ -CERROR ("Can't have %d CPTs for LNet (max allowed is %d), please change setting of CPT-table and retry\n" , +CERROR ( +"Can't have %d CPTs for LNet (max allowed is %d), please change setting of CPT-table and retry\n" , the_lnet.ln_cpt_number,LNET_CPT_MAX );return -1 ; }
@@ -1749,7 +1754,8 @@ lnet_ping_target_fini(void) }int -lnet_ping (lnet_process_id_t id,int timeout_ms,lnet_process_id_t *ids,int n_ids) +lnet_ping (lnet_process_id_t id,int timeout_ms,lnet_process_id_t *ids, +int n_ids) {lnet_handle_eq_t eqh;lnet_handle_md_t mdh;
drivers/staging/lustre/lnet/lnet/config.c +1 -1
@@ -27,7 +27,7 @@* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * -* Copyright (c) 2012, Intel Corporation. +* Copyright (c) 2012, 2014, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/
drivers/staging/lustre/lnet/lnet/lib-eq.c +3 -1
@@ -82,7 +82,9 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, count =cfs_power2_roundup (count);if (callback !=LNET_EQ_HANDLER_NONE && count !=0 ) -CWARN ("EQ callback is guaranteed to get every event, do you still want to set eqcount %d for polling event which will have locking overhead? Please contact with developer to confirm\n" , count); +CWARN ( +"EQ callback is guaranteed to get every event, do you still want to set eqcount %d for polling event which will have locking overhead? Please contact with developer to confirm\n" , + count);/* count can be 0 if only need callback, we can eliminate * overhead of enqueue event */
drivers/staging/lustre/lnet/lnet/lib-md.c +2 -2
@@ -144,7 +144,7 @@ lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink) lmd->md_length = total_length; -if ((umd->options &LNET_MD_MAX_SIZE ) !=0 &&/* max size used */ +if ((umd->options &LNET_MD_MAX_SIZE ) !=0 &&/* max size used */ (umd->max_size <0 || umd->max_size > total_length))/* illegal max_size */ return -EINVAL ;
@@ -154,7 +154,7 @@ lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink) lmd->md_iov.iov[0 ].iov_base = umd->start; lmd->md_iov.iov[0 ].iov_len = umd->length; -if ((umd->options &LNET_MD_MAX_SIZE ) !=0 &&/* max size used */ +if ((umd->options &LNET_MD_MAX_SIZE ) !=0 &&/* max size used */ (umd->max_size <0 || umd->max_size > (int )umd->length))/* illegal max_size */ return -EINVAL ;
drivers/staging/lustre/lnet/lnet/lib-ptl.c +6 -3
@@ -184,7 +184,8 @@ lnet_try_match_md(lnet_libmd_t *md, mlength = info->mi_rlength; }else if ((md->md_options &LNET_MD_TRUNCATE ) =0 ) {/* this packet _really_ is too big */ -CERROR ("Matching packet from %s, match %llu length %d too big: %d left, %d allowed\n" , +CERROR ( +"Matching packet from %s, match %llu length %d too big: %d left, %d allowed\n" ,libcfs_id2str (info->mi_id), info->mi_mbits, info->mi_rlength, md->md_length - offset, mlength);
@@ -192,7 +193,8 @@ lnet_try_match_md(lnet_libmd_t *md, }/* Commit to this ME/MD */ -CDEBUG (D_NET ,"Incoming %s index %x from %s of length %d/%d into md %#llx [%d] + %d\n" , +CDEBUG (D_NET , +"Incoming %s index %x from %s of length %d/%d into md %#llx [%d] + %d\n" , (info->mi_opc =LNET_MD_OP_PUT ) ?"put" :"get" , info->mi_portal,libcfs_id2str (info->mi_id), mlength, info->mi_rlength, md->md_lh.lh_cookie, md->md_niov, offset);
@@ -685,7 +687,8 @@ lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md,if ((rc &LNET_MATCHMD_OK ) !=0 ) {list_add_tail (&msg->msg_list, matches); -CDEBUG (D_NET ,"Resuming delayed PUT from %s portal %d match %llu offset %d length %d.\n" , +CDEBUG (D_NET , +"Resuming delayed PUT from %s portal %d match %llu offset %d length %d.\n" ,libcfs_id2str (info.mi_id), info.mi_portal, info.mi_mbits, info.mi_roffset, info.mi_rlength);
drivers/staging/lustre/lnet/lnet/router.c +11 -6
@@ -456,7 +456,8 @@ lnet_check_routes(void)lnet_net_unlock (cpt); -CERROR ("Routes to %s via %s and %s not supported\n" , +CERROR ( +"Routes to %s via %s and %s not supported\n" ,libcfs_net2str (net),libcfs_nid2str (nid1),libcfs_nid2str (nid2));
@@ -1020,7 +1021,8 @@ lnet_router_checker_start(void)if (check_routers_before_use && dead_router_check_interval <=0 ) { -LCONSOLE_ERROR_MSG (0x10a ,"'dead_router_check_interval' must be set if 'check_routers_before_use' is set\n" ); +LCONSOLE_ERROR_MSG (0x10a , +"'dead_router_check_interval' must be set if 'check_routers_before_use' is set\n" );return -EINVAL ; }
@@ -1321,7 +1323,8 @@ lnet_rtrpool_alloc_bufs(lnet_rtrbufpool_t *rbp, int nbufs, int cpt) rb =lnet_new_rtrbuf (rbp, cpt);if (rb =NULL ) { -CERROR ("Failed to allocate %d router bufs of %d pages\n" , +CERROR ( +"Failed to allocate %d router bufs of %d pages\n" , nbufs, rbp->rbp_npages);return -ENOMEM ; }
@@ -1451,7 +1454,8 @@ lnet_rtrpools_alloc(int im_a_router) }else if (!strcmp (forwarding,"enabled" )) {/* explicitly enabled */ }else { -LCONSOLE_ERROR_MSG (0x10b ,"'forwarding' not set to either 'enabled' or 'disabled'\n" ); +LCONSOLE_ERROR_MSG (0x10b , +"'forwarding' not set to either 'enabled' or 'disabled'\n" );return -EINVAL ; }
@@ -1511,7 +1515,7 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when)unsigned long now =cfs_time_current ();int cpt =lnet_cpt_of_nid (nid); -LASSERT (!in_interrupt ()); +LASSERT (!in_interrupt ()); CDEBUG(D_NET, "%s notifying %s: %s\n", (ni = NULL) ? "userspace" : libcfs_nid2str(ni->ni_nid),
@@ -1528,7 +1532,8 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when)/* can't do predictions... */ if (cfs_time_after (when, now)) { -CWARN ("Ignoring prediction from %s of %s %s %ld seconds in the future\n" , +CWARN ( +"Ignoring prediction from %s of %s %s %ld seconds in the future\n" , (ni =NULL ) ?"userspace" :libcfs_nid2str (ni->ni_nid),libcfs_nid2str (nid), alive ?"up" :"down" ,cfs_duration_sec (cfs_time_sub (when, now)));
drivers/staging/lustre/lnet/lnet/router_proc.c +8 -5
@@ -49,7 +49,8 @@ enum {*/ #define LNET_PROC_CPT_BITS (LNET_CPT_BITS + 1)/* change version, 16 bits or 8 bits */ -#define LNET_PROC_VER_BITS max_t(size_t, min_t(size_t, LNET_LOFFT_BITS, 64) / 4, 8) +#define LNET_PROC_VER_BITS max_t(size_t, min_t(size_t, LNET_LOFFT_BITS, \ + 64) / 4, 8)#define LNET_PROC_HASH_BITS LNET_PEER_HASH_BITS/*
@@ -396,7 +397,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write, nrefs, nrtrrefs, alive_cnt, alive ?"up" :"down" , last_ping, pingsent, -cfs_duration_sec (cfs_time_sub (deadline, now)), +cfs_duration_sec ( +cfs_time_sub (deadline, + now)), down_ni, libcfs_nid2str(nid));LASSERT (tmpstr + tmpsiz - s >0 ); }
@@ -791,17 +794,20 @@ static struct lnet_portal_rotors portal_rotors[] = { { .pr_value = LNET_PTL_ROTOR_ON, .pr_name = "ON", - .pr_desc ="round-robin dispatch all PUT messages for wildcard portals" + .pr_desc +"round-robin dispatch all PUT messages for wildcard portals" }, { .pr_value = LNET_PTL_ROTOR_RR_RT, .pr_name = "RR_RT", - .pr_desc ="round-robin dispatch routed PUT message for wildcard portals" + .pr_desc +"round-robin dispatch routed PUT message for wildcard portals" }, { .pr_value = LNET_PTL_ROTOR_HASH_RT, .pr_name = "HASH_RT", - .pr_desc ="dispatch routed PUT message by hashing source NID for wildcard portals" + .pr_desc +"dispatch routed PUT message by hashing source NID for wildcard portals" }, { .pr_value = -1,
Signature · 1 line
1.7.1
PATCH v4 11/13 staging: lnet: o2iblnd: checkpatch.pl fixes
In reply to Mike ShueyClean up most checkpatch.pl warnings (primarily line length warnings).
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 25 ++- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 204 +++++++++++--------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 184 +++++++++++------- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 55 ++++-- 4 files changed, 277 insertions(+), 191 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +15 -10
@@ -1166,10 +1166,11 @@ void kiblnd_map_rx_descs(kib_conn_t *conn) rx->rx_conn = conn; rx->rx_msg = (kib_msg_t *)(((char *)page_address (pg)) + pg_off); - rx->rx_msgaddr =kiblnd_dma_map_single (conn->ibc_hdev->ibh_ibdev, - rx->rx_msg, -IBLND_MSG_SIZE , -DMA_FROM_DEVICE ); + rx->rx_msgaddr =kiblnd_dma_map_single ( + conn->ibc_hdev->ibh_ibdev, + rx->rx_msg, +IBLND_MSG_SIZE , +DMA_FROM_DEVICE );LASSERT (!kiblnd_dma_mapping_error (conn->ibc_hdev->ibh_ibdev, rx->rx_msgaddr));KIBLND_UNMAP_ADDR_SET (rx, rx_msgunmap, rx->rx_msgaddr);
@@ -1387,7 +1388,7 @@ static int kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, .max_pages_per_fmr = LNET_MAX_PAYLOAD/PAGE_SIZE, .page_shift = PAGE_SHIFT, .access = (IB_ACCESS_LOCAL_WRITE | - IB_ACCESS_REMOTE_WRITE), + IB_ACCESS_REMOTE_WRITE), .pool_size = fps->fps_pool_size, .dirty_watermark = fps->fps_flush_trigger, .flush_function = NULL,
@@ -1753,7 +1754,8 @@ struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps)if (ps->ps_increasing) {/* another thread is allocating a new pool */ spin_unlock (&ps->ps_lock); -CDEBUG (D_NET ,"Another thread is allocating new %s pool, waiting for her to complete\n" , +CDEBUG (D_NET , +"Another thread is allocating new %s pool, waiting for her to complete\n" , ps->ps_name);schedule (); goto again;
@@ -2354,7 +2356,8 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)if (hdev->ibh_mr_shift <32 || hdev->ibh_nmrs >1024 ) {/* it's 4T..., assume we will re-code at that time */ -CERROR ("Can't support memory size: x%#llx with MR size: x%#llx\n" , +CERROR ( +"Can't support memory size: x%#llx with MR size: x%#llx\n" , mm_size, mr_size);return -EINVAL ; }
@@ -2376,7 +2379,8 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) mr =ib_reg_phys_mr (hdev->ibh_pd, &ipb,1 , acflags, &iova);if (IS_ERR (mr)) { -CERROR ("Failed ib_reg_phys_mr addr %#llx size %#llx : %ld\n" , +CERROR ( +"Failed ib_reg_phys_mr addr %#llx size %#llx : %ld\n" , ipb.addr, ipb.size,PTR_ERR (mr));kiblnd_hdev_cleanup_mrs (hdev);return PTR_ERR (mr);
@@ -2389,7 +2393,8 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) out:if (hdev->ibh_mr_size != ~0ULL || hdev->ibh_nmrs !=1 ) -LCONSOLE_INFO ("Register global MR array, MR size: %#llx, array size: %d\n" , +LCONSOLE_INFO ( +"Register global MR array, MR size: %#llx, array size: %d\n" , hdev->ibh_mr_size, hdev->ibh_nmrs);return 0 ; }
@@ -2758,7 +2763,7 @@ void kiblnd_shutdown(lnet_ni_t *ni) i =2 ;while (atomic_read (&net->ibn_npeers) !=0 ) { i++; -CDEBUG (((i & (-i)) = i) ?D_WARNING :D_NET ,/* 2**n? */ +CDEBUG (((i & (-i)) = i) ?D_WARNING :D_NET ,/* 2**n? */ "%s: waiting for %d peers to disconnect\n" ,libcfs_nid2str (ni->ni_nid),atomic_read (&net->ibn_npeers));
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +110 -94
378 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +113 -67
448 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +27 -19
65 lines not on this page · raw message
Signature · 1 line
1.7.1
Re: [PATCH v4 11/13] staging: lnet: o2iblnd: checkpatch.pl fixes
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c void kiblnd_shutdown(lnet_ni_t *ni) · line 2766
Quoted 6 lines · Mike Shuey
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1
-1@@ -2758,7 +2763,7 @@ void kiblnd_shutdown(lnet_ni_t *ni) i =2 ;while (atomic_read (&net->ibn_npeers) !=0 ) { i++; - CDEBUG(((i & (-i)) = i) ? D_WARNING : D_NET, /* 2**n? */ + CDEBUG(((i & (-i)) = i) ? D_WARNING : D_NET,/* 2**n? */
The original was better. I don't like this patch for the same reasons that people complained about patch 10. It does too many things as well.
regards,
dan carpenter
PATCH v4 11/13 staging: lnet: o2iblnd: checkpatch.pl fixes
In reply to Mike ShueyClean up most checkpatch.pl warnings (primarily line length warnings).
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 25 ++- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 204 +++++++++++--------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 184 +++++++++++------- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 55 ++++-- 4 files changed, 277 insertions(+), 191 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +15 -10
@@ -1166,10 +1166,11 @@ void kiblnd_map_rx_descs(kib_conn_t *conn) rx->rx_conn = conn; rx->rx_msg = (kib_msg_t *)(((char *)page_address (pg)) + pg_off); - rx->rx_msgaddr =kiblnd_dma_map_single (conn->ibc_hdev->ibh_ibdev, - rx->rx_msg, -IBLND_MSG_SIZE , -DMA_FROM_DEVICE ); + rx->rx_msgaddr =kiblnd_dma_map_single ( + conn->ibc_hdev->ibh_ibdev, + rx->rx_msg, +IBLND_MSG_SIZE , +DMA_FROM_DEVICE );LASSERT (!kiblnd_dma_mapping_error (conn->ibc_hdev->ibh_ibdev, rx->rx_msgaddr));KIBLND_UNMAP_ADDR_SET (rx, rx_msgunmap, rx->rx_msgaddr);
@@ -1387,7 +1388,7 @@ static int kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, .max_pages_per_fmr = LNET_MAX_PAYLOAD/PAGE_SIZE, .page_shift = PAGE_SHIFT, .access = (IB_ACCESS_LOCAL_WRITE | - IB_ACCESS_REMOTE_WRITE), + IB_ACCESS_REMOTE_WRITE), .pool_size = fps->fps_pool_size, .dirty_watermark = fps->fps_flush_trigger, .flush_function = NULL,
@@ -1753,7 +1754,8 @@ struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps)if (ps->ps_increasing) {/* another thread is allocating a new pool */ spin_unlock (&ps->ps_lock); -CDEBUG (D_NET ,"Another thread is allocating new %s pool, waiting for her to complete\n" , +CDEBUG (D_NET , +"Another thread is allocating new %s pool, waiting for her to complete\n" , ps->ps_name);schedule (); goto again;
@@ -2354,7 +2356,8 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)if (hdev->ibh_mr_shift <32 || hdev->ibh_nmrs >1024 ) {/* it's 4T..., assume we will re-code at that time */ -CERROR ("Can't support memory size: x%#llx with MR size: x%#llx\n" , +CERROR ( +"Can't support memory size: x%#llx with MR size: x%#llx\n" , mm_size, mr_size);return -EINVAL ; }
@@ -2376,7 +2379,8 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) mr =ib_reg_phys_mr (hdev->ibh_pd, &ipb,1 , acflags, &iova);if (IS_ERR (mr)) { -CERROR ("Failed ib_reg_phys_mr addr %#llx size %#llx : %ld\n" , +CERROR ( +"Failed ib_reg_phys_mr addr %#llx size %#llx : %ld\n" , ipb.addr, ipb.size,PTR_ERR (mr));kiblnd_hdev_cleanup_mrs (hdev);return PTR_ERR (mr);
@@ -2389,7 +2393,8 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) out:if (hdev->ibh_mr_size != ~0ULL || hdev->ibh_nmrs !=1 ) -LCONSOLE_INFO ("Register global MR array, MR size: %#llx, array size: %d\n" , +LCONSOLE_INFO ( +"Register global MR array, MR size: %#llx, array size: %d\n" , hdev->ibh_mr_size, hdev->ibh_nmrs);return 0 ; }
@@ -2758,7 +2763,7 @@ void kiblnd_shutdown(lnet_ni_t *ni) i =2 ;while (atomic_read (&net->ibn_npeers) !=0 ) { i++; -CDEBUG (((i & (-i)) = i) ?D_WARNING :D_NET ,/* 2**n? */ +CDEBUG (((i & (-i)) = i) ?D_WARNING :D_NET ,/* 2**n? */ "%s: waiting for %d peers to disconnect\n" ,libcfs_nid2str (ni->ni_nid),atomic_read (&net->ibn_npeers));
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +110 -94
378 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +113 -67
448 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +27 -19
65 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 12/13 staging: lustre: lnet: socklnd: checkpatch.pl cleanups
In reply to Mike ShueyMore checkpatch.pl warnings & code cleanup.
--- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 94 +++-- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 20 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 419 +++++++++++--------- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 24 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.h | 2 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 48 ++- 6 files changed, 351 insertions(+), 256 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +59 -33
@@ -337,7 +337,8 @@ ksocknal_associate_route_conn_locked(ksock_route_t *route, ksock_conn_t *conn) &route->ksnr_ipaddr, &conn->ksnc_myipaddr); }else { - CDEBUG(D_NET, "Rebinding %s %pI4h from %pI4h to %pI4h\n", + CDEBUG(D_NET, + "Rebinding %s %pI4h from %pI4h to %pI4h\n", libcfs_id2str(peer->ksnp_id), &route->ksnr_ipaddr, &route->ksnr_myipaddr,
@@ -576,7 +577,8 @@ ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip)write_lock_bh (&ksocknal_data.ksnd_global_lock);if (id.nid !=LNET_NID_ANY ) - lo = hi = (int )(ksocknal_nid2peerlist (id.nid) - ksocknal_data.ksnd_peers); + lo = hi = (int )(ksocknal_nid2peerlist (id.nid) - + ksocknal_data.ksnd_peers);else { lo =0 ; hi = ksocknal_data.ksnd_peer_hash_size -1 ;
@@ -590,8 +592,10 @@ ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip)if (peer->ksnp_ni != ni)continue ; -if (!((id.nid =LNET_NID_ANY || peer->ksnp_id.nid = id.nid) && - (id.pid =LNET_PID_ANY || peer->ksnp_id.pid = id.pid))) +if (!((id.nid =LNET_NID_ANY || + peer->ksnp_id.nid = id.nid) && + (id.pid =LNET_PID_ANY || + peer->ksnp_id.pid = id.pid)))continue ;ksocknal_peer_addref (peer);/* a ref for me... */
@@ -805,12 +809,15 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips)if (peer->ksnp_passive_ips[k] = ip)break ; -if (k < peer->ksnp_n_passive_ips)/* using it already */ +/* using it already */ +if (k < peer->ksnp_n_passive_ips)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) =0 ) ?1 :0 ; + this_netmatch = ((xor & iface->ksni_netmask) = +0 ) ?1 :0 ; if (!(best_iface = NULL || best_netmatch < this_netmatch ||
@@ -973,7 +980,8 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)LIBCFS_ALLOC (cr,sizeof (*cr));if (cr =NULL ) { -LCONSOLE_ERROR_MSG (0x12f ,"Dropping connection request from %pI4h: memory exhausted\n" , +LCONSOLE_ERROR_MSG (0x12f , +"Dropping connection request from %pI4h: memory exhausted\n" , &peer_ip);return -ENOMEM ; }
@@ -1257,7 +1265,8 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, conn->ksnc_tx_last_post =cfs_time_current ();/* Set the deadline for the outgoing HELLO to drain */ conn->ksnc_tx_bufnob = sock->sk->sk_wmem_queued; - conn->ksnc_tx_deadline =cfs_time_shift (*ksocknal_tunables.ksnd_timeout); + conn->ksnc_tx_deadline +cfs_time_shift (*ksocknal_tunables.ksnd_timeout);mb ();/* order with adding to peer's conn list */ list_add (&conn->ksnc_list, &peer->ksnp_conns);
@@ -1269,7 +1278,8 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,/* 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 ) +if (conn->ksnc_proto->pro_match_tx (conn, tx, tx->tx_nonblk) = +SOCKNAL_MATCH_NO )continue ;list_del (&tx->tx_list);
@@ -1286,7 +1296,8 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,* socket callbacks. */ - CDEBUG(D_NET, "New conn %s p %d.x %pI4h -> %pI4h/%d incarnation:%lld sched[%d:%d]\n", + CDEBUG(D_NET, + "New conn %s p %d.x %pI4h -> %pI4h/%d incarnation:%lld sched[%d:%d]\n", libcfs_id2str(peerid), conn->ksnc_proto->pro_version, &conn->ksnc_myipaddr, &conn->ksnc_ipaddr, conn->ksnc_port, incarnation, cpt,
@@ -1457,8 +1468,8 @@ ksocknal_close_conn_locked(ksock_conn_t *conn, int error)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)) {/* I've just closed last conn belonging to a
@@ -1635,7 +1646,8 @@ ksocknal_destroy_conn(ksock_conn_t *conn)case SOCKNAL_RX_LNET_PAYLOAD : last_rcv = conn->ksnc_rx_deadline -cfs_time_seconds (*ksocknal_tunables.ksnd_timeout); - CERROR("Completing partial receive from %s[%d], ip %pI4h:%d, with error, wanted: %d, left: %d, last alive is %ld secs ago\n", + CERROR( + "Completing partial receive from %s[%d], ip %pI4h:%d, with error, wanted: %d, left: %d, last alive is %ld secs ago\n", libcfs_id2str(conn->ksnc_peer->ksnp_id), conn->ksnc_type, &conn->ksnc_ipaddr, conn->ksnc_port, conn->ksnc_rx_nob_wanted, conn->ksnc_rx_nob_left,
@@ -1646,21 +1658,24 @@ ksocknal_destroy_conn(ksock_conn_t *conn)break ;case SOCKNAL_RX_LNET_HEADER :if (conn->ksnc_rx_started) -CERROR ("Incomplete receive of lnet header from %s, ip %pI4h:%d, with error, protocol: %d.x.\n" , +CERROR ( +"Incomplete receive of lnet header from %s, ip %pI4h:%d, with error, protocol: %d.x.\n" ,libcfs_id2str (conn->ksnc_peer->ksnp_id), &conn->ksnc_ipaddr, conn->ksnc_port, conn->ksnc_proto->pro_version);break ;case SOCKNAL_RX_KSM_HEADER :if (conn->ksnc_rx_started) -CERROR ("Incomplete receive of ksock message from %s, ip %pI4h:%d, with error, protocol: %d.x.\n" , +CERROR ( +"Incomplete receive of ksock message from %s, ip %pI4h:%d, with error, protocol: %d.x.\n" ,libcfs_id2str (conn->ksnc_peer->ksnp_id), &conn->ksnc_ipaddr, conn->ksnc_port, conn->ksnc_proto->pro_version);break ;case SOCKNAL_RX_SLOP :if (conn->ksnc_rx_started) -CERROR ("Incomplete receive of slops from %s, ip %pI4h:%d, with error\n" , +CERROR ( +"Incomplete receive of slops from %s, ip %pI4h:%d, with error\n" ,libcfs_id2str (conn->ksnc_peer->ksnp_id), &conn->ksnc_ipaddr, conn->ksnc_port);break ;
@@ -1725,7 +1740,8 @@ ksocknal_close_matching_conns(lnet_process_id_t id, __u32 ipaddr)write_lock_bh (&ksocknal_data.ksnd_global_lock);if (id.nid !=LNET_NID_ANY ) - lo = hi = (int )(ksocknal_nid2peerlist (id.nid) - ksocknal_data.ksnd_peers); + lo = hi = (int )(ksocknal_nid2peerlist (id.nid) - + ksocknal_data.ksnd_peers);else { lo =0 ; hi = ksocknal_data.ksnd_peer_hash_size -1 ;
@@ -1737,11 +1753,14 @@ ksocknal_close_matching_conns(lnet_process_id_t id, __u32 ipaddr) peer =list_entry (ptmp, ksock_peer_t, ksnp_list); -if (!((id.nid =LNET_NID_ANY || id.nid = peer->ksnp_id.nid) && - (id.pid =LNET_PID_ANY || id.pid = peer->ksnp_id.pid))) +if (!((id.nid =LNET_NID_ANY || + id.nid = peer->ksnp_id.nid) && + (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 ); } }
@@ -1805,7 +1824,8 @@ ksocknal_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)if (bufnob < conn->ksnc_tx_bufnob) {/* something got ACKed */ conn->ksnc_tx_deadline -cfs_time_shift (*ksocknal_tunables.ksnd_timeout); +cfs_time_shift ( + *ksocknal_tunables.ksnd_timeout); peer->ksnp_last_alive = now; conn->ksnc_tx_bufnob = bufnob; }
@@ -1838,7 +1858,6 @@ ksocknal_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)ksocknal_launch_all_connections_locked (peer);write_unlock_bh (glock); -return ; } static void
@@ -1962,7 +1981,8 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, __u32 netmask) ksnp_list);for (j =0 ; j < peer->ksnp_n_passive_ips; j++) -if (peer->ksnp_passive_ips[j] = ipaddress) +if (peer->ksnp_passive_ips[j] = + ipaddress) iface->ksni_npeers++;list_for_each (rtmp, &peer->ksnp_routes) {
@@ -1977,7 +1997,8 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, __u32 netmask) } 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);
@@ -2064,7 +2085,8 @@ ksocknal_del_interface(lnet_ni_t *ni, __u32 ipaddress)if (peer->ksnp_ni != ni)continue ; -ksocknal_peer_del_interface_locked (peer, this_ip); +ksocknal_peer_del_interface_locked (peer, + this_ip); } } }
@@ -2111,7 +2133,7 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)case IOC_LIBCFS_DEL_INTERFACE :return ksocknal_del_interface (ni, - data->ioc_u32[0 ]);/* IP address */ + data->ioc_u32[0 ]);/* IP address */ case IOC_LIBCFS_GET_PEER : {__u32 myip =0 ;
@@ -2153,7 +2175,8 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)int txmem;int rxmem;int nagle; -ksock_conn_t *conn =ksocknal_get_conn_by_idx (ni, data->ioc_count); +ksock_conn_t *conn =ksocknal_get_conn_by_idx (ni, + data->ioc_count);if (conn =NULL )return -ENOENT ;
@@ -2263,9 +2286,8 @@ ksocknal_base_shutdown(void)case SOCKNAL_INIT_ALL :case SOCKNAL_INIT_DATA :LASSERT (ksocknal_data.ksnd_peers !=NULL ); -for (i =0 ; i < ksocknal_data.ksnd_peer_hash_size; i++) { +for (i =0 ; i < ksocknal_data.ksnd_peer_hash_size; i++)LASSERT (list_empty (&ksocknal_data.ksnd_peers[i])); - }LASSERT (list_empty (&ksocknal_data.ksnd_nets));LASSERT (list_empty (&ksocknal_data.ksnd_enomem_conns));
@@ -2315,7 +2337,8 @@ ksocknal_base_shutdown(void)read_lock (&ksocknal_data.ksnd_global_lock);while (ksocknal_data.ksnd_nthreads !=0 ) { i++; -CDEBUG (((i & (-i)) = i) ?D_WARNING :D_NET ,/* power of 2? */ +/* power of 2? */ +CDEBUG (((i & (-i)) = i) ?D_WARNING :D_NET ,"waiting for %d threads to terminate\n" , ksocknal_data.ksnd_nthreads);read_unlock (&ksocknal_data.ksnd_global_lock);
@@ -2446,6 +2469,7 @@ ksocknal_base_startup(void)for (i =0 ; i < *ksocknal_tunables.ksnd_nconnds; i++) {char name[16 ]; +spin_lock_bh (&ksocknal_data.ksnd_connd_lock); ksocknal_data.ksnd_connd_starting++;spin_unlock_bh (&ksocknal_data.ksnd_connd_lock);
@@ -2503,7 +2527,8 @@ ksocknal_debug_peerhash(lnet_ni_t *ni)ksock_route_t *route;ksock_conn_t *conn; - CWARN("Active peer on shutdown: %s, ref %d, scnt %d, closing %d, accepting %d, err %d, zcookie %llu, txq %d, zc_req %d\n", + CWARN( + "Active peer on shutdown: %s, ref %d, scnt %d, closing %d, accepting %d, err %d, zcookie %llu, txq %d, zc_req %d\n", libcfs_id2str(peer->ksnp_id), atomic_read(&peer->ksnp_refcount), peer->ksnp_sharecount, peer->ksnp_closing,
@@ -2514,7 +2539,8 @@ ksocknal_debug_peerhash(lnet_ni_t *ni)list_for_each (tmp, &peer->ksnp_routes) { route =list_entry (tmp, ksock_route_t, ksnr_list); -CWARN ("Route: ref %d, schd %d, conn %d, cnted %d, del %d\n" , +CWARN ( +"Route: ref %d, schd %d, conn %d, cnted %d, del %d\n" ,atomic_read (&route->ksnr_refcount), route->ksnr_scheduled, route->ksnr_connecting, route->ksnr_connected, route->ksnr_deleted);
@@ -2530,7 +2556,6 @@ ksocknal_debug_peerhash(lnet_ni_t *ni) }read_unlock (&ksocknal_data.ksnd_global_lock); -return ; }void
@@ -2711,6 +2736,7 @@ ksocknal_start_schedulers(struct ksock_sched_info *info)long id;char name[20 ];ksock_sched_t *sched; + id =KSOCK_THREAD_ID (info->ksi_cpt, info->ksi_nthreads + i); sched = &info->ksi_scheds[KSOCK_THREAD_SID (id)]; snprintf(name, sizeof(name), "socknal_sd%02d_%02d",
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +13 -7
@@ -139,7 +139,7 @@ typedef struct { typedef struct { __u64 ksnn_incarnation; /* my epoch */ spinlock_t ksnn_lock; /* serialise */ - struct list_head ksnn_list; /* chain on global list */ + struct list_head ksnn_list; /* chain on global list */ int ksnn_npeers; /* # peers */ int ksnn_shutdown; /* shutting down? */ int ksnn_ninterfaces; /* IP interfaces */
@@ -474,7 +474,8 @@ ksocknal_route_mask(void)static inline struct list_head *ksocknal_nid2peerlist (lnet_nid_t nid) { -unsigned int hash = ((unsigned int )nid) % ksocknal_data.ksnd_peer_hash_size; +unsigned int hash = ((unsigned int )nid) % + ksocknal_data.ksnd_peer_hash_size;return &ksocknal_data.ksnd_peers[hash]; }
@@ -587,8 +588,10 @@ int ksocknal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, unsigned int offset, unsigned int mlen, unsigned int rlen);int ksocknal_accept (lnet_ni_t *ni,struct socket *sock); -extern int ksocknal_add_peer (lnet_ni_t *ni,lnet_process_id_t id,__u32 ip,int port); -extern ksock_peer_t *ksocknal_find_peer_locked (lnet_ni_t *ni,lnet_process_id_t id); +extern int ksocknal_add_peer (lnet_ni_t *ni,lnet_process_id_t id,__u32 ip, +int port); +extern ksock_peer_t *ksocknal_find_peer_locked (lnet_ni_t *ni, +lnet_process_id_t id);extern ksock_peer_t *ksocknal_find_peer (lnet_ni_t *ni,lnet_process_id_t id);extern void ksocknal_peer_failed (ksock_peer_t *peer); extern int ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
@@ -613,11 +616,13 @@ extern void ksocknal_queue_tx_locked(ksock_tx_t *tx, ksock_conn_t *conn);extern void ksocknal_txlist_done (lnet_ni_t *ni,struct list_head *txlist,int error);extern void ksocknal_notify (lnet_ni_t *ni,lnet_nid_t gw_nid,int alive); -extern void ksocknal_query (struct lnet_ni *ni,lnet_nid_t nid,unsigned long *when); +extern void ksocknal_query (struct lnet_ni *ni,lnet_nid_t nid, +unsigned long *when);extern int ksocknal_thread_start (int (*fn)(void *arg),void *arg,char *name);extern void ksocknal_thread_fini (void );extern void ksocknal_launch_all_connections_locked (ksock_peer_t *peer); -extern ksock_route_t *ksocknal_find_connectable_route_locked (ksock_peer_t *peer); +extern ksock_route_t *ksocknal_find_connectable_route_locked (ksock_peer_t + *peer);extern ksock_route_t *ksocknal_find_connecting_route_locked (ksock_peer_t *peer);extern int ksocknal_new_packet (ksock_conn_t *conn,int skip);extern int ksocknal_scheduler (void *arg);
@@ -634,7 +639,8 @@ extern void ksocknal_write_callback(ksock_conn_t *conn);extern int ksocknal_lib_zc_capable (ksock_conn_t *conn);extern void ksocknal_lib_save_callback (struct socket *sock,ksock_conn_t *conn);extern void ksocknal_lib_set_callback (struct socket *sock,ksock_conn_t *conn); -extern void ksocknal_lib_reset_callback (struct socket *sock,ksock_conn_t *conn); +extern void ksocknal_lib_reset_callback (struct socket *sock, +ksock_conn_t *conn);extern void ksocknal_lib_push_conn (ksock_conn_t *conn);extern int ksocknal_lib_get_conn_addrs (ksock_conn_t *conn);extern int ksocknal_lib_setup_sock (struct socket *so);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +229 -184
1,190 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +12 -11
@@ -176,7 +176,8 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) nob < tx->tx_resid) msg.msg_flags |=MSG_MORE ; - rc =kernel_sendmsg (sock, &msg, (struct kvec *)scratchiov, niov, nob); + rc =kernel_sendmsg (sock, &msg, (struct kvec *)scratchiov, + niov, nob);for (i =0 ; i < niov; i++)kunmap (kiov[i].kiov_page);
@@ -250,7 +251,8 @@ ksocknal_lib_recv_iov(ksock_conn_t *conn) 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; }
@@ -286,7 +288,8 @@ ksocknal_lib_kiov_vmap(lnet_kiov_t *kiov, int niov,for (nob = i =0 ; i < niov; i++) {if ((kiov[i].kiov_offset !=0 && i >0 ) || - (kiov[i].kiov_offset + kiov[i].kiov_len !=PAGE_CACHE_SIZE && i < niov -1 )) + (kiov[i].kiov_offset + kiov[i].kiov_len !+ PAGE_CACHE_SIZE && i < niov - 1))return NULL ; pages[i] = kiov[i].kiov_page;
@@ -358,9 +361,9 @@ ksocknal_lib_recv_kiov(ksock_conn_t *conn)LASSERT (i < niov);/* Dang! have to kmap again because I have nowhere to -* stash the mapped address. But by doing it while the -* page is still mapped, the kernel just bumps the map -* count and returns me the address it stashed. */ +* stash the mapped address. But by doing it while the +* page is still mapped, the kernel just bumps the map +* count and returns me the address it stashed. */ base =kmap (kiov[i].kiov_page) + kiov[i].kiov_offset; fragnob = kiov[i].kiov_len;if (fragnob > sum)
@@ -404,7 +407,8 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx) base =kmap (tx->tx_kiov[i].kiov_page) + tx->tx_kiov[i].kiov_offset; - csum =ksocknal_csum (csum, base, tx->tx_kiov[i].kiov_len); + csum =ksocknal_csum (csum, base, + tx->tx_kiov[i].kiov_len);kunmap (tx->tx_kiov[i].kiov_page); }
@@ -423,7 +427,8 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx) }int -ksocknal_lib_get_conn_tunables (ksock_conn_t *conn,int *txmem,int *rxmem,int *nagle) +ksocknal_lib_get_conn_tunables (ksock_conn_t *conn,int *txmem,int *rxmem, +int *nagle) {struct socket *sock = conn->ksnc_sock;int len;
@@ -666,7 +671,6 @@ ksocknal_lib_set_callback(struct socket *sock, ksock_conn_t *conn) sock->sk->sk_user_data = conn; sock->sk->sk_data_ready = ksocknal_data_ready; sock->sk->sk_write_space = ksocknal_write_space; -return ; }void
@@ -682,8 +686,6 @@ ksocknal_lib_reset_callback(struct socket *sock, ksock_conn_t *conn)* on ksnd_global_lock (to serialise with me) and NOOP if * sk_user_data is NULL. */ sock->sk->sk_user_data =NULL ; - -return ; }int
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h +1 -1
@@ -71,7 +71,7 @@ static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)return crc32_le (crc, p, len);#else while (len-- >0 ) - crc = ((crc +0x100 ) & ~0xff ) | ((crc + *p++) &0xff ) ; + crc = ((crc +0x100 ) & ~0xff ) | ((crc + *p++) &0xff );return crc;#endif }
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +30 -17
118 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 12/13 staging: lustre: lnet: socklnd: checkpatch.pl cleanups
In reply to Mike ShueyMore checkpatch.pl warnings & code cleanup.
--- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 94 +++-- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 20 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 419 +++++++++++--------- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 24 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.h | 2 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 48 ++- 6 files changed, 351 insertions(+), 256 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +59 -33
@@ -337,7 +337,8 @@ ksocknal_associate_route_conn_locked(ksock_route_t *route, ksock_conn_t *conn) &route->ksnr_ipaddr, &conn->ksnc_myipaddr); }else { - CDEBUG(D_NET, "Rebinding %s %pI4h from %pI4h to %pI4h\n", + CDEBUG(D_NET, + "Rebinding %s %pI4h from %pI4h to %pI4h\n", libcfs_id2str(peer->ksnp_id), &route->ksnr_ipaddr, &route->ksnr_myipaddr,
@@ -576,7 +577,8 @@ ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip)write_lock_bh (&ksocknal_data.ksnd_global_lock);if (id.nid !=LNET_NID_ANY ) - lo = hi = (int )(ksocknal_nid2peerlist (id.nid) - ksocknal_data.ksnd_peers); + lo = hi = (int )(ksocknal_nid2peerlist (id.nid) - + ksocknal_data.ksnd_peers);else { lo =0 ; hi = ksocknal_data.ksnd_peer_hash_size -1 ;
@@ -590,8 +592,10 @@ ksocknal_del_peer(lnet_ni_t *ni, lnet_process_id_t id, __u32 ip)if (peer->ksnp_ni != ni)continue ; -if (!((id.nid =LNET_NID_ANY || peer->ksnp_id.nid = id.nid) && - (id.pid =LNET_PID_ANY || peer->ksnp_id.pid = id.pid))) +if (!((id.nid =LNET_NID_ANY || + peer->ksnp_id.nid = id.nid) && + (id.pid =LNET_PID_ANY || + peer->ksnp_id.pid = id.pid)))continue ;ksocknal_peer_addref (peer);/* a ref for me... */
@@ -805,12 +809,15 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips)if (peer->ksnp_passive_ips[k] = ip)break ; -if (k < peer->ksnp_n_passive_ips)/* using it already */ +/* using it already */ +if (k < peer->ksnp_n_passive_ips)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) =0 ) ?1 :0 ; + this_netmatch = ((xor & iface->ksni_netmask) = +0 ) ?1 :0 ; if (!(best_iface = NULL || best_netmatch < this_netmatch ||
@@ -973,7 +980,8 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)LIBCFS_ALLOC (cr,sizeof (*cr));if (cr =NULL ) { -LCONSOLE_ERROR_MSG (0x12f ,"Dropping connection request from %pI4h: memory exhausted\n" , +LCONSOLE_ERROR_MSG (0x12f , +"Dropping connection request from %pI4h: memory exhausted\n" , &peer_ip);return -ENOMEM ; }
@@ -1257,7 +1265,8 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, conn->ksnc_tx_last_post =cfs_time_current ();/* Set the deadline for the outgoing HELLO to drain */ conn->ksnc_tx_bufnob = sock->sk->sk_wmem_queued; - conn->ksnc_tx_deadline =cfs_time_shift (*ksocknal_tunables.ksnd_timeout); + conn->ksnc_tx_deadline +cfs_time_shift (*ksocknal_tunables.ksnd_timeout);mb ();/* order with adding to peer's conn list */ list_add (&conn->ksnc_list, &peer->ksnp_conns);
@@ -1269,7 +1278,8 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,/* 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 ) +if (conn->ksnc_proto->pro_match_tx (conn, tx, tx->tx_nonblk) = +SOCKNAL_MATCH_NO )continue ;list_del (&tx->tx_list);
@@ -1286,7 +1296,8 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,* socket callbacks. */ - CDEBUG(D_NET, "New conn %s p %d.x %pI4h -> %pI4h/%d incarnation:%lld sched[%d:%d]\n", + CDEBUG(D_NET, + "New conn %s p %d.x %pI4h -> %pI4h/%d incarnation:%lld sched[%d:%d]\n", libcfs_id2str(peerid), conn->ksnc_proto->pro_version, &conn->ksnc_myipaddr, &conn->ksnc_ipaddr, conn->ksnc_port, incarnation, cpt,
@@ -1457,8 +1468,8 @@ ksocknal_close_conn_locked(ksock_conn_t *conn, int error)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)) {/* I've just closed last conn belonging to a
@@ -1635,7 +1646,8 @@ ksocknal_destroy_conn(ksock_conn_t *conn)case SOCKNAL_RX_LNET_PAYLOAD : last_rcv = conn->ksnc_rx_deadline -cfs_time_seconds (*ksocknal_tunables.ksnd_timeout); - CERROR("Completing partial receive from %s[%d], ip %pI4h:%d, with error, wanted: %d, left: %d, last alive is %ld secs ago\n", + CERROR( + "Completing partial receive from %s[%d], ip %pI4h:%d, with error, wanted: %d, left: %d, last alive is %ld secs ago\n", libcfs_id2str(conn->ksnc_peer->ksnp_id), conn->ksnc_type, &conn->ksnc_ipaddr, conn->ksnc_port, conn->ksnc_rx_nob_wanted, conn->ksnc_rx_nob_left,
@@ -1646,21 +1658,24 @@ ksocknal_destroy_conn(ksock_conn_t *conn)break ;case SOCKNAL_RX_LNET_HEADER :if (conn->ksnc_rx_started) -CERROR ("Incomplete receive of lnet header from %s, ip %pI4h:%d, with error, protocol: %d.x.\n" , +CERROR ( +"Incomplete receive of lnet header from %s, ip %pI4h:%d, with error, protocol: %d.x.\n" ,libcfs_id2str (conn->ksnc_peer->ksnp_id), &conn->ksnc_ipaddr, conn->ksnc_port, conn->ksnc_proto->pro_version);break ;case SOCKNAL_RX_KSM_HEADER :if (conn->ksnc_rx_started) -CERROR ("Incomplete receive of ksock message from %s, ip %pI4h:%d, with error, protocol: %d.x.\n" , +CERROR ( +"Incomplete receive of ksock message from %s, ip %pI4h:%d, with error, protocol: %d.x.\n" ,libcfs_id2str (conn->ksnc_peer->ksnp_id), &conn->ksnc_ipaddr, conn->ksnc_port, conn->ksnc_proto->pro_version);break ;case SOCKNAL_RX_SLOP :if (conn->ksnc_rx_started) -CERROR ("Incomplete receive of slops from %s, ip %pI4h:%d, with error\n" , +CERROR ( +"Incomplete receive of slops from %s, ip %pI4h:%d, with error\n" ,libcfs_id2str (conn->ksnc_peer->ksnp_id), &conn->ksnc_ipaddr, conn->ksnc_port);break ;
@@ -1725,7 +1740,8 @@ ksocknal_close_matching_conns(lnet_process_id_t id, __u32 ipaddr)write_lock_bh (&ksocknal_data.ksnd_global_lock);if (id.nid !=LNET_NID_ANY ) - lo = hi = (int )(ksocknal_nid2peerlist (id.nid) - ksocknal_data.ksnd_peers); + lo = hi = (int )(ksocknal_nid2peerlist (id.nid) - + ksocknal_data.ksnd_peers);else { lo =0 ; hi = ksocknal_data.ksnd_peer_hash_size -1 ;
@@ -1737,11 +1753,14 @@ ksocknal_close_matching_conns(lnet_process_id_t id, __u32 ipaddr) peer =list_entry (ptmp, ksock_peer_t, ksnp_list); -if (!((id.nid =LNET_NID_ANY || id.nid = peer->ksnp_id.nid) && - (id.pid =LNET_PID_ANY || id.pid = peer->ksnp_id.pid))) +if (!((id.nid =LNET_NID_ANY || + id.nid = peer->ksnp_id.nid) && + (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 ); } }
@@ -1805,7 +1824,8 @@ ksocknal_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)if (bufnob < conn->ksnc_tx_bufnob) {/* something got ACKed */ conn->ksnc_tx_deadline -cfs_time_shift (*ksocknal_tunables.ksnd_timeout); +cfs_time_shift ( + *ksocknal_tunables.ksnd_timeout); peer->ksnp_last_alive = now; conn->ksnc_tx_bufnob = bufnob; }
@@ -1838,7 +1858,6 @@ ksocknal_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)ksocknal_launch_all_connections_locked (peer);write_unlock_bh (glock); -return ; } static void
@@ -1962,7 +1981,8 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, __u32 netmask) ksnp_list);for (j =0 ; j < peer->ksnp_n_passive_ips; j++) -if (peer->ksnp_passive_ips[j] = ipaddress) +if (peer->ksnp_passive_ips[j] = + ipaddress) iface->ksni_npeers++;list_for_each (rtmp, &peer->ksnp_routes) {
@@ -1977,7 +1997,8 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, __u32 netmask) } 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);
@@ -2064,7 +2085,8 @@ ksocknal_del_interface(lnet_ni_t *ni, __u32 ipaddress)if (peer->ksnp_ni != ni)continue ; -ksocknal_peer_del_interface_locked (peer, this_ip); +ksocknal_peer_del_interface_locked (peer, + this_ip); } } }
@@ -2111,7 +2133,7 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)case IOC_LIBCFS_DEL_INTERFACE :return ksocknal_del_interface (ni, - data->ioc_u32[0 ]);/* IP address */ + data->ioc_u32[0 ]);/* IP address */ case IOC_LIBCFS_GET_PEER : {__u32 myip =0 ;
@@ -2153,7 +2175,8 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)int txmem;int rxmem;int nagle; -ksock_conn_t *conn =ksocknal_get_conn_by_idx (ni, data->ioc_count); +ksock_conn_t *conn =ksocknal_get_conn_by_idx (ni, + data->ioc_count);if (conn =NULL )return -ENOENT ;
@@ -2263,9 +2286,8 @@ ksocknal_base_shutdown(void)case SOCKNAL_INIT_ALL :case SOCKNAL_INIT_DATA :LASSERT (ksocknal_data.ksnd_peers !=NULL ); -for (i =0 ; i < ksocknal_data.ksnd_peer_hash_size; i++) { +for (i =0 ; i < ksocknal_data.ksnd_peer_hash_size; i++)LASSERT (list_empty (&ksocknal_data.ksnd_peers[i])); - }LASSERT (list_empty (&ksocknal_data.ksnd_nets));LASSERT (list_empty (&ksocknal_data.ksnd_enomem_conns));
@@ -2315,7 +2337,8 @@ ksocknal_base_shutdown(void)read_lock (&ksocknal_data.ksnd_global_lock);while (ksocknal_data.ksnd_nthreads !=0 ) { i++; -CDEBUG (((i & (-i)) = i) ?D_WARNING :D_NET ,/* power of 2? */ +/* power of 2? */ +CDEBUG (((i & (-i)) = i) ?D_WARNING :D_NET ,"waiting for %d threads to terminate\n" , ksocknal_data.ksnd_nthreads);read_unlock (&ksocknal_data.ksnd_global_lock);
@@ -2446,6 +2469,7 @@ ksocknal_base_startup(void)for (i =0 ; i < *ksocknal_tunables.ksnd_nconnds; i++) {char name[16 ]; +spin_lock_bh (&ksocknal_data.ksnd_connd_lock); ksocknal_data.ksnd_connd_starting++;spin_unlock_bh (&ksocknal_data.ksnd_connd_lock);
@@ -2503,7 +2527,8 @@ ksocknal_debug_peerhash(lnet_ni_t *ni)ksock_route_t *route;ksock_conn_t *conn; - CWARN("Active peer on shutdown: %s, ref %d, scnt %d, closing %d, accepting %d, err %d, zcookie %llu, txq %d, zc_req %d\n", + CWARN( + "Active peer on shutdown: %s, ref %d, scnt %d, closing %d, accepting %d, err %d, zcookie %llu, txq %d, zc_req %d\n", libcfs_id2str(peer->ksnp_id), atomic_read(&peer->ksnp_refcount), peer->ksnp_sharecount, peer->ksnp_closing,
@@ -2514,7 +2539,8 @@ ksocknal_debug_peerhash(lnet_ni_t *ni)list_for_each (tmp, &peer->ksnp_routes) { route =list_entry (tmp, ksock_route_t, ksnr_list); -CWARN ("Route: ref %d, schd %d, conn %d, cnted %d, del %d\n" , +CWARN ( +"Route: ref %d, schd %d, conn %d, cnted %d, del %d\n" ,atomic_read (&route->ksnr_refcount), route->ksnr_scheduled, route->ksnr_connecting, route->ksnr_connected, route->ksnr_deleted);
@@ -2530,7 +2556,6 @@ ksocknal_debug_peerhash(lnet_ni_t *ni) }read_unlock (&ksocknal_data.ksnd_global_lock); -return ; }void
@@ -2711,6 +2736,7 @@ ksocknal_start_schedulers(struct ksock_sched_info *info)long id;char name[20 ];ksock_sched_t *sched; + id =KSOCK_THREAD_ID (info->ksi_cpt, info->ksi_nthreads + i); sched = &info->ksi_scheds[KSOCK_THREAD_SID (id)]; snprintf(name, sizeof(name), "socknal_sd%02d_%02d",
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +13 -7
@@ -139,7 +139,7 @@ typedef struct { typedef struct { __u64 ksnn_incarnation; /* my epoch */ spinlock_t ksnn_lock; /* serialise */ - struct list_head ksnn_list; /* chain on global list */ + struct list_head ksnn_list; /* chain on global list */ int ksnn_npeers; /* # peers */ int ksnn_shutdown; /* shutting down? */ int ksnn_ninterfaces; /* IP interfaces */
@@ -474,7 +474,8 @@ ksocknal_route_mask(void)static inline struct list_head *ksocknal_nid2peerlist (lnet_nid_t nid) { -unsigned int hash = ((unsigned int )nid) % ksocknal_data.ksnd_peer_hash_size; +unsigned int hash = ((unsigned int )nid) % + ksocknal_data.ksnd_peer_hash_size;return &ksocknal_data.ksnd_peers[hash]; }
@@ -587,8 +588,10 @@ int ksocknal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, unsigned int offset, unsigned int mlen, unsigned int rlen);int ksocknal_accept (lnet_ni_t *ni,struct socket *sock); -extern int ksocknal_add_peer (lnet_ni_t *ni,lnet_process_id_t id,__u32 ip,int port); -extern ksock_peer_t *ksocknal_find_peer_locked (lnet_ni_t *ni,lnet_process_id_t id); +extern int ksocknal_add_peer (lnet_ni_t *ni,lnet_process_id_t id,__u32 ip, +int port); +extern ksock_peer_t *ksocknal_find_peer_locked (lnet_ni_t *ni, +lnet_process_id_t id);extern ksock_peer_t *ksocknal_find_peer (lnet_ni_t *ni,lnet_process_id_t id);extern void ksocknal_peer_failed (ksock_peer_t *peer); extern int ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
@@ -613,11 +616,13 @@ extern void ksocknal_queue_tx_locked(ksock_tx_t *tx, ksock_conn_t *conn);extern void ksocknal_txlist_done (lnet_ni_t *ni,struct list_head *txlist,int error);extern void ksocknal_notify (lnet_ni_t *ni,lnet_nid_t gw_nid,int alive); -extern void ksocknal_query (struct lnet_ni *ni,lnet_nid_t nid,unsigned long *when); +extern void ksocknal_query (struct lnet_ni *ni,lnet_nid_t nid, +unsigned long *when);extern int ksocknal_thread_start (int (*fn)(void *arg),void *arg,char *name);extern void ksocknal_thread_fini (void );extern void ksocknal_launch_all_connections_locked (ksock_peer_t *peer); -extern ksock_route_t *ksocknal_find_connectable_route_locked (ksock_peer_t *peer); +extern ksock_route_t *ksocknal_find_connectable_route_locked (ksock_peer_t + *peer);extern ksock_route_t *ksocknal_find_connecting_route_locked (ksock_peer_t *peer);extern int ksocknal_new_packet (ksock_conn_t *conn,int skip);extern int ksocknal_scheduler (void *arg);
@@ -634,7 +639,8 @@ extern void ksocknal_write_callback(ksock_conn_t *conn);extern int ksocknal_lib_zc_capable (ksock_conn_t *conn);extern void ksocknal_lib_save_callback (struct socket *sock,ksock_conn_t *conn);extern void ksocknal_lib_set_callback (struct socket *sock,ksock_conn_t *conn); -extern void ksocknal_lib_reset_callback (struct socket *sock,ksock_conn_t *conn); +extern void ksocknal_lib_reset_callback (struct socket *sock, +ksock_conn_t *conn);extern void ksocknal_lib_push_conn (ksock_conn_t *conn);extern int ksocknal_lib_get_conn_addrs (ksock_conn_t *conn);extern int ksocknal_lib_setup_sock (struct socket *so);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +229 -184
1,190 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +12 -11
@@ -176,7 +176,8 @@ ksocknal_lib_send_kiov(ksock_conn_t *conn, ksock_tx_t *tx) nob < tx->tx_resid) msg.msg_flags |=MSG_MORE ; - rc =kernel_sendmsg (sock, &msg, (struct kvec *)scratchiov, niov, nob); + rc =kernel_sendmsg (sock, &msg, (struct kvec *)scratchiov, + niov, nob);for (i =0 ; i < niov; i++)kunmap (kiov[i].kiov_page);
@@ -250,7 +251,8 @@ ksocknal_lib_recv_iov(ksock_conn_t *conn) 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; }
@@ -286,7 +288,8 @@ ksocknal_lib_kiov_vmap(lnet_kiov_t *kiov, int niov,for (nob = i =0 ; i < niov; i++) {if ((kiov[i].kiov_offset !=0 && i >0 ) || - (kiov[i].kiov_offset + kiov[i].kiov_len !=PAGE_CACHE_SIZE && i < niov -1 )) + (kiov[i].kiov_offset + kiov[i].kiov_len !+ PAGE_CACHE_SIZE && i < niov - 1))return NULL ; pages[i] = kiov[i].kiov_page;
@@ -358,9 +361,9 @@ ksocknal_lib_recv_kiov(ksock_conn_t *conn)LASSERT (i < niov);/* Dang! have to kmap again because I have nowhere to -* stash the mapped address. But by doing it while the -* page is still mapped, the kernel just bumps the map -* count and returns me the address it stashed. */ +* stash the mapped address. But by doing it while the +* page is still mapped, the kernel just bumps the map +* count and returns me the address it stashed. */ base =kmap (kiov[i].kiov_page) + kiov[i].kiov_offset; fragnob = kiov[i].kiov_len;if (fragnob > sum)
@@ -404,7 +407,8 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx) base =kmap (tx->tx_kiov[i].kiov_page) + tx->tx_kiov[i].kiov_offset; - csum =ksocknal_csum (csum, base, tx->tx_kiov[i].kiov_len); + csum =ksocknal_csum (csum, base, + tx->tx_kiov[i].kiov_len);kunmap (tx->tx_kiov[i].kiov_page); }
@@ -423,7 +427,8 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx) }int -ksocknal_lib_get_conn_tunables (ksock_conn_t *conn,int *txmem,int *rxmem,int *nagle) +ksocknal_lib_get_conn_tunables (ksock_conn_t *conn,int *txmem,int *rxmem, +int *nagle) {struct socket *sock = conn->ksnc_sock;int len;
@@ -666,7 +671,6 @@ ksocknal_lib_set_callback(struct socket *sock, ksock_conn_t *conn) sock->sk->sk_user_data = conn; sock->sk->sk_data_ready = ksocknal_data_ready; sock->sk->sk_write_space = ksocknal_write_space; -return ; }void
@@ -682,8 +686,6 @@ ksocknal_lib_reset_callback(struct socket *sock, ksock_conn_t *conn)* on ksnd_global_lock (to serialise with me) and NOOP if * sk_user_data is NULL. */ sock->sk->sk_user_data =NULL ; - -return ; }int
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.h +1 -1
@@ -71,7 +71,7 @@ static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)return crc32_le (crc, p, len);#else while (len-- >0 ) - crc = ((crc +0x100 ) & ~0xff ) | ((crc + *p++) &0xff ) ; + crc = ((crc +0x100 ) & ~0xff ) | ((crc + *p++) &0xff );return crc;#endif }
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +30 -17
118 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 13/13 staging: lustre: lnet: selftest: checkpatch.pl fixes
In reply to Mike ShueyCleaning up more checkpatch.pl issues.
--- drivers/staging/lustre/lnet/selftest/brw_test.c | 3 +- drivers/staging/lustre/lnet/selftest/conctl.c | 4 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 41 ++++++++-------- drivers/staging/lustre/lnet/selftest/conrpc.h | 7 ++- drivers/staging/lustre/lnet/selftest/console.c | 33 ++++++------ drivers/staging/lustre/lnet/selftest/console.h | 14 +++-- drivers/staging/lustre/lnet/selftest/framework.c | 46 ++++++++--------- drivers/staging/lustre/lnet/selftest/module.c | 3 +- drivers/staging/lustre/lnet/selftest/ping_test.c | 1 - drivers/staging/lustre/lnet/selftest/rpc.c | 29 +++++------ drivers/staging/lustre/lnet/selftest/selftest.h | 58 ++++++++++------------ drivers/staging/lustre/lnet/selftest/timer.h | 2 +- 12 files changed, 119 insertions(+), 122 deletions(-)
drivers/staging/lustre/lnet/selftest/brw_test.c +2 -1
@@ -463,7 +463,8 @@ brw_server_handle(struct srpc_server_rpc *rpc) npg = reqst->brw_len >>PAGE_CACHE_SHIFT ; }else { - npg = (reqst->brw_len +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; + npg = (reqst->brw_len +PAGE_CACHE_SIZE -1 ) >> +PAGE_CACHE_SHIFT ; } replymsg->msg_ses_feats = reqstmsg->msg_ses_feats;
drivers/staging/lustre/lnet/selftest/conctl.c +2 -2
@@ -752,7 +752,8 @@ static int lst_test_add_ioctl(lstio_test_args_t *args)/* have parameter, check if parameter length is valid */ if (args->lstio_tes_param !=NULL && (args->lstio_tes_param_len <=0 || - args->lstio_tes_param_len >PAGE_CACHE_SIZE -sizeof (lstcon_test_t))) + args->lstio_tes_param_len >PAGE_CACHE_SIZE - +sizeof (lstcon_test_t)))return -EINVAL ;LIBCFS_ALLOC (batch_name, args->lstio_tes_bat_nmlen +1 );
@@ -925,5 +926,4 @@ out:return rc; } -EXPORT_SYMBOL (lstcon_ioctl_entry);
drivers/staging/lustre/lnet/selftest/conrpc.c +20 -20
@@ -455,14 +455,13 @@ lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat)lstcon_session_feats_check (trans->tas_features); } -CDEBUG (D_NET ,"transaction %s : success %d, failure %d, total %d, RPC error(%d), Framework error(%d)\n" , +CDEBUG (D_NET , +"transaction %s : success %d, failure %d, total %d, RPC error(%d), Framework error(%d)\n" ,lstcon_rpc_trans_name (trans->tas_opc),lstcon_rpc_stat_success (stat,0 ),lstcon_rpc_stat_failure (stat,0 ),lstcon_rpc_stat_total (stat,0 ), stat->trs_rpc_errno, stat->trs_fwk_errno); - -return ; }int
@@ -564,10 +563,10 @@ lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans)continue ; } -/* rpcs can be still not callbacked (even LNetMDUnlink is called) -* because huge timeout for inaccessible network, don't make -* user wait for them, just abandon them, they will be recycled -* in callback */ +/* rpcs can be still not callbacked (even LNetMDUnlink is +* called) because huge timeout for inaccessible network, +* don't make user wait for them, just abandon them, they +* will be recycled in callback */ LASSERT (crpc->crp_status !=0 );
@@ -591,8 +590,6 @@ lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans) lstcon_rpc_trans_name(trans->tas_opc), count);LIBCFS_FREE (trans,sizeof (*trans)); - -return ; }int
@@ -947,9 +944,10 @@ lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans, }if (reply->msg_ses_feats != trans->tas_features) { -CNETERR ("Framework features %x from %s is different with features on this transaction: %x\n" , - reply->msg_ses_feats,libcfs_nid2str (nd->nd_id.nid), - trans->tas_features); +CNETERR ( +"Framework features %x from %s is different with features on this transaction: %x\n" , + reply->msg_ses_feats,libcfs_nid2str (nd->nd_id.nid), + trans->tas_features); status = mksn_rep->mksn_status =EPROTO ; }
@@ -1077,8 +1075,6 @@ lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,if (stat->trs_fwk_errno =0 ) stat->trs_fwk_errno = rc; - -return ; }int
@@ -1111,8 +1107,9 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,continue ;if (rc <0 ) { -CDEBUG (D_NET ,"Condition error while creating RPC for transaction %d: %d\n" , - transop, rc); +CDEBUG (D_NET , +"Condition error while creating RPC for transaction %d: %d\n" , + transop, rc);break ; }
@@ -1278,7 +1275,8 @@ lstcon_rpc_pinger(void *arg)CDEBUG (D_NET ,"Ping %d nodes in session\n" , count); - ptimer->stt_expires = (unsigned long )(get_seconds () +LST_PING_INTERVAL ); + ptimer->stt_expires = (unsigned long )(get_seconds () + +LST_PING_INTERVAL );stt_add_timer (ptimer);mutex_unlock (&console_session.ses_mutex);
@@ -1301,7 +1299,8 @@ lstcon_rpc_pinger_start(void) } ptimer = &console_session.ses_ping_timer; - ptimer->stt_expires = (unsigned long )(get_seconds () +LST_PING_INTERVAL ); + ptimer->stt_expires = (unsigned long )(get_seconds () + +LST_PING_INTERVAL );stt_add_timer (ptimer);
@@ -1349,7 +1348,8 @@ lstcon_rpc_cleanup_wait(void)mutex_unlock (&console_session.ses_mutex); -CWARN ("Session is shutting down, waiting for termination of transactions\n" ); +CWARN ( +"Session is shutting down, waiting for termination of transactions\n" );set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (cfs_time_seconds (1 ));
@@ -1381,7 +1381,8 @@ lstcon_rpc_module_init(void) {INIT_LIST_HEAD (&console_session.ses_ping_timer.stt_list); console_session.ses_ping_timer.stt_func = lstcon_rpc_pinger; - console_session.ses_ping_timer.stt_data = &console_session.ses_ping_timer; + console_session.ses_ping_timer.stt_data + &console_session.ses_ping_timer; console_session.ses_ping =NULL ;
drivers/staging/lustre/lnet/selftest/conrpc.h +4 -3
@@ -54,7 +54,8 @@#define LST_TRANS_TIMEOUT 30#define LST_TRANS_MIN_TIMEOUT 3 -#define LST_VALIDATE_TIMEOUT (t) min(max(t, LST_TRANS_MIN_TIMEOUT), LST_TRANS_TIMEOUT) +#define LST_VALIDATE_TIMEOUT (t) min(max(t, LST_TRANS_MIN_TIMEOUT), \ + LST_TRANS_TIMEOUT)#define LST_PING_INTERVAL 8
@@ -105,8 +106,8 @@ typedef struct lstcon_rpc_trans {#define LST_TRANS_STATQRY 0x21 -typedef int (*lstcon_rpc_cond_func_t )(int ,struct lstcon_node *,void *); -typedef int (*lstcon_rpc_readent_func_t )(int ,srpc_msg_t *,lstcon_rpc_ent_t *); +typedef int (*lstcon_rpc_cond_func_t )(int ,struct lstcon_node *,void *); +typedef int (*lstcon_rpc_readent_func_t )(int ,srpc_msg_t *,lstcon_rpc_ent_t *);int lstcon_sesrpc_prep (struct lstcon_node *nd,int transop,unsigned version,lstcon_rpc_t **crpc);
drivers/staging/lustre/lnet/selftest/console.c +16 -17
@@ -77,7 +77,8 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)LASSERT (id.nid !=LNET_NID_ANY ); -list_for_each_entry (ndl, &console_session.ses_ndl_hash[idx], ndl_hlink) { +list_for_each_entry (ndl, &console_session.ses_ndl_hash[idx], + ndl_hlink) {if (ndl->ndl_node->nd_id.nid != id.nid || ndl->ndl_node->nd_id.pid != id.pid)continue ;
@@ -253,9 +254,8 @@ lstcon_group_decref(lstcon_group_t *grp)lstcon_group_drain (grp,0 ); -for (i =0 ; i <LST_NODE_HASHSIZE ; i++) { +for (i =0 ; i <LST_NODE_HASHSIZE ; i++)LASSERT (list_empty (&grp->grp_ndl_hash[i])); - }LIBCFS_FREE (grp, offsetof(lstcon_group_t , grp_ndl_hash[LST_NODE_HASHSIZE]));
@@ -308,7 +308,7 @@ lstcon_group_ndlink_release(lstcon_group_t *grp, lstcon_ndlink_t *ndl) {list_del_init (&ndl->ndl_link);lstcon_ndlink_release (ndl); - grp->grp_nnode --; + grp->grp_nnode--; } static void
@@ -320,13 +320,11 @@ lstcon_group_ndlink_move(lstcon_group_t *old,list_del (&ndl->ndl_hlink);list_del (&ndl->ndl_link); - old->grp_nnode --; + old->grp_nnode--;list_add_tail (&ndl->ndl_hlink, &new->grp_ndl_hash[idx]);list_add_tail (&ndl->ndl_link, &new->grp_ndl_list); new->grp_nnode++; - -return ; } static void
@@ -527,7 +525,7 @@ lstcon_group_add(char *name)lstcon_group_t *grp;int rc; - rc = (lstcon_group_find (name, &grp) =0 )? -EEXIST :0 ; + rc = (lstcon_group_find (name, &grp) =0 ) ? -EEXIST :0 ;if (rc !=0 ) {/* find a group with same name */ lstcon_group_put (grp);
@@ -816,7 +814,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,LST_NODE_STATE_COUNTER (ndl->ndl_node, gentp); rc =copy_to_user (gents_p, gentp, -sizeof (lstcon_ndlist_ent_t)) ? -EFAULT :0 ; +sizeof (lstcon_ndlist_ent_t)) ? -EFAULT :0 ;LIBCFS_FREE (gentp,sizeof (lstcon_ndlist_ent_t));
@@ -847,7 +845,7 @@ lstcon_batch_add(char *name)int i;int rc; - rc = (lstcon_batch_find (name, &bat) =0 )? -EEXIST :0 ; + rc = (lstcon_batch_find (name, &bat) =0 ) ? -EEXIST :0 ;if (rc !=0 ) {CDEBUG (D_NET ,"Batch %s already exists\n" , name);return rc;
@@ -911,7 +909,7 @@ lstcon_batch_list(int index, int len, char *name_up)list_for_each_entry (bat, &console_session.ses_bat_list, bat_link) { if (index-- = 0) {return copy_to_user (name_up, bat->bat_name, len) ? - -EFAULT :0 ; + -EFAULT :0 ; } }
@@ -956,7 +954,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server, &test->tes_dst_grp->grp_ndl_list;if (dents_up !=NULL ) { - rc =lstcon_nodes_getent ((server ? srvlst: clilst), + rc =lstcon_nodes_getent ((server ? srvlst : clilst), index_p, ndent_p, dents_up);return rc; }
@@ -1208,7 +1206,8 @@ again:lstcon_rpc_trans_destroy (trans);/* return if any error */ -CDEBUG (D_NET ,"Failed to add test %s, RPC error %d, framework error %d\n" , +CDEBUG (D_NET , +"Failed to add test %s, RPC error %d, framework error %d\n" , transop =LST_TRANS_TSBCLIADD ?"client" :"server" ,lstcon_trans_stat ()->trs_rpc_errno,lstcon_trans_stat ()->trs_fwk_errno);
@@ -1683,7 +1682,7 @@ int lstcon_session_match(lst_sid_t sid) {return (console_session.ses_id.ses_nid = sid.ses_nid && - console_session.ses_id.ses_stamp = sid.ses_stamp) ?1 :0 ; + console_session.ses_id.ses_stamp = sid.ses_stamp) ?1 :0 ; } static void
@@ -1884,7 +1883,8 @@ lstcon_session_feats_check(unsigned feats)spin_unlock (&console_session.ses_rpc_lock);if (rc !=0 ) { -CERROR ("remote features %x do not match with session features %x of console\n" , +CERROR ( +"remote features %x do not match with session features %x of console\n" , feats, console_session.ses_features); }
@@ -2083,9 +2083,8 @@ lstcon_console_fini(void)LASSERT (list_empty (&console_session.ses_bat_list));LASSERT (list_empty (&console_session.ses_trans_list)); -for (i =0 ; i <LST_NODE_HASHSIZE ; i++) { +for (i =0 ; i <LST_NODE_HASHSIZE ; i++)LASSERT (list_empty (&console_session.ses_ndl_hash[i])); - }LIBCFS_FREE (console_session.ses_ndl_hash,sizeof (struct list_head ) *LST_GLOBAL_HASHSIZE );
drivers/staging/lustre/lnet/selftest/console.h +9 -5
@@ -116,9 +116,11 @@ typedef struct lstcon_test {int tes_oneside;/* one-sided test */ int tes_concur;/* concurrency */ int tes_loop;/* loop count */ -int tes_dist;/* nodes distribution of target group */ +int tes_dist;/* nodes distribution of target +* group */ int tes_span;/* nodes span of target group */ -int tes_cliidx;/* client index, used for RPC creating */ +int tes_cliidx;/* client index, used for RPC +* creating */ struct list_head tes_trans_list;/* transaction list */ lstcon_group_t *tes_src_grp;/* group run the test */
@@ -177,7 +179,7 @@ lstcon_trans_stat(void) }static inline struct list_head * -lstcon_id2hash (lnet_process_id_t id,struct list_head *hash) +lstcon_id2hash (lnet_process_id_t id,struct list_head *hash) {unsigned int idx =LNET_NIDADDR (id.nid) %LST_NODE_HASHSIZE ;
@@ -191,7 +193,8 @@ extern int lstcon_session_match(lst_sid_t sid);extern int lstcon_session_new (char *name,int key,unsigned version,int timeout,int flags,lst_sid_t *sid_up);extern int lstcon_session_info (lst_sid_t *sid_up,int *key,unsigned *verp, -lstcon_ndlist_ent_t *entp,char *name_up,int len); +lstcon_ndlist_ent_t *entp,char *name_up, +int len);extern int lstcon_session_end (void );extern int lstcon_session_debug (int timeout,struct list_head *result_up);extern int lstcon_session_feats_check (unsigned feats);
@@ -210,7 +213,8 @@ extern int lstcon_nodes_add(char *name, int nnd, lnet_process_id_t *nds_up,extern int lstcon_nodes_remove (char *name,int nnd,lnet_process_id_t *nds_up,struct list_head *result_up);extern int lstcon_group_info (char *name,lstcon_ndlist_ent_t *gent_up, -int *index_p,int *ndent_p,lstcon_node_ent_t *ndents_up); +int *index_p,int *ndent_p, +lstcon_node_ent_t *ndents_up);extern int lstcon_group_list (int idx,int len,char *name_up);extern int lstcon_batch_add (char *name); extern int lstcon_batch_run(char *name, int timeout,
drivers/staging/lustre/lnet/selftest/framework.c +21 -25
185 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/module.c +2 -1
@@ -118,7 +118,8 @@ lnet_selftest_init(void) rc =cfs_wi_sched_create ("lst_t" ,lnet_cpt_table (), i, nthrs, &lst_sched_test[i]);if (rc !=0 ) { -CERROR ("Failed to create CPT affinity WI scheduler %d for LST\n" , +CERROR ( +"Failed to create CPT affinity WI scheduler %d for LST\n" , i); goto error; }
drivers/staging/lustre/lnet/selftest/ping_test.c +0 -1
@@ -165,7 +165,6 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)CDEBUG (D_NET ,"%d reply in %u usec\n" , reply->pnr_seq, (unsigned )((tv.tv_sec - (unsigned )reqst->pnr_time_sec) *1000000 + (tv.tv_usec - reqst->pnr_time_usec))); -return ; } static int
drivers/staging/lustre/lnet/selftest/rpc.c +14 -15
@@ -118,7 +118,6 @@ srpc_free_bulk(srpc_bulk_t *bk) } LIBCFS_FREE(bk, offsetof(srpc_bulk_t, bk_iovs[bk->bk_niov])); -return ; } srpc_bulk_t *
@@ -145,7 +144,8 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink)struct page *pg;int nob; - pg =alloc_pages_node (cfs_cpt_spread_node (lnet_cpt_table (), cpt), + pg =alloc_pages_node (cfs_cpt_spread_node (lnet_cpt_table (), + cpt),GFP_IOFS ,0 );if (pg =NULL ) {CERROR ("Can't allocate page %d of %d\n" , i, bulk_npg);
@@ -680,7 +680,8 @@ srpc_finish_service(struct srpc_service *sv) rpc =list_entry (scd->scd_rpc_active.next, struct srpc_server_rpc, srpc_list); - CNETERR("Active RPC %p on shutdown: sv %s, peer %s, wi %s scheduled %d running %d, ev fired %d type %d status %d lnet %d\n", + CNETERR( + "Active RPC %p on shutdown: sv %s, peer %s, wi %s scheduled %d running %d, ev fired %d type %d status %d lnet %d\n", rpc, sv->sv_name, libcfs_id2str(rpc->srpc_peer), swi_state2str(rpc->srpc_wi.swi_state), rpc->srpc_wi.swi_workitem.wi_scheduled,
@@ -952,7 +953,6 @@ srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status) }spin_unlock (&scd->scd_lock); -return ; }/* handles an incoming RPC */
@@ -1103,7 +1103,6 @@ srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc) timer->stt_expires =cfs_time_add (rpc->crpc_timeout,get_seconds ());stt_add_timer (timer); -return ; }/*
@@ -1166,7 +1165,6 @@ srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status)spin_unlock (&rpc->crpc_lock); (*rpc->crpc_done)(rpc); -return ; }/* sends an outgoing RPC */
@@ -1244,7 +1242,8 @@ srpc_send_rpc(swi_workitem_t *wi)if (reply->msg_type != type || (reply->msg_magic !=SRPC_MSG_MAGIC && reply->msg_magic !=__swab32 (SRPC_MSG_MAGIC ))) { -CWARN ("Bad message from %s: type %u (%d expected), magic %u (%d expected).\n" , +CWARN ( +"Bad message from %s: type %u (%d expected), magic %u (%d expected).\n" ,libcfs_id2str (rpc->crpc_dest), reply->msg_type, type, reply->msg_magic,SRPC_MSG_MAGIC );
@@ -1253,7 +1252,8 @@ srpc_send_rpc(swi_workitem_t *wi) }if (do_bulk && reply->msg_body.reply.status !=0 ) { -CWARN ("Remote error %d at %s, unlink bulk buffer in case peer didn't initiate bulk transfer\n" , +CWARN ( +"Remote error %d at %s, unlink bulk buffer in case peer didn't initiate bulk transfer\n" , reply->msg_body.reply.status,libcfs_id2str (rpc->crpc_dest));LNetMDUnlink (rpc->crpc_bulk.bk_mdh);
@@ -1336,7 +1336,6 @@ srpc_abort_rpc(srpc_client_rpc_t *rpc, int why) rpc->crpc_aborted =1 ; rpc->crpc_status = why;swi_schedule_workitem (&rpc->crpc_wi); -return ; }/* called with rpc->crpc_lock held */
@@ -1352,7 +1351,6 @@ srpc_post_rpc(srpc_client_rpc_t *rpc)srpc_add_client_rpc_timer (rpc);swi_schedule_workitem (&rpc->crpc_wi); -return ; }
@@ -1440,11 +1438,13 @@ srpc_lnet_ev_handler(lnet_event_t *ev)if (rpcev != &crpc->crpc_reqstev && rpcev != &crpc->crpc_replyev && rpcev != &crpc->crpc_bulkev) { -CERROR ("rpcev %p, crpc %p, reqstev %p, replyev %p, bulkev %p\n" , +CERROR ( +"rpcev %p, crpc %p, reqstev %p, replyev %p, bulkev %p\n" , rpcev, crpc, &crpc->crpc_reqstev, &crpc->crpc_replyev, &crpc->crpc_bulkev);CERROR ("Bad event: status %d, type %d, lnet %d\n" , - rpcev->ev_status, rpcev->ev_type, rpcev->ev_lnet); + rpcev->ev_status, rpcev->ev_type, + rpcev->ev_lnet);LBUG (); }
@@ -1511,7 +1511,8 @@ srpc_lnet_ev_handler(lnet_event_t *ev) msg->msg_type != __swab32(type)) || (msg->msg_magic != SRPC_MSG_MAGIC && msg->msg_magic != __swab32(SRPC_MSG_MAGIC))) { -CERROR ("Dropping RPC (%s) from %s: status %d mlength %d type %u magic %u.\n" , +CERROR ( +"Dropping RPC (%s) from %s: status %d mlength %d type %u magic %u.\n" , sv->sv_name,libcfs_id2str (ev->initiator), ev->status, ev->mlength, msg->msg_type, msg->msg_magic);
@@ -1668,6 +1669,4 @@ srpc_shutdown(void)case SRPC_STATE_NI_INIT :LNetNIFini (); } - -return ; }
drivers/staging/lustre/lnet/selftest/selftest.h +27 -31
124 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/timer.h +1 -1
@@ -41,7 +41,7 @@typedef struct {struct list_head stt_list;unsigned long stt_expires; -void (*stt_func) (void *); +void (*stt_func)(void *);void *stt_data; }stt_timer_t ;
Signature · 1 line
1.7.1
PATCH v4 13/13 staging: lustre: lnet: selftest: checkpatch.pl fixes
In reply to Mike ShueyCleaning up more checkpatch.pl issues.
--- drivers/staging/lustre/lnet/selftest/brw_test.c | 3 +- drivers/staging/lustre/lnet/selftest/conctl.c | 4 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 41 ++++++++-------- drivers/staging/lustre/lnet/selftest/conrpc.h | 7 ++- drivers/staging/lustre/lnet/selftest/console.c | 33 ++++++------ drivers/staging/lustre/lnet/selftest/console.h | 14 +++-- drivers/staging/lustre/lnet/selftest/framework.c | 46 ++++++++--------- drivers/staging/lustre/lnet/selftest/module.c | 3 +- drivers/staging/lustre/lnet/selftest/ping_test.c | 1 - drivers/staging/lustre/lnet/selftest/rpc.c | 29 +++++------ drivers/staging/lustre/lnet/selftest/selftest.h | 58 ++++++++++------------ drivers/staging/lustre/lnet/selftest/timer.h | 2 +- 12 files changed, 119 insertions(+), 122 deletions(-)
drivers/staging/lustre/lnet/selftest/brw_test.c +2 -1
@@ -463,7 +463,8 @@ brw_server_handle(struct srpc_server_rpc *rpc) npg = reqst->brw_len >>PAGE_CACHE_SHIFT ; }else { - npg = (reqst->brw_len +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; + npg = (reqst->brw_len +PAGE_CACHE_SIZE -1 ) >> +PAGE_CACHE_SHIFT ; } replymsg->msg_ses_feats = reqstmsg->msg_ses_feats;
drivers/staging/lustre/lnet/selftest/conctl.c +2 -2
@@ -752,7 +752,8 @@ static int lst_test_add_ioctl(lstio_test_args_t *args)/* have parameter, check if parameter length is valid */ if (args->lstio_tes_param !=NULL && (args->lstio_tes_param_len <=0 || - args->lstio_tes_param_len >PAGE_CACHE_SIZE -sizeof (lstcon_test_t))) + args->lstio_tes_param_len >PAGE_CACHE_SIZE - +sizeof (lstcon_test_t)))return -EINVAL ;LIBCFS_ALLOC (batch_name, args->lstio_tes_bat_nmlen +1 );
@@ -925,5 +926,4 @@ out:return rc; } -EXPORT_SYMBOL (lstcon_ioctl_entry);
drivers/staging/lustre/lnet/selftest/conrpc.c +20 -20
@@ -455,14 +455,13 @@ lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat)lstcon_session_feats_check (trans->tas_features); } -CDEBUG (D_NET ,"transaction %s : success %d, failure %d, total %d, RPC error(%d), Framework error(%d)\n" , +CDEBUG (D_NET , +"transaction %s : success %d, failure %d, total %d, RPC error(%d), Framework error(%d)\n" ,lstcon_rpc_trans_name (trans->tas_opc),lstcon_rpc_stat_success (stat,0 ),lstcon_rpc_stat_failure (stat,0 ),lstcon_rpc_stat_total (stat,0 ), stat->trs_rpc_errno, stat->trs_fwk_errno); - -return ; }int
@@ -564,10 +563,10 @@ lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans)continue ; } -/* rpcs can be still not callbacked (even LNetMDUnlink is called) -* because huge timeout for inaccessible network, don't make -* user wait for them, just abandon them, they will be recycled -* in callback */ +/* rpcs can be still not callbacked (even LNetMDUnlink is +* called) because huge timeout for inaccessible network, +* don't make user wait for them, just abandon them, they +* will be recycled in callback */ LASSERT (crpc->crp_status !=0 );
@@ -591,8 +590,6 @@ lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans) lstcon_rpc_trans_name(trans->tas_opc), count);LIBCFS_FREE (trans,sizeof (*trans)); - -return ; }int
@@ -947,9 +944,10 @@ lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans, }if (reply->msg_ses_feats != trans->tas_features) { -CNETERR ("Framework features %x from %s is different with features on this transaction: %x\n" , - reply->msg_ses_feats,libcfs_nid2str (nd->nd_id.nid), - trans->tas_features); +CNETERR ( +"Framework features %x from %s is different with features on this transaction: %x\n" , + reply->msg_ses_feats,libcfs_nid2str (nd->nd_id.nid), + trans->tas_features); status = mksn_rep->mksn_status =EPROTO ; }
@@ -1077,8 +1075,6 @@ lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,if (stat->trs_fwk_errno =0 ) stat->trs_fwk_errno = rc; - -return ; }int
@@ -1111,8 +1107,9 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,continue ;if (rc <0 ) { -CDEBUG (D_NET ,"Condition error while creating RPC for transaction %d: %d\n" , - transop, rc); +CDEBUG (D_NET , +"Condition error while creating RPC for transaction %d: %d\n" , + transop, rc);break ; }
@@ -1278,7 +1275,8 @@ lstcon_rpc_pinger(void *arg)CDEBUG (D_NET ,"Ping %d nodes in session\n" , count); - ptimer->stt_expires = (unsigned long )(get_seconds () +LST_PING_INTERVAL ); + ptimer->stt_expires = (unsigned long )(get_seconds () + +LST_PING_INTERVAL );stt_add_timer (ptimer);mutex_unlock (&console_session.ses_mutex);
@@ -1301,7 +1299,8 @@ lstcon_rpc_pinger_start(void) } ptimer = &console_session.ses_ping_timer; - ptimer->stt_expires = (unsigned long )(get_seconds () +LST_PING_INTERVAL ); + ptimer->stt_expires = (unsigned long )(get_seconds () + +LST_PING_INTERVAL );stt_add_timer (ptimer);
@@ -1349,7 +1348,8 @@ lstcon_rpc_cleanup_wait(void)mutex_unlock (&console_session.ses_mutex); -CWARN ("Session is shutting down, waiting for termination of transactions\n" ); +CWARN ( +"Session is shutting down, waiting for termination of transactions\n" );set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (cfs_time_seconds (1 ));
@@ -1381,7 +1381,8 @@ lstcon_rpc_module_init(void) {INIT_LIST_HEAD (&console_session.ses_ping_timer.stt_list); console_session.ses_ping_timer.stt_func = lstcon_rpc_pinger; - console_session.ses_ping_timer.stt_data = &console_session.ses_ping_timer; + console_session.ses_ping_timer.stt_data + &console_session.ses_ping_timer; console_session.ses_ping =NULL ;
drivers/staging/lustre/lnet/selftest/conrpc.h +4 -3
@@ -54,7 +54,8 @@#define LST_TRANS_TIMEOUT 30#define LST_TRANS_MIN_TIMEOUT 3 -#define LST_VALIDATE_TIMEOUT (t) min(max(t, LST_TRANS_MIN_TIMEOUT), LST_TRANS_TIMEOUT) +#define LST_VALIDATE_TIMEOUT (t) min(max(t, LST_TRANS_MIN_TIMEOUT), \ + LST_TRANS_TIMEOUT)#define LST_PING_INTERVAL 8
@@ -105,8 +106,8 @@ typedef struct lstcon_rpc_trans {#define LST_TRANS_STATQRY 0x21 -typedef int (*lstcon_rpc_cond_func_t )(int ,struct lstcon_node *,void *); -typedef int (*lstcon_rpc_readent_func_t )(int ,srpc_msg_t *,lstcon_rpc_ent_t *); +typedef int (*lstcon_rpc_cond_func_t )(int ,struct lstcon_node *,void *); +typedef int (*lstcon_rpc_readent_func_t )(int ,srpc_msg_t *,lstcon_rpc_ent_t *);int lstcon_sesrpc_prep (struct lstcon_node *nd,int transop,unsigned version,lstcon_rpc_t **crpc);
drivers/staging/lustre/lnet/selftest/console.c +16 -17
@@ -77,7 +77,8 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)LASSERT (id.nid !=LNET_NID_ANY ); -list_for_each_entry (ndl, &console_session.ses_ndl_hash[idx], ndl_hlink) { +list_for_each_entry (ndl, &console_session.ses_ndl_hash[idx], + ndl_hlink) {if (ndl->ndl_node->nd_id.nid != id.nid || ndl->ndl_node->nd_id.pid != id.pid)continue ;
@@ -253,9 +254,8 @@ lstcon_group_decref(lstcon_group_t *grp)lstcon_group_drain (grp,0 ); -for (i =0 ; i <LST_NODE_HASHSIZE ; i++) { +for (i =0 ; i <LST_NODE_HASHSIZE ; i++)LASSERT (list_empty (&grp->grp_ndl_hash[i])); - }LIBCFS_FREE (grp, offsetof(lstcon_group_t , grp_ndl_hash[LST_NODE_HASHSIZE]));
@@ -308,7 +308,7 @@ lstcon_group_ndlink_release(lstcon_group_t *grp, lstcon_ndlink_t *ndl) {list_del_init (&ndl->ndl_link);lstcon_ndlink_release (ndl); - grp->grp_nnode --; + grp->grp_nnode--; } static void
@@ -320,13 +320,11 @@ lstcon_group_ndlink_move(lstcon_group_t *old,list_del (&ndl->ndl_hlink);list_del (&ndl->ndl_link); - old->grp_nnode --; + old->grp_nnode--;list_add_tail (&ndl->ndl_hlink, &new->grp_ndl_hash[idx]);list_add_tail (&ndl->ndl_link, &new->grp_ndl_list); new->grp_nnode++; - -return ; } static void
@@ -527,7 +525,7 @@ lstcon_group_add(char *name)lstcon_group_t *grp;int rc; - rc = (lstcon_group_find (name, &grp) =0 )? -EEXIST :0 ; + rc = (lstcon_group_find (name, &grp) =0 ) ? -EEXIST :0 ;if (rc !=0 ) {/* find a group with same name */ lstcon_group_put (grp);
@@ -816,7 +814,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,LST_NODE_STATE_COUNTER (ndl->ndl_node, gentp); rc =copy_to_user (gents_p, gentp, -sizeof (lstcon_ndlist_ent_t)) ? -EFAULT :0 ; +sizeof (lstcon_ndlist_ent_t)) ? -EFAULT :0 ;LIBCFS_FREE (gentp,sizeof (lstcon_ndlist_ent_t));
@@ -847,7 +845,7 @@ lstcon_batch_add(char *name)int i;int rc; - rc = (lstcon_batch_find (name, &bat) =0 )? -EEXIST :0 ; + rc = (lstcon_batch_find (name, &bat) =0 ) ? -EEXIST :0 ;if (rc !=0 ) {CDEBUG (D_NET ,"Batch %s already exists\n" , name);return rc;
@@ -911,7 +909,7 @@ lstcon_batch_list(int index, int len, char *name_up)list_for_each_entry (bat, &console_session.ses_bat_list, bat_link) { if (index-- = 0) {return copy_to_user (name_up, bat->bat_name, len) ? - -EFAULT :0 ; + -EFAULT :0 ; } }
@@ -956,7 +954,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server, &test->tes_dst_grp->grp_ndl_list;if (dents_up !=NULL ) { - rc =lstcon_nodes_getent ((server ? srvlst: clilst), + rc =lstcon_nodes_getent ((server ? srvlst : clilst), index_p, ndent_p, dents_up);return rc; }
@@ -1208,7 +1206,8 @@ again:lstcon_rpc_trans_destroy (trans);/* return if any error */ -CDEBUG (D_NET ,"Failed to add test %s, RPC error %d, framework error %d\n" , +CDEBUG (D_NET , +"Failed to add test %s, RPC error %d, framework error %d\n" , transop =LST_TRANS_TSBCLIADD ?"client" :"server" ,lstcon_trans_stat ()->trs_rpc_errno,lstcon_trans_stat ()->trs_fwk_errno);
@@ -1683,7 +1682,7 @@ int lstcon_session_match(lst_sid_t sid) {return (console_session.ses_id.ses_nid = sid.ses_nid && - console_session.ses_id.ses_stamp = sid.ses_stamp) ?1 :0 ; + console_session.ses_id.ses_stamp = sid.ses_stamp) ?1 :0 ; } static void
@@ -1884,7 +1883,8 @@ lstcon_session_feats_check(unsigned feats)spin_unlock (&console_session.ses_rpc_lock);if (rc !=0 ) { -CERROR ("remote features %x do not match with session features %x of console\n" , +CERROR ( +"remote features %x do not match with session features %x of console\n" , feats, console_session.ses_features); }
@@ -2083,9 +2083,8 @@ lstcon_console_fini(void)LASSERT (list_empty (&console_session.ses_bat_list));LASSERT (list_empty (&console_session.ses_trans_list)); -for (i =0 ; i <LST_NODE_HASHSIZE ; i++) { +for (i =0 ; i <LST_NODE_HASHSIZE ; i++)LASSERT (list_empty (&console_session.ses_ndl_hash[i])); - }LIBCFS_FREE (console_session.ses_ndl_hash,sizeof (struct list_head ) *LST_GLOBAL_HASHSIZE );
drivers/staging/lustre/lnet/selftest/console.h +9 -5
@@ -116,9 +116,11 @@ typedef struct lstcon_test {int tes_oneside;/* one-sided test */ int tes_concur;/* concurrency */ int tes_loop;/* loop count */ -int tes_dist;/* nodes distribution of target group */ +int tes_dist;/* nodes distribution of target +* group */ int tes_span;/* nodes span of target group */ -int tes_cliidx;/* client index, used for RPC creating */ +int tes_cliidx;/* client index, used for RPC +* creating */ struct list_head tes_trans_list;/* transaction list */ lstcon_group_t *tes_src_grp;/* group run the test */
@@ -177,7 +179,7 @@ lstcon_trans_stat(void) }static inline struct list_head * -lstcon_id2hash (lnet_process_id_t id,struct list_head *hash) +lstcon_id2hash (lnet_process_id_t id,struct list_head *hash) {unsigned int idx =LNET_NIDADDR (id.nid) %LST_NODE_HASHSIZE ;
@@ -191,7 +193,8 @@ extern int lstcon_session_match(lst_sid_t sid);extern int lstcon_session_new (char *name,int key,unsigned version,int timeout,int flags,lst_sid_t *sid_up);extern int lstcon_session_info (lst_sid_t *sid_up,int *key,unsigned *verp, -lstcon_ndlist_ent_t *entp,char *name_up,int len); +lstcon_ndlist_ent_t *entp,char *name_up, +int len);extern int lstcon_session_end (void );extern int lstcon_session_debug (int timeout,struct list_head *result_up);extern int lstcon_session_feats_check (unsigned feats);
@@ -210,7 +213,8 @@ extern int lstcon_nodes_add(char *name, int nnd, lnet_process_id_t *nds_up,extern int lstcon_nodes_remove (char *name,int nnd,lnet_process_id_t *nds_up,struct list_head *result_up);extern int lstcon_group_info (char *name,lstcon_ndlist_ent_t *gent_up, -int *index_p,int *ndent_p,lstcon_node_ent_t *ndents_up); +int *index_p,int *ndent_p, +lstcon_node_ent_t *ndents_up);extern int lstcon_group_list (int idx,int len,char *name_up);extern int lstcon_batch_add (char *name); extern int lstcon_batch_run(char *name, int timeout,
drivers/staging/lustre/lnet/selftest/framework.c +21 -25
185 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/module.c +2 -1
@@ -118,7 +118,8 @@ lnet_selftest_init(void) rc =cfs_wi_sched_create ("lst_t" ,lnet_cpt_table (), i, nthrs, &lst_sched_test[i]);if (rc !=0 ) { -CERROR ("Failed to create CPT affinity WI scheduler %d for LST\n" , +CERROR ( +"Failed to create CPT affinity WI scheduler %d for LST\n" , i); goto error; }
drivers/staging/lustre/lnet/selftest/ping_test.c +0 -1
@@ -165,7 +165,6 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)CDEBUG (D_NET ,"%d reply in %u usec\n" , reply->pnr_seq, (unsigned )((tv.tv_sec - (unsigned )reqst->pnr_time_sec) *1000000 + (tv.tv_usec - reqst->pnr_time_usec))); -return ; } static int
drivers/staging/lustre/lnet/selftest/rpc.c +14 -15
@@ -118,7 +118,6 @@ srpc_free_bulk(srpc_bulk_t *bk) } LIBCFS_FREE(bk, offsetof(srpc_bulk_t, bk_iovs[bk->bk_niov])); -return ; } srpc_bulk_t *
@@ -145,7 +144,8 @@ srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink)struct page *pg;int nob; - pg =alloc_pages_node (cfs_cpt_spread_node (lnet_cpt_table (), cpt), + pg =alloc_pages_node (cfs_cpt_spread_node (lnet_cpt_table (), + cpt),GFP_IOFS ,0 );if (pg =NULL ) {CERROR ("Can't allocate page %d of %d\n" , i, bulk_npg);
@@ -680,7 +680,8 @@ srpc_finish_service(struct srpc_service *sv) rpc =list_entry (scd->scd_rpc_active.next, struct srpc_server_rpc, srpc_list); - CNETERR("Active RPC %p on shutdown: sv %s, peer %s, wi %s scheduled %d running %d, ev fired %d type %d status %d lnet %d\n", + CNETERR( + "Active RPC %p on shutdown: sv %s, peer %s, wi %s scheduled %d running %d, ev fired %d type %d status %d lnet %d\n", rpc, sv->sv_name, libcfs_id2str(rpc->srpc_peer), swi_state2str(rpc->srpc_wi.swi_state), rpc->srpc_wi.swi_workitem.wi_scheduled,
@@ -952,7 +953,6 @@ srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status) }spin_unlock (&scd->scd_lock); -return ; }/* handles an incoming RPC */
@@ -1103,7 +1103,6 @@ srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc) timer->stt_expires =cfs_time_add (rpc->crpc_timeout,get_seconds ());stt_add_timer (timer); -return ; }/*
@@ -1166,7 +1165,6 @@ srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status)spin_unlock (&rpc->crpc_lock); (*rpc->crpc_done)(rpc); -return ; }/* sends an outgoing RPC */
@@ -1244,7 +1242,8 @@ srpc_send_rpc(swi_workitem_t *wi)if (reply->msg_type != type || (reply->msg_magic !=SRPC_MSG_MAGIC && reply->msg_magic !=__swab32 (SRPC_MSG_MAGIC ))) { -CWARN ("Bad message from %s: type %u (%d expected), magic %u (%d expected).\n" , +CWARN ( +"Bad message from %s: type %u (%d expected), magic %u (%d expected).\n" ,libcfs_id2str (rpc->crpc_dest), reply->msg_type, type, reply->msg_magic,SRPC_MSG_MAGIC );
@@ -1253,7 +1252,8 @@ srpc_send_rpc(swi_workitem_t *wi) }if (do_bulk && reply->msg_body.reply.status !=0 ) { -CWARN ("Remote error %d at %s, unlink bulk buffer in case peer didn't initiate bulk transfer\n" , +CWARN ( +"Remote error %d at %s, unlink bulk buffer in case peer didn't initiate bulk transfer\n" , reply->msg_body.reply.status,libcfs_id2str (rpc->crpc_dest));LNetMDUnlink (rpc->crpc_bulk.bk_mdh);
@@ -1336,7 +1336,6 @@ srpc_abort_rpc(srpc_client_rpc_t *rpc, int why) rpc->crpc_aborted =1 ; rpc->crpc_status = why;swi_schedule_workitem (&rpc->crpc_wi); -return ; }/* called with rpc->crpc_lock held */
@@ -1352,7 +1351,6 @@ srpc_post_rpc(srpc_client_rpc_t *rpc)srpc_add_client_rpc_timer (rpc);swi_schedule_workitem (&rpc->crpc_wi); -return ; }
@@ -1440,11 +1438,13 @@ srpc_lnet_ev_handler(lnet_event_t *ev)if (rpcev != &crpc->crpc_reqstev && rpcev != &crpc->crpc_replyev && rpcev != &crpc->crpc_bulkev) { -CERROR ("rpcev %p, crpc %p, reqstev %p, replyev %p, bulkev %p\n" , +CERROR ( +"rpcev %p, crpc %p, reqstev %p, replyev %p, bulkev %p\n" , rpcev, crpc, &crpc->crpc_reqstev, &crpc->crpc_replyev, &crpc->crpc_bulkev);CERROR ("Bad event: status %d, type %d, lnet %d\n" , - rpcev->ev_status, rpcev->ev_type, rpcev->ev_lnet); + rpcev->ev_status, rpcev->ev_type, + rpcev->ev_lnet);LBUG (); }
@@ -1511,7 +1511,8 @@ srpc_lnet_ev_handler(lnet_event_t *ev) msg->msg_type != __swab32(type)) || (msg->msg_magic != SRPC_MSG_MAGIC && msg->msg_magic != __swab32(SRPC_MSG_MAGIC))) { -CERROR ("Dropping RPC (%s) from %s: status %d mlength %d type %u magic %u.\n" , +CERROR ( +"Dropping RPC (%s) from %s: status %d mlength %d type %u magic %u.\n" , sv->sv_name,libcfs_id2str (ev->initiator), ev->status, ev->mlength, msg->msg_type, msg->msg_magic);
@@ -1668,6 +1669,4 @@ srpc_shutdown(void)case SRPC_STATE_NI_INIT :LNetNIFini (); } - -return ; }
drivers/staging/lustre/lnet/selftest/selftest.h +27 -31
124 lines not on this page · raw message
drivers/staging/lustre/lnet/selftest/timer.h +1 -1
@@ -41,7 +41,7 @@typedef struct {struct list_head stt_list;unsigned long stt_expires; -void (*stt_func) (void *); +void (*stt_func)(void *);void *stt_data; }stt_timer_t ;
Signature · 1 line
1.7.1
Re: [PATCH 13/13] staging: lustre: lnet: selftest: checkpatch.pl fixes
Quoted 2 lines · Mike Shuey
Cleaning up more checkpatch.pl issues.
One thing per patch. Better changelogs. Yada yada yada.
regards,
dan carpenter
Quoted 2 lines · Mike Shuey
This patch series cleans up code in staging/lustre/lnet - mostly spacing and dead function cleanup. Should apply against linux-next 20150518.
Why are you sending a v4 of this? We don't actually enjoy reviewing the same patchset over and over...
Update: I have investigated and it is because you add a few new patches to this set which were not in the original. Just assume that the original patchset will be merge and send the additional patches as a new set.
Also since no one replied to the v3 patchset and Greg has a 5000 patches in between v3 and v4 he will not seen v4 until days after he has applied v3 so it causes confusion.
Also you sent a v5 of this patchset but without a v5 label...
regards,
dan carpenter
v4 cover staging: lustre: lnet: code cleanups
I can definitely clean up the issues you (and others) have raised, and will work on breaking up the larger changes into smaller, topic-based sets as well. I could use some instruction on how to proceed, though...
I presume in this case I should've flagged this series as an RFC, and started to advertise a merge-able patch when most of the feedback was resolved (and not added additional cleanups to the series already under review). What do I do with the cleanups in the present case - re-label them as an RFC, repost all patches for comment (including the things added in what I've labelled v4), and send a final patch series when all comments are resolved? Or break them up into the previous PATCH v3 set, which had no comments, plus a second series tagged RFC (at least until I've got a sense of appropriate cleanup and granularity)?
Also, in the future, at what point is it safe to assume a set of patches will be merged? And how do I indicate dependencies between series of patches? This last is fairly important to me, given the overlaps with some of James' work; we're beginning to coordinate via email, but I'd like to find out the general expectation here (and hopefully avoid this sort of faux pas going forward).
Many thanks for your continued feedback and advice, Dan.
--
Mike Shuey
Quoted 12 lines · Dan Carpenter
Quoted 2 lines · Mike Shuey
This patch series cleans up code in staging/lustre/lnet - mostly spacing and dead function cleanup. Should apply against linux-next 20150518.
Why are you sending a v4 of this? We don't actually enjoy reviewing the same patchset over and over...
Update: I have investigated and it is because you add a few new patches to this set which were not in the original. Just assume that the original patchset will be merge and send the additional patches as a new set.
Quoted 10 lines
Also since no one replied to the v3 patchset and Greg has a 5000 patches in between v3 and v4 he will not seen v4 until days after he has applied v3 so it causes confusion.
Also you sent a v5 of this patchset but without a v5 label...
regards,
dan carpenter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20150522/6dcc1c28/attachment.htm>
We would have applied the v3 patchset but now I don't know because we're up to v5. We can't apply v5 because there are problems with it. No one responded to v3 so Greg still might apply it or he might find these email threads too scrambled and delete everything and ask for a resend.
It's pretty messed up so just wait for Greg to get to it before sending more patches?
Basically you should only send patches which you assume will be applied. If no one responds after 3 days then probably that means everyone from the peanut gallery (Me, Sudip, Joe, the lustre devs), we don't have an issue. Then Greg does the last review (2-3 weeks later perhaps). But if it makes it past all the other reviews then generally Greg also will be ok with it.
Greg applies patches in first come, first applied order. If they don't apply then you have to redo it. He doesn't invest a lot of time into figuring out why. So you have to coordinate with the other devs, it's up to you how you do that.
regards,
dan carpenter
Hm, that's unfortunate - but my own fault for lack of proper etiquette. I'll give this a week or two to settle, and build up patches against other parts of lustre in the meantime.
BTW, you keep mentioning a v5 that I sent. Where is that, exactly? The last round of patches I sent I've kept labeled as "PATCH v4", and I only hit git send-email once. Could you forward me something from this v5 series, so I could see if anything is amiss on my end? --
Mike Shuey
Quoted 23 lines · Dan Carpenter
We would have applied the v3 patchset but now I don't know because we're up to v5. We can't apply v5 because there are problems with it. No one responded to v3 so Greg still might apply it or he might find these email threads too scrambled and delete everything and ask for a resend.
It's pretty messed up so just wait for Greg to get to it before sending more patches?
Basically you should only send patches which you assume will be applied. If no one responds after 3 days then probably that means everyone from the peanut gallery (Me, Sudip, Joe, the lustre devs), we don't have an issue. Then Greg does the last review (2-3 weeks later perhaps). But if it makes it past all the other reviews then generally Greg also will be ok with it.
Greg applies patches in first come, first applied order. If they don't apply then you have to redo it. He doesn't invest a lot of time into figuring out why. So you have to coordinate with the other devs, it's up to you how you do that.
regards,
dan carpenter
Quoted 4 lines · Michael Shuey
BTW, you keep mentioning a v5 that I sent. Where is that, exactly? The last round of patches I sent I've kept labeled as "PATCH v4", and I only hit git send-email once. Could you forward me something from this v5 series, so I could see if anything is amiss on my end?
I think it was not a v5. But what happened is in your series some of the patches were marked as v4 and some were not having any version so it appeared like a fresh series again. Like 1/13,2/13,3/13 has v4 but the others donot have a version.
regards
sudip
Ah - that explains it. I added additional files to the series, but simply re-applied the original round of patches. They would've not been tagged as v4, while the patches pertaining to the newly-modified files had v4 in the subject.
I'll be more thorough in future patch revisions. Thanks for the explanation. --
Mike Shuey
Quoted 13 lines · Sudip Mukherjee
Quoted 4 lines · Michael Shuey
BTW, you keep mentioning a v5 that I sent. Where is that, exactly? The last round of patches I sent I've kept labeled as "PATCH v4", and I only hit git send-email once. Could you forward me something from this v5 series, so I could see if anything is amiss on my end?
I think it was not a v5. But what happened is in your series some of the patches were marked as v4 and some were not having any version so it appeared like a fresh series again. Like 1/13,2/13,3/13 has v4 but the others donot have a version.
regards
sudip
Greg KH
maintainerA: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
Quoted 4 lines · Michael Shuey
Ah - that explains it. I added additional files to the series, but simply re-applied the original round of patches. They would've not been tagged as v4, while the patches pertaining to the newly-modified files had v4 in the subject.
The way you sent these is a mess, I can't sort by subject and apply them properly.
Either put the v4 at the front, for all patches, like this:
[PATCH v4 01/13] or at the end of the number: [PATCH 01/13 v4]
so I can sort them.
Please fix up and resend this series, I've dropped it from my queue.
thanks,
greg k-h