First set of Intel branch merger for libcfs/lnet
cover First set of Intel branch merger for libcfs/lnet
In reply to a message not in the archiveThis is the first set of patches that are current in the Intel branch which are apart of the effort to cleanup LNet/libcfs.
James Simmons (3):
staging:lustre: remove tcpip abstraction from libcfs staging:lustre: remove kernel defines in userland headers staging:lustre: cleanup libcfs lock handling
.../staging/lustre/include/linux/libcfs/libcfs.h | 21 - .../lustre/include/linux/libcfs/libcfs_private.h | 51 -- .../lustre/include/linux/lnet/api-support.h | 44 -- drivers/staging/lustre/include/linux/lnet/api.h | 51 +- .../staging/lustre/include/linux/lnet/lib-lnet.h | 264 ++------- .../staging/lustre/include/linux/lnet/lib-types.h | 649 +++++++++----------- .../lustre/include/linux/lnet/linux/api-support.h | 42 -- .../lustre/include/linux/lnet/linux/lib-lnet.h | 71 --- .../lustre/include/linux/lnet/linux/lib-types.h | 45 -- .../staging/lustre/include/linux/lnet/linux/lnet.h | 56 -- .../lustre/include/linux/lnet/lnet-sysctl.h | 49 -- drivers/staging/lustre/include/linux/lnet/lnet.h | 11 +- .../staging/lustre/include/linux/lnet/lnetctl.h | 36 +- drivers/staging/lustre/include/linux/lnet/lnetst.h | 665 ++++++++++++-------- drivers/staging/lustre/include/linux/lnet/nidstr.h | 73 +++ drivers/staging/lustre/include/linux/lnet/ptllnd.h | 93 --- .../lustre/include/linux/lnet/ptllnd_wire.h | 119 ---- .../staging/lustre/include/linux/lnet/socklnd.h | 91 ++-- drivers/staging/lustre/include/linux/lnet/types.h | 266 +++++++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 9 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 16 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 3 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 7 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 21 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 30 +- drivers/staging/lustre/lnet/lnet/Makefile | 7 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 47 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 100 +--- drivers/staging/lustre/lnet/lnet/config.c | 21 +- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 6 +- drivers/staging/lustre/lnet/lnet/lib-me.c | 24 +- drivers/staging/lustre/lnet/lnet/lib-msg.c | 22 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 616 ++++++++++++++++++ drivers/staging/lustre/lnet/lnet/module.c | 4 +- drivers/staging/lustre/lnet/lnet/router.c | 145 ----- drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- drivers/staging/lustre/lustre/libcfs/Makefile | 1 - drivers/staging/lustre/lustre/libcfs/fail.c | 2 +- .../lustre/lustre/libcfs/linux/linux-tcpip.c | 623 ------------------ .../lustre/lustre/libcfs/linux/linux-tracefile.c | 4 +- drivers/staging/lustre/lustre/libcfs/module.c | 11 +- drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +- 44 files changed, 1856 insertions(+), 2572 deletions(-) delete mode 100644 drivers/staging/lustre/include/linux/lnet/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-types.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h create mode 100644 drivers/staging/lustre/include/linux/lnet/nidstr.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
PATCH 1/3 staging:lustre: remove tcpip abstraction from libcfs
In reply to a message not in the archiveFrom: James Simmons <[email protected]>
Since libcfs no longer builds for user land we can move the TCPIP abstraction that exist to the LNET layer which is the only place that uses it. Also the migrated code will use native linux kernel APIs directly instead of with wrappers.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13760
--- .../staging/lustre/include/linux/libcfs/libcfs.h | 17 - .../staging/lustre/include/linux/lnet/lib-lnet.h | 15 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 16 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 7 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 17 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 30 +- drivers/staging/lustre/lnet/lnet/Makefile | 7 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 43 +- drivers/staging/lustre/lnet/lnet/config.c | 21 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 616 +++++++++++++++++++ drivers/staging/lustre/lustre/libcfs/Makefile | 1 - .../lustre/lustre/libcfs/linux/linux-tcpip.c | 623 -------------------- 14 files changed, 701 insertions(+), 716 deletions(-) create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -17
@@ -88,23 +88,6 @@ static inline int __is_po2(unsigned long long val)int libcfs_arch_init (void );void libcfs_arch_cleanup (void ); -/* libcfs tcpip */ -int libcfs_ipif_query (char *name,int *up,__u32 *ip,__u32 *mask); -int libcfs_ipif_enumerate (char ***names); -void libcfs_ipif_free_enumeration (char **names,int n); -int libcfs_sock_listen (struct socket **sockp,__u32 ip,int port,int backlog); -int libcfs_sock_accept (struct socket **newsockp,struct socket *sock); -void libcfs_sock_abort_accept (struct socket *sock); -int libcfs_sock_connect (struct socket **sockp,int *fatal, -__u32 local_ip,int local_port, -__u32 peer_ip,int peer_port); -int libcfs_sock_setbuf (struct socket *socket,int txbufsize,int rxbufsize); -int libcfs_sock_getbuf (struct socket *socket,int *txbufsize,int *rxbufsize); -int libcfs_sock_getaddr (struct socket *socket,int remote,__u32 *ip,int *port); -int libcfs_sock_write (struct socket *sock,void *buffer,int nob,int timeout); -int libcfs_sock_read (struct socket *sock,void *buffer,int nob,int timeout); -void libcfs_sock_release (struct socket *sock); -/* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512#define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +15 -0
@@ -846,6 +846,21 @@ int lnet_acceptor_port(void);int lnet_acceptor_start (void );void lnet_acceptor_stop (void ); +int lnet_ipif_query (char *name,int *up,__u32 *ip,__u32 *mask); +int lnet_ipif_enumerate (char ***names); +void lnet_ipif_free_enumeration (char **names,int n); +int lnet_sock_setbuf (struct socket *socket,int txbufsize,int rxbufsize); +int lnet_sock_getbuf (struct socket *socket,int *txbufsize,int *rxbufsize); +int lnet_sock_getaddr (struct socket *socket,bool remote,__u32 *ip,int *port); +int lnet_sock_write (struct socket *sock,void *buffer,int nob,int timeout); +int lnet_sock_read (struct socket *sock,void *buffer,int nob,int timeout); + +int lnet_sock_listen (struct socket **sockp,__u32 ip,int port,int backlog); +int lnet_sock_accept (struct socket **newsockp,struct socket *sock); +int lnet_sock_connect (struct socket **sockp,int *fatal, +__u32 local_ip,int local_port, +__u32 peer_ip,int peer_port); +void lnet_get_tunables (void );int lnet_peers_start_down (void );int lnet_peer_buffer_credits (lnet_ni_t *ni);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
@@ -2620,7 +2620,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname)int up;int rc; - rc =libcfs_ipif_query (ifname, &up, &ip, &netmask); + rc =lnet_ipif_query (ifname, &up, &ip, &netmask);if (rc !=0 ) {CERROR ("Can't query IPoIB interface %s: %d\n" , ifname, rc);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +8 -8
@@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)__u32 peer_ip;int peer_port; - rc =libcfs_sock_getaddr (sock,1 , &peer_ip, &peer_port); + rc =lnet_sock_getaddr (sock,1 , &peer_ip, &peer_port);LASSERT (rc ==0 );/* we succeeded before */ LIBCFS_ALLOC (cr,sizeof (*cr));
@@ -1378,15 +1378,15 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,ksocknal_txlist_done (ni, &zombies,1 );ksocknal_peer_decref (peer); - failed_1: +failed_1:if (hello !=NULL )LIBCFS_FREE (hello, offsetof(ksock_hello_msg_t , kshm_ips[LNET_MAX_INTERFACES]));LIBCFS_FREE (conn,sizeof (*conn)); - failed_0: -libcfs_sock_release (sock); +failed_0: +sock_release (sock);return rc; }
@@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)int rc;int n; - n =libcfs_ipif_enumerate (&names); + n =lnet_ipif_enumerate (&names);if (n <=0 ) {CERROR ("Can't enumerate interfaces: %d\n" , n);return n;
@@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)if (!strcmp (names[i],"lo" ))/* skip the loopback IF */ continue ; - rc =libcfs_ipif_query (names[i], &up, &ip, &mask); + rc =lnet_ipif_query (names[i], &up, &ip, &mask);if (rc !=0 ) {CWARN ("Can't get interface %s info: %d\n" , names[i], rc);
@@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) j++; } -libcfs_ipif_free_enumeration (names, n); +lnet_ipif_free_enumeration (names, n);if (j ==0 )CERROR ("Can't find any usable interfaces\n" );
@@ -2796,7 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni)if (ni->ni_interfaces[i] ==NULL )break ; - rc =libcfs_ipif_query ( + rc =lnet_ipif_query ( ni->ni_interfaces[i], &up, &net->ksnn_interfaces[i].ksni_ipaddr, &net->ksnn_interfaces[i].ksni_netmask);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +1 -1
@@ -453,7 +453,7 @@ ksocknal_connsock_decref(ksock_conn_t *conn)LASSERT (atomic_read (&conn->ksnc_sock_refcount) >0 );if (atomic_dec_and_test (&conn->ksnc_sock_refcount)) {LASSERT (conn->ksnc_closing); -libcfs_sock_release (conn->ksnc_sock); +sock_release (conn->ksnc_sock); conn->ksnc_sock =NULL ;ksocknal_finalize_zcreq (conn); }
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +4 -3
@@ -1707,7 +1707,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, timeout = active ? *ksocknal_tunables.ksnd_timeout :lnet_acceptor_timeout (); - rc =libcfs_sock_read (sock, &hello->kshm_magic,sizeof (hello->kshm_magic), timeout); + rc =lnet_sock_read (sock, &hello->kshm_magic, +sizeof (hello->kshm_magic), timeout);if (rc !=0 ) {CERROR ("Error %d reading HELLO from %pI4h\n" , rc, &conn->ksnc_ipaddr);
@@ -1726,8 +1727,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,return -EPROTO ; } - rc =libcfs_sock_read (sock, &hello->kshm_version, -sizeof (hello->kshm_version), timeout); + rc =lnet_sock_read (sock, &hello->kshm_version, +sizeof (hello->kshm_version), timeout);if (rc !=0 ) {CERROR ("Error %d reading HELLO from %pI4h\n" , rc, &conn->ksnc_ipaddr);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +8 -9
@@ -39,9 +39,9 @@int ksocknal_lib_get_conn_addrs (ksock_conn_t *conn) { -int rc =libcfs_sock_getaddr (conn->ksnc_sock,1 , - &conn->ksnc_ipaddr, - &conn->ksnc_port); +int rc =lnet_sock_getaddr (conn->ksnc_sock,1 , + &conn->ksnc_ipaddr, + &conn->ksnc_port);/* Didn't need the {get,put}connsock dance to deref ksnc_sock... */ LASSERT (!conn->ksnc_closing);
@@ -51,8 +51,8 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)return rc; } - rc =libcfs_sock_getaddr (conn->ksnc_sock,0 , - &conn->ksnc_myipaddr,NULL ); + rc =lnet_sock_getaddr (conn->ksnc_sock,0 , + &conn->ksnc_myipaddr,NULL );if (rc !=0 ) {CERROR ("Error %d getting sock local IP\n" , rc);return rc;
@@ -436,7 +436,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *return -ESHUTDOWN ; } - rc =libcfs_sock_getbuf (sock, txmem, rxmem); + rc =lnet_sock_getbuf (sock, txmem, rxmem);if (rc ==0 ) { len =sizeof (*nagle); rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY,
@@ -498,9 +498,8 @@ ksocknal_lib_setup_sock(struct socket *sock) } } - rc =libcfs_sock_setbuf (sock, - *ksocknal_tunables.ksnd_tx_buffer_size, - *ksocknal_tunables.ksnd_rx_buffer_size); + rc =lnet_sock_setbuf (sock, *ksocknal_tunables.ksnd_tx_buffer_size, + *ksocknal_tunables.ksnd_rx_buffer_size);if (rc !=0 ) { CERROR("Can't set buffer tx %d, rx %d buffers: %d\n", *ksocknal_tunables.ksnd_tx_buffer_size,
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +15 -15
@@ -495,8 +495,8 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) hdr->msg.hello.type =cpu_to_le32 (hello->kshm_ctype); hdr->msg.hello.incarnation =cpu_to_le64 (hello->kshm_src_incarnation); - rc =libcfs_sock_write (sock, hdr,sizeof (*hdr), -lnet_acceptor_timeout ()); + rc =lnet_sock_write (sock, hdr,sizeof (*hdr), +lnet_acceptor_timeout ());if (rc !=0 ) { CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n",
@@ -511,9 +511,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello) hello->kshm_ips[i] =__cpu_to_le32 (hello->kshm_ips[i]); } - rc =libcfs_sock_write (sock, hello->kshm_ips, - hello->kshm_nips *sizeof (__u32), -lnet_acceptor_timeout ()); + rc =lnet_sock_write (sock, hello->kshm_ips, + hello->kshm_nips *sizeof (__u32), +lnet_acceptor_timeout ());if (rc !=0 ) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", rc, hello->kshm_nips,
@@ -544,8 +544,8 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello)LNET_UNLOCK (); } - rc =libcfs_sock_write (sock, hello, offsetof(ksock_hello_msg_t , kshm_ips), -lnet_acceptor_timeout ()); + rc =lnet_sock_write (sock, hello, offsetof(ksock_hello_msg_t , kshm_ips), +lnet_acceptor_timeout ());if (rc !=0 ) { CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n",
@@ -556,9 +556,9 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello)if (hello->kshm_nips ==0 )return 0 ; - rc =libcfs_sock_write (sock, hello->kshm_ips, - hello->kshm_nips *sizeof (__u32), -lnet_acceptor_timeout ()); + rc =lnet_sock_write (sock, hello->kshm_ips, + hello->kshm_nips *sizeof (__u32), +lnet_acceptor_timeout ());if (rc !=0 ) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", rc, hello->kshm_nips,
@@ -583,7 +583,7 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,return -ENOMEM ; } - rc =libcfs_sock_read (sock, &hdr->src_nid, + rc =lnet_sock_read (sock, &hdr->src_nid,sizeof (*hdr) - offsetof(lnet_hdr_t , src_nid), timeout);if (rc !=0 ) {
@@ -619,7 +619,7 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,if (hello->kshm_nips ==0 ) goto out; - rc =libcfs_sock_read (sock, hello->kshm_ips, + rc =lnet_sock_read (sock, hello->kshm_ips, hello->kshm_nips *sizeof (__u32), timeout);if (rc !=0 ) { CERROR("Error %d reading IPs from ip %pI4h\n",
@@ -656,7 +656,7 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeoutelse conn->ksnc_flip =1 ; - rc =libcfs_sock_read (sock, &hello->kshm_src_nid, + rc =lnet_sock_read (sock, &hello->kshm_src_nid, offsetof(ksock_hello_msg_t , kshm_ips) - offsetof(ksock_hello_msg_t , kshm_src_nid), timeout);
@@ -687,8 +687,8 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeoutif (hello->kshm_nips ==0 )return 0 ; - rc =libcfs_sock_read (sock, hello->kshm_ips, - hello->kshm_nips *sizeof (__u32), timeout); + rc =lnet_sock_read (sock, hello->kshm_ips, + hello->kshm_nips *sizeof (__u32), timeout);if (rc !=0 ) {CERROR ("Error %d reading IPs from ip %pI4h\n" , rc, &conn->ksnc_ipaddr);
drivers/staging/lustre/lnet/lnet/Makefile +4 -3
@@ -1,5 +1,6 @@ obj-$(CONFIG_LNET) += lnet.o -lnet-y := api-ni.o config.o lib-me.o lib-msg.o lib-eq.o \ - lib-md.o lib-ptl.o lib-move.o module.o lo.o router.o \ - router_proc.o acceptor.o peer.o +lnet-y := api-ni.o config.o \ + lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o \ + lib-socket.o lib-move.o module.o lo.o \ + router.o router_proc.o acceptor.o peer.o
drivers/staging/lustre/lnet/lnet/acceptor.c +20 -23
133 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/config.c +9 -12
@@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)__u32 *ipaddrs2;int nip;char **ifnames; -int nif =libcfs_ipif_enumerate (&ifnames); +int nif =lnet_ipif_enumerate (&ifnames);int i;int rc;
@@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)LIBCFS_ALLOC (ipaddrs, nif *sizeof (*ipaddrs));if (ipaddrs ==NULL ) {CERROR ("Can't allocate ipaddrs[%d]\n" , nif); -libcfs_ipif_free_enumeration (ifnames, nif); +lnet_ipif_free_enumeration (ifnames, nif);return -ENOMEM ; }
@@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)if (!strcmp (ifnames[i],"lo" ))continue ; - rc =libcfs_ipif_query (ifnames[i], &up, - &ipaddrs[nip], &netmask); + rc =lnet_ipif_query (ifnames[i], &up, &ipaddrs[nip], &netmask);if (rc !=0 ) {CWARN ("Can't query interface %s: %d\n" , ifnames[i], rc);
@@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) nip++; } -libcfs_ipif_free_enumeration (ifnames, nif); +lnet_ipif_free_enumeration (ifnames, nif);if (nip == nif) { *ipaddrsp = ipaddrs;
@@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)return -EPERM ; } - rc =libcfs_ipif_query (ni->ni_interfaces[0 ], - &up, &ip, &netmask); + rc =lnet_ipif_query (ni->ni_interfaces[0 ], &up, &ip, &netmask);if (rc !=0 ) {CERROR ("Net %s can't query interface %s: %d\n" ,libcfs_net2str (net), ni->ni_interfaces[0 ], rc);
@@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)return 0 ; } - n =libcfs_ipif_enumerate (&names); + n =lnet_ipif_enumerate (&names);if (n <=0 ) {CERROR ("Net %s can't enumerate interfaces: %d\n" ,libcfs_net2str (net), n);
@@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)if (!strcmp (names[i],"lo" ))/* skip the loopback IF */ continue ; - rc =libcfs_ipif_query (names[i], &up, &ip, &netmask); - + rc =lnet_ipif_query (names[i], &up, &ip, &netmask);if (rc !=0 ) {CWARN ("Net %s can't query interface %s: %d\n" ,libcfs_net2str (net), names[i], rc);
@@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)continue ; } -libcfs_ipif_free_enumeration (names, n); +lnet_ipif_free_enumeration (names, n); ni->ni_nid =LNET_MKNID (net, ip);return 0 ; }CERROR ("Net %s can't find any interfaces\n" ,libcfs_net2str (net)); -libcfs_ipif_free_enumeration (names, n); +lnet_ipif_free_enumeration (names, n);return -ENOENT ; }EXPORT_SYMBOL (lnet_set_ip_niaddr);
drivers/staging/lustre/lnet/lnet/lib-socket.c new file +616 -0
616 lines not on this page · raw message
drivers/staging/lustre/lustre/libcfs/Makefile +0 -1
@@ -2,7 +2,6 @@ obj-$(CONFIG_LUSTRE_FS) += libcfs.o libcfs-linux-objs := linux-tracefile.o linux-debug.o libcfs-linux-objs += linux-prim.o linux-cpu.o -libcfs-linux-objs += linux-tcpip.o libcfs-linux-objs += linux-curproc.o libcfs-linux-objs += linux-module.o libcfs-linux-objs += linux-crypto.o
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c deleted +0 -623
623 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 2/3 staging:lustre: remove kernel defines in userland headers
In reply to a message not in the archiveFrom: James Simmons <[email protected]>
Currently the lnet headers used for user land applications contain various kernel definations. This is due to the fact libcfs contains kernel wrappers for user land which will be going away. This patch sorted the header data so all kernel containing structures are moved out of headers that user land will use.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13792
--- .../staging/lustre/include/linux/libcfs/libcfs.h | 4 - .../lustre/include/linux/libcfs/libcfs_private.h | 51 -- .../lustre/include/linux/lnet/api-support.h | 44 -- drivers/staging/lustre/include/linux/lnet/api.h | 51 +- .../staging/lustre/include/linux/lnet/lib-lnet.h | 249 +------- .../staging/lustre/include/linux/lnet/lib-types.h | 649 +++++++++----------- .../lustre/include/linux/lnet/linux/api-support.h | 42 -- .../lustre/include/linux/lnet/linux/lib-lnet.h | 71 --- .../lustre/include/linux/lnet/linux/lib-types.h | 45 -- .../staging/lustre/include/linux/lnet/linux/lnet.h | 56 -- .../lustre/include/linux/lnet/lnet-sysctl.h | 49 -- drivers/staging/lustre/include/linux/lnet/lnet.h | 11 +- .../staging/lustre/include/linux/lnet/lnetctl.h | 36 +- drivers/staging/lustre/include/linux/lnet/lnetst.h | 665 ++++++++++++-------- drivers/staging/lustre/include/linux/lnet/nidstr.h | 73 +++ drivers/staging/lustre/include/linux/lnet/ptllnd.h | 93 --- .../lustre/include/linux/lnet/ptllnd_wire.h | 119 ---- .../staging/lustre/include/linux/lnet/socklnd.h | 91 ++-- drivers/staging/lustre/include/linux/lnet/types.h | 266 +++++++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 9 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 1 - .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 4 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 - drivers/staging/lustre/lnet/lnet/api-ni.c | 100 +--- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 6 +- drivers/staging/lustre/lnet/lnet/lib-me.c | 24 +- drivers/staging/lustre/lnet/lnet/lib-msg.c | 22 +- drivers/staging/lustre/lnet/lnet/module.c | 4 +- drivers/staging/lustre/lnet/lnet/router.c | 145 ----- drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- 32 files changed, 1149 insertions(+), 1841 deletions(-) delete mode 100644 drivers/staging/lustre/include/linux/lnet/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/api-support.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-types.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lnet.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h create mode 100644 drivers/staging/lustre/include/linux/lnet/nidstr.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd.h delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -4
@@ -46,10 +46,6 @@#include "curproc.h" -#ifndef offsetof -# define offsetof (typ, memb) ((long)(long_ptr_t)((char *)&(((typ *)0)->memb))) -#endif -#ifndef ARRAY_SIZE #define ARRAY_SIZE (a) ((sizeof(a)) / (sizeof((a)[0])))#endif
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +0 -51
61 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/api-support.h deleted +0 -44
44 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/api.h +23 -28
141 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +22 -227
365 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/lib-types.h +298 -351
874 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/linux/api-support.h deleted +0 -42
42 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h deleted +0 -71
71 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/linux/lib-types.h deleted +0 -45
45 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/linux/lnet.h deleted +0 -56
56 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h deleted +0 -49
49 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/lnet.h +4 -7
@@ -26,10 +26,12 @@/* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. +* +* Copyright (c) 2014, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. +* Lustre is a trademark of Seagate, Inc. */ #ifndef __LNET_H__
@@ -40,12 +42,7 @@* * User application interface file */ -#include "linux/lnet.h" -#include "types.h" -#include "api.h" - -#define LNET_NIDSTR_COUNT 1024/* # of nidstrings */ -#define LNET_NIDSTR_SIZE 32/* size of each one (see below for usage) */ +#include "nidstr.h" #endif
drivers/staging/lustre/include/linux/lnet/lnetctl.h +19 -17
@@ -14,27 +14,29 @@* along with Portals; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * -* header for libptlctl.a +* header for lnet ioctl */ -#ifndef _PTLCTL_H_ -#define _PTLCTL_H_ +/* +* Copyright (c) 2014, Intel Corporation. +*/ +#ifndef _LNETCTL_H_ +#define _LNETCTL_H_ -#include "../libcfs/libcfs.h" #include "types.h" -#define LNET_DEV_ID 0 -#define LNET_DEV_PATH "/dev/lnet" -#define LNET_DEV_MAJOR 10 -#define LNET_DEV_MINOR 240 -#define OBD_DEV_ID 1 -#define OBD_DEV_NAME "obd" -#define OBD_DEV_PATH "/dev/" OBD_DEV_NAME -#define OBD_DEV_MAJOR 10 -#define OBD_DEV_MINOR 241 -#define SMFS_DEV_ID 2 -#define SMFS_DEV_PATH "/dev/snapdev" -#define SMFS_DEV_MAJOR 10 -#define SMFS_DEV_MINOR 242 +#define LNET_DEV_ID 0 +#define LNET_DEV_PATH "/dev/lnet" +#define LNET_DEV_MAJOR 10 +#define LNET_DEV_MINOR 240 +#define OBD_DEV_ID 1 +#define OBD_DEV_NAME "obd" +#define OBD_DEV_PATH "/dev/" OBD_DEV_NAME +#define OBD_DEV_MAJOR 10 +#define OBD_DEV_MINOR 241 +#define SMFS_DEV_ID 2 +#define SMFS_DEV_PATH "/dev/snapdev" +#define SMFS_DEV_MAJOR 10 +#define SMFS_DEV_MINOR 242int ptl_initialize (int argc,char **argv);int jt_ptl_network (int argc,char **argv);
drivers/staging/lustre/include/linux/lnet/lnetst.h +417 -248
788 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/nidstr.h new file +73 -0
73 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/ptllnd.h deleted +0 -93
93 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h deleted +0 -119
119 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/socklnd.h +47 -44
97 lines not on this page · raw message
drivers/staging/lustre/include/linux/lnet/types.h +211 -55
266 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +4 -5
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -1
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/lnet/acceptor.c +0 -2
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/lnet/api-ni.c +15 -85
100 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-eq.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/lnet/lib-md.c +3 -3
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/lnet/lib-me.c +3 -21
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/lnet/lib-msg.c +2 -20
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/lnet/module.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/lnet/router.c +0 -145
145 lines not on this page · raw message
drivers/staging/lustre/lustre/include/lustre_net.h +2 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.1
Part of the diff is not shown here. View the raw message.
PATCH 3/3 staging:lustre: cleanup libcfs lock handling
In reply to a message not in the archivePreviously with libcfs being built for user land and kernel space wrappers were created to transparently handle locking. Now that user land support has been removed we delete all those locking wrappers with this patch. Many of those changes landed upstream but some nice cleanups still remain that are pushed in this patch.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13793
--- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +- drivers/staging/lustre/lustre/libcfs/fail.c | 2 +- .../lustre/lustre/libcfs/linux/linux-tracefile.c | 4 +--- drivers/staging/lustre/lustre/libcfs/module.c | 11 ++--------- drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +- 5 files changed, 6 insertions(+), 15 deletions(-)
drivers/staging/lustre/lnet/lnet/acceptor.c +1 -1
@@ -35,9 +35,9 @@*/ #define DEBUG_SUBSYSTEM S_LNET +#include <linux/completion.h> #include "../../include/linux/lnet/lib-lnet.h" -static int accept_port =988 ;static int accept_backlog =127 ;static int accept_timeout =5 ;
drivers/staging/lustre/lustre/libcfs/fail.c +1 -1
@@ -41,7 +41,7 @@ EXPORT_SYMBOL(cfs_fail_loc);unsigned int cfs_fail_val =0 ;EXPORT_SYMBOL (cfs_fail_val); -wait_queue_head_t cfs_race_waitq; +DECLARE_WAIT_QUEUE_HEAD (cfs_race_waitq);EXPORT_SYMBOL (cfs_race_waitq);int cfs_race_state;
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +1 -3
@@ -49,7 +49,7 @@ static unsigned int pages_factor[CFS_TCD_TYPE_MAX] = {char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ]; -struct rw_semaphore cfs_tracefile_sem; +static DECLARE_RWSEM (cfs_tracefile_sem);int cfs_tracefile_init_arch (void ) {
@@ -57,8 +57,6 @@ int cfs_tracefile_init_arch(void)int j;struct cfs_trace_cpu_data *tcd; -init_rwsem (&cfs_tracefile_sem); -/* initialize trace_data */ memset (cfs_trace_data,0 ,sizeof (cfs_trace_data));for (i =0 ; i <CFS_TCD_TYPE_MAX ; i++) {
drivers/staging/lustre/lustre/libcfs/module.c +2 -9
@@ -67,8 +67,6 @@ MODULE_DESCRIPTION("Portals v3.1");MODULE_LICENSE ("GPL" );extern struct miscdevice libcfs_dev; -extern struct rw_semaphore cfs_tracefile_sem; -extern struct mutex cfs_trace_thread_mutex;extern struct cfs_wi_sched *cfs_sched_rehash;extern void libcfs_init_nidstrings (void );
@@ -249,8 +247,8 @@ static int libcfs_psdev_release(unsigned long flags, void *args)return 0 ; } -static struct rw_semaphore ioctl_list_sem; -static struct list_head ioctl_list; +static DECLARE_RWSEM (ioctl_list_sem); +static LIST_HEAD (ioctl_list);int libcfs_register_ioctl (struct libcfs_ioctl_handler *hand) {
@@ -393,11 +391,6 @@ static int init_libcfs_module(void)libcfs_arch_init ();libcfs_init_nidstrings (); -init_rwsem (&cfs_tracefile_sem); -mutex_init (&cfs_trace_thread_mutex); -init_rwsem (&ioctl_list_sem); -INIT_LIST_HEAD (&ioctl_list); -init_waitqueue_head (&cfs_race_waitq); rc =libcfs_debug_init (5 *1024 *1024 );if (rc <0 ) {
drivers/staging/lustre/lustre/libcfs/tracefile.c +1 -1
@@ -52,7 +52,7 @@ union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cachelinechar cfs_tracefile[TRACEFILE_NAME_SIZE ];long long cfs_tracefile_size =CFS_TRACEFILE_SIZE ;static struct tracefiled_ctl trace_tctl; -struct mutex cfs_trace_thread_mutex; +static DEFINE_MUTEX (cfs_trace_thread_mutex);static int thread_running;static atomic_t cfs_tage_allocated =ATOMIC_INIT (0 );
Signature · 1 line
1.7.1
Re: [PATCH 1/3] staging:lustre: remove tcpip abstraction from libcfs
In reply to James SimmonsThis patch does a lot of stuff all at once and it is hard to review. It could easily be broken into patches which are easy to review.
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, · line 1381
Quoted 6 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +1
-1@@ -1378,15 +1378,15 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,ksocknal_txlist_done (ni, &zombies,1 );ksocknal_peer_decref (peer); - failed_1: +failed_1:
Do unrelated white space changes in a different patch. It just makes reviewing complicated to mix easy to review white space changes in with everything else.
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route, · line 1389
Quoted 10 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +2
-2if (hello !=NULL )LIBCFS_FREE (hello, offsetof(ksock_hello_msg_t , kshm_ips[LNET_MAX_INTERFACES]));LIBCFS_FREE (conn,sizeof (*conn)); - failed_0: -libcfs_sock_release (sock); +failed_0: +sock_release (sock);
Do a rename patch by itself. You can rename a bunch of functions at the same time, that's fine. Personally, you can even move the functions between files, that's also fine with me and doesn't complicate my review.
Ok in this next section we move functions around and rename them but also introduce some bad changes in the new function.
Quoted 6 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c new file +6
-0+static int +lnet_sock_ioctl (int cmd,unsigned long arg) +{ +struct file *sock_filp; +struct socket *sock; +int fd =-1 ;
drivers/staging/lustre/lnet/lnet/lib-socket.c line 78
Quoted 10 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c new file +10
-0+int rc; + + rc =sock_create (PF_INET ,SOCK_STREAM ,0 , &sock); +if (rc !=0 ) { +CERROR ("Can't create socket: %d\n" , rc); +return rc; + } + + sock_filp =sock_alloc_file (sock,0 ,NULL ); +if (!sock_filp) {
sock_alloc_file() never returns NULL, only valid pointers on success or ERR_PTRs on failue.
drivers/staging/lustre/lnet/lnet/lib-socket.c line 84
Quoted 6 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c new file +6
-0+ rc = -ENOMEM ; +sock_release (sock); + goto out; + } + + rc =kernel_sock_unlocked_ioctl (sock_filp, cmd, arg);
This is an unrelated cleanup. Do it in a different patch.
drivers/staging/lustre/lnet/lnet/lib-socket.c line 89
Quoted 5 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c new file +5
-0+ +fput (sock_filp); +out: +if (fd >=0 ) +sys_close (fd);
This is a new change as well. "fd" is always -1 so this is dead code.
drivers/staging/lustre/lnet/lnet/lib-socket.c line 76
Quoted 3 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c new file +3
-0+return rc; +} +
Here is the old function:
Quoted 6 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c deleted +0
-6-static int -libcfs_sock_ioctl (int cmd,unsigned long arg) -{ -mm_segment_t oldmm =get_fs (); -struct socket *sock; -int rc;
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c line 61
Quoted 10 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c deleted +0
-10-struct file *sock_filp; - - rc =sock_create (PF_INET ,SOCK_STREAM ,0 , &sock); -if (rc !=0 ) { -CERROR ("Can't create socket: %d\n" , rc); -return rc; - } - - sock_filp =sock_alloc_file (sock,0 ,NULL ); -if (IS_ERR (sock_filp)) {
This check was correct in the original.
Quoted 4 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c deleted +0
-4-sock_release (sock); - rc =PTR_ERR (sock_filp); - goto out; - }
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c line 75
Quoted 10 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c deleted +0
-10- -set_fs (KERNEL_DS ); -if (sock_filp->f_op->unlocked_ioctl) - rc = sock_filp->f_op->unlocked_ioctl (sock_filp, cmd, arg); -set_fs (oldmm); - -fput (sock_filp); -out: -return rc; -}
This patch has some bug fixes as well. Those should be sent as one patch per bugfix with a proper changelog.
regards,
dan carpenter
Re: [PATCH 2/3] staging:lustre: remove kernel defines in userland headers
In reply to James SimmonsThis patch seems fine but it would also be better if it were broken up into easy to review patches.
[patch 1] delete LNET_USE_LIB_FREELIST code
This is theortetically what this patch does except it does tons of other things as well.
Patches which delete whole functions, #defines or from #ifdef to #endif are normally easy to review. When there are + lines it is hard.
[patch 2] move things around (i guess)?
[patch 3] white space fixes
[patch 4] get rid of lnet_eq_free_locked() and macro friends. [patch 5] rename CamelCase functions
[patch 6] clean up lnet_msg_container_setup()
Quoted 63 lines
typedef struct
lnet_peer{drivers/staging/lustre/include/linux/lnet/lib-types.h +38
-24-struct list_head lp_hashlist;/* chain on peer hash */ -struct list_head lp_txq;/* messages blocking for tx credits */ -struct list_head lp_rtrq;/* messages blocking for router credits */ -struct list_head lp_rtr_list;/* chain on router list */ -int lp_txcredits;/* # tx credits available */ -int lp_mintxcredits;/* low water mark */ -int lp_rtrcredits;/* # router credits */ -int lp_minrtrcredits;/* low water mark */ - unsigned int lp_alive:1; /* alive/dead? */ - unsigned int lp_notify:1; /* notification outstanding? */ - unsigned int lp_notifylnd:1; /* outstanding notification for LND? */ - unsigned int lp_notifying:1; /* some thread is handling notification */ -unsigned int lp_ping_notsent;/* SEND event outstanding from ping */ -int lp_alive_count;/* # times router went dead<->alive */ -long lp_txqnob;/* bytes queued for sending */ -unsigned long lp_timestamp;/* time of last aliveness news */ -unsigned long lp_ping_timestamp;/* time of last ping attempt */ -unsigned long lp_ping_deadline;/* != 0 if ping reply expected */ -unsigned long lp_last_alive;/* when I was last alive */ -unsigned long lp_last_query;/* when lp_ni was queried last time */ -lnet_ni_t *lp_ni;/* interface peer is on */ -lnet_nid_t lp_nid;/* peer's NID */ -int lp_refcount;/* # refs */ -int lp_cpt;/* CPT this peer attached on */ +/* chain on peer hash */ +struct list_head lp_hashlist; +/* messages blocking for tx credits */ +struct list_head lp_txq; +/* messages blocking for router credits */ +struct list_head lp_rtrq; +/* chain on router list */ +struct list_head lp_rtr_list; +/* # tx credits available */ +int lp_txcredits; +/* low water mark */ +int lp_mintxcredits; +/* # router credits */ +int lp_rtrcredits; +/* low water mark */ +int lp_minrtrcredits; +/* alive/dead? */ + unsigned int lp_alive:1; +/* notification outstanding? */ + unsigned int lp_notify:1; +/* outstanding notification for LND? */ + unsigned int lp_notifylnd:1; +/* some thread is handling notification */ + unsigned int lp_notifying:1; +/* SEND event outstanding from ping */ +unsigned int lp_ping_notsent; +/* # times router went dead<->alive */ +int lp_alive_count; +/* bytes queued for sending */ +long lp_txqnob; +/* time of last aliveness news */ +unsigned long lp_timestamp; +/* time of last ping attempt */ +unsigned long lp_ping_timestamp; +/* != 0 if ping reply expected */ +unsigned long lp_ping_deadline; +/* when I was last alive */ +unsigned long lp_last_alive;
drivers/staging/lustre/include/linux/lnet/lib-types.h typedef struct { · line 395
Quoted 10 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +10
-0+/* when lp_ni was queried last time */ +unsigned long lp_last_query; +/* interface peer is on */ +lnet_ni_t *lp_ni; +/* peer's NID */ +lnet_nid_t lp_nid; +/* # refs */ +int lp_refcount; +/* CPT this peer attached on */ +int lp_cpt;
This new block of declarations is uglier than the original. Don't make things uglier.
regards,
dan carpenter
RE: [lustre-devel] [PATCH 1/3] staging:lustre: remove tcpip abstraction from libcfs
In reply to Dan CarpenterQuoted 2 lines
This patch does a lot of stuff all at once and it is hard to review. It could easily be broken into patches which are easy to review.
I have more very large patches. With breaking them up that means you are going to see hundreds of patches coming from me.
Quoted 2 lines
Ok in this next section we move functions around and rename them but also introduce some bad changes in the new function.
Thanks for pointing out these bugs. We are still carrying these bugs in the OpenSFS branch. Once you approve these changes I will sync up lib-socket.c in the OpenSFS branch.
P.S
Does the 3rd patch look okay to you?
RE: [lustre-devel] [PATCH 2/3] staging:lustre: remove kernel defines in userland headers
In reply to Dan CarpenterQuoted 43 lines
Quoted 43 lines
typedef struct
lnet_peer{drivers/staging/lustre/include/linux/lnet/lib-types.h +17
-24-struct list_head lp_hashlist;/* chain on peer hash */ -struct list_head lp_txq;/* messages blocking for tx credits */ -struct list_head lp_rtrq;/* messages blocking for router credits */ -struct list_head lp_rtr_list;/* chain on router list */ -int lp_txcredits;/* # tx credits available */ -int lp_mintxcredits;/* low water mark */ -int lp_rtrcredits;/* # router credits */ -int lp_minrtrcredits;/* low water mark */ - unsigned int lp_alive:1; /* alive/dead? */ - unsigned int lp_notify:1; /* notification outstanding? */ - unsigned int lp_notifylnd:1; /* outstanding notification for LND? */ - unsigned int lp_notifying:1; /* some thread is handling notification */ -unsigned int lp_ping_notsent;/* SEND event outstanding from ping */ -int lp_alive_count;/* # times router went dead<->alive */ -long lp_txqnob;/* bytes queued for sending */ -unsigned long lp_timestamp;/* time of last aliveness news */ -unsigned long lp_ping_timestamp;/* time of last ping attempt */ -unsigned long lp_ping_deadline;/* != 0 if ping reply expected */ -unsigned long lp_last_alive;/* when I was last alive */ -unsigned long lp_last_query;/* when lp_ni was queried last time */ -lnet_ni_t *lp_ni;/* interface peer is on */ -lnet_nid_t lp_nid;/* peer's NID */ -int lp_refcount;/* # refs */ -int lp_cpt;/* CPT this peer attached on */ +/* chain on peer hash */ +struct list_head lp_hashlist; +/* messages blocking for tx credits */ +struct list_head lp_txq; +/* messages blocking for router credits */ +struct list_head lp_rtrq; +/* chain on router list */ +struct list_head lp_rtr_list; +/* # tx credits available */ +int lp_txcredits; +/* low water mark */ +int lp_mintxcredits; +/* # router credits */ +int lp_rtrcredits; +/* low water mark */ +int lp_minrtrcredits; +/* alive/dead? */
Quoted 8 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h typedef struct { · line 369
Quoted 5 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +5
-0+ unsigned int lp_alive:1; +/* notification outstanding? */ + unsigned int lp_notify:1; +/* outstanding notification for LND? */ + unsigned int lp_notifylnd:1;This new block of declarations is uglier than the original. Don't make things uglier.
Might be ugly but it makes checkpatch.pl happy. So it is a choice between making checkpatch.pl happy about staying in the 80 character limit or looking nice and chekpatch.pl being unhappy.
Re: [lustre-devel] [PATCH 2/3] staging:lustre: remove kernel defines in userland headers
Quoted 51 lines · James A.
Quoted 42 lines
Quoted 42 lines
typedef struct
lnet_peer{drivers/staging/lustre/include/linux/lnet/lib-types.h +17
-24-struct list_head lp_hashlist;/* chain on peer hash */ -struct list_head lp_txq;/* messages blocking for tx credits */ -struct list_head lp_rtrq;/* messages blocking for router credits */ -struct list_head lp_rtr_list;/* chain on router list */ -int lp_txcredits;/* # tx credits available */ -int lp_mintxcredits;/* low water mark */ -int lp_rtrcredits;/* # router credits */ -int lp_minrtrcredits;/* low water mark */ - unsigned int lp_alive:1; /* alive/dead? */ - unsigned int lp_notify:1; /* notification outstanding? */ - unsigned int lp_notifylnd:1; /* outstanding notification for LND? */ - unsigned int lp_notifying:1; /* some thread is handling notification */ -unsigned int lp_ping_notsent;/* SEND event outstanding from ping */ -int lp_alive_count;/* # times router went dead<->alive */ -long lp_txqnob;/* bytes queued for sending */ -unsigned long lp_timestamp;/* time of last aliveness news */ -unsigned long lp_ping_timestamp;/* time of last ping attempt */ -unsigned long lp_ping_deadline;/* != 0 if ping reply expected */ -unsigned long lp_last_alive;/* when I was last alive */ -unsigned long lp_last_query;/* when lp_ni was queried last time */ -lnet_ni_t *lp_ni;/* interface peer is on */ -lnet_nid_t lp_nid;/* peer's NID */ -int lp_refcount;/* # refs */ -int lp_cpt;/* CPT this peer attached on */ +/* chain on peer hash */ +struct list_head lp_hashlist; +/* messages blocking for tx credits */ +struct list_head lp_txq; +/* messages blocking for router credits */ +struct list_head lp_rtrq; +/* chain on router list */ +struct list_head lp_rtr_list; +/* # tx credits available */ +int lp_txcredits; +/* low water mark */ +int lp_mintxcredits; +/* # router credits */ +int lp_rtrcredits; +/* low water mark */ +int lp_minrtrcredits; +/* alive/dead? */ Quoted 8 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h typedef struct { · line 369
Quoted 5 lines
drivers/staging/lustre/include/linux/lnet/lib-types.h +5
-0+ unsigned int lp_alive:1; +/* notification outstanding? */ + unsigned int lp_notify:1; +/* outstanding notification for LND? */ + unsigned int lp_notifylnd:1;This new block of declarations is uglier than the original. Don't make things uglier.
Quoted 3 lines
Might be ugly but it makes checkpatch.pl happy. So it is a choice between making checkpatch.pl happy about staying in the 80 character limit or looking nice and chekpatch.pl being unhappy.
I would choose looking nice every time.
checkpatch is stupid. Please don't let it control you.
Maybe it'd be better to add another --ignore type just for comments that extend longer than the maximum line length to checkpatch.
Re: [lustre-devel] [PATCH 1/3] staging:lustre: remove tcpip abstraction from libcfs
In reply to Simmons, James A.Quoted 6 lines · James A.
Quoted 2 lines
This patch does a lot of stuff all at once and it is hard to review. It could easily be broken into patches which are easy to review.
I have more very large patches. With breaking them up that means you are going to see hundreds of patches coming from me.
The problem here is that we have two upstreams which have diverged and you're hopefully merging them into one upstream for the future. Breaking things up into patches is a pain and it basically means you have to do a lot of the work a second time. It sucks for you and I totally understand that... :(
We regulary review 100+ patch series so that's not a big deal.
We still have to review a ball of code with it broken up or not broken up but when it's broken up then I have scripts to strip out much of the mechanical changes.
Quoted 9 lines
Quoted 2 lines
Ok in this next section we move functions around and rename them but also introduce some bad changes in the new function.
Thanks for pointing out these bugs. We are still carrying these bugs in the OpenSFS branch. Once you approve these changes I will sync up
lib-socket.cin the OpenSFS branch.
P.S
Does the 3rd patch look okay to you?
Yeah. That looks fine.
regards,
dan carpenter
cover staging:lustre: remove tcpip abstraction from libcfs
In reply to a message not in the archiveSince libcfs no longer builds for user land we can move the TCPIP abstraction that exist to the LNET layer which is the only place that uses it. Also the migrated code will use native linux kernel APIs directly instead of with wrappers.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13760
James Simmons (6):
staging:lustre:remove useless libcfs_sock_release staging:lustre:remove useless libcfs_sock_abort_accept staging:lustre: rename tcpip handling functions to lnet_* prefix staging:lustre: use available kernel wrappers in lib-socket.c staging:lustre: style cleanups for lib-socket.c staging:lustre: Update license and copyright for lib-socket.c
.../staging/lustre/include/linux/libcfs/libcfs.h | 17 - .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 17 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 ++-- drivers/staging/lustre/lnet/lnet/acceptor.c | 55 ++-- drivers/staging/lustre/lnet/lnet/config.c | 21 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 323 +++++++++----------- 11 files changed, 236 insertions(+), 281 deletions(-)
PATCH 1/6 staging:lustre:remove useless libcfs_sock_release
In reply to a message not in the archiveThere is no reason to have a one line exported function libcfs_sock_release. Instead we can call sock_release directly.
--- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 8 ++++---- drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 -------- 5 files changed, 6 insertions(+), 15 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -1
@@ -103,7 +103,6 @@ int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);int libcfs_sock_getaddr (struct socket *socket,int remote,__u32 *ip,int *port);int libcfs_sock_write (struct socket *sock,void *buffer,int nob,int timeout);int libcfs_sock_read (struct socket *sock,void *buffer,int nob,int timeout); -void libcfs_sock_release (struct socket *sock);/* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +1 -1
@@ -1386,7 +1386,7 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,LIBCFS_FREE (conn,sizeof (*conn)); failed_0: -libcfs_sock_release (sock); +sock_release (sock);return rc; }
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +1 -1
@@ -453,7 +453,7 @@ ksocknal_connsock_decref(ksock_conn_t *conn)LASSERT (atomic_read (&conn->ksnc_sock_refcount) >0 );if (atomic_dec_and_test (&conn->ksnc_sock_refcount)) {LASSERT (conn->ksnc_closing); -libcfs_sock_release (conn->ksnc_sock); +sock_release (conn->ksnc_sock); conn->ksnc_sock =NULL ;ksocknal_finalize_zcreq (conn); }
drivers/staging/lustre/lnet/lnet/acceptor.c +4 -4
@@ -197,7 +197,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, goto failed; failed_sock: -libcfs_sock_release (sock); +sock_release (sock); failed:lnet_connect_console_error (rc, peer_nid, peer_ip, peer_port);return rc;
@@ -379,7 +379,7 @@ lnet_acceptor(void *arg)/* maybe we're waken up with libcfs_sock_abort_accept() */ if (lnet_acceptor_state.pta_shutdown) { -libcfs_sock_release (newsock); +sock_release (newsock);break ; }
@@ -410,10 +410,10 @@ lnet_acceptor(void *arg)continue ; failed: -libcfs_sock_release (newsock); +sock_release (newsock); } -libcfs_sock_release (lnet_acceptor_state.pta_sock); +sock_release (lnet_acceptor_state.pta_sock); lnet_acceptor_state.pta_sock =NULL ;CDEBUG (D_NET ,"Acceptor stopping\n" );
drivers/staging/lustre/lnet/lnet/lib-socket.c +0 -8
@@ -614,11 +614,3 @@ libcfs_sock_connect (struct socket **sockp, int *fatal, }EXPORT_SYMBOL (libcfs_sock_connect); - -void -libcfs_sock_release (struct socket *sock) -{ -sock_release (sock); -} - -EXPORT_SYMBOL (libcfs_sock_release);
Signature · 1 line
1.7.1
PATCH 2/6 staging:lustre:remove useless libcfs_sock_abort_accept
In reply to a message not in the archiveAnother one of those silly one line wrappers which is not needed. Replace libcfs_sock_abort_accept wrapper with a direct call to wake_up_all on the lnet_acceptor_state sock.
--- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - drivers/staging/lustre/lnet/lnet/acceptor.c | 4 ++-- drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 -------- 3 files changed, 2 insertions(+), 11 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -1
@@ -94,7 +94,6 @@ int libcfs_ipif_enumerate(char ***names);void libcfs_ipif_free_enumeration (char **names,int n);int libcfs_sock_listen (struct socket **sockp,__u32 ip,int port,int backlog);int libcfs_sock_accept (struct socket **newsockp,struct socket *sock); -void libcfs_sock_abort_accept (struct socket *sock);int libcfs_sock_connect (struct socket **sockp,int *fatal,__u32 local_ip,int local_port,__u32 peer_ip,int peer_port);
drivers/staging/lustre/lnet/lnet/acceptor.c +2 -2
@@ -377,7 +377,7 @@ lnet_acceptor(void *arg)continue ; } -/* maybe we're waken up with libcfs_sock_abort_accept() */ +/* maybe the LNet acceptor thread has been waken */ if (lnet_acceptor_state.pta_shutdown) {sock_release (newsock);break ;
@@ -493,7 +493,7 @@ lnet_acceptor_stop(void)return ; lnet_acceptor_state.pta_shutdown =1 ; -libcfs_sock_abort_accept (lnet_acceptor_state.pta_sock); +wake_up_all (sk_sleep (lnet_acceptor_state.pta_sock->sk));/* block until acceptor signals exit */ wait_for_completion (&lnet_acceptor_state.pta_signal);
drivers/staging/lustre/lnet/lnet/lib-socket.c +0 -8
@@ -568,14 +568,6 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)EXPORT_SYMBOL (libcfs_sock_accept); -void -libcfs_sock_abort_accept (struct socket *sock) -{ -wake_up_all (sk_sleep (sock->sk)); -} - -EXPORT_SYMBOL (libcfs_sock_abort_accept); - int libcfs_sock_connect (struct socket **sockp, int *fatal, __u32 local_ip, int local_port,
Signature · 1 line
1.7.1
PATCH 3/6 staging:lustre: rename tcpip handling functions to lnet_* prefix
In reply to a message not in the archiveWith all the TCPIP handling done in the lnet layer we should rename all the functions with the prefix lnet_*. One other change done was changing the remove argument of lnet_sock_getaddr from a int to a bool.
--- .../staging/lustre/include/linux/libcfs/libcfs.h | 15 ----- .../staging/lustre/include/linux/lnet/lib-lnet.h | 16 +++++ .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 11 ++-- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 15 ++--- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 43 ++++++------- drivers/staging/lustre/lnet/lnet/acceptor.c | 43 ++++++------- drivers/staging/lustre/lnet/lnet/config.c | 21 +++---- drivers/staging/lustre/lnet/lnet/lib-socket.c | 66 +++++++++---------- 10 files changed, 110 insertions(+), 128 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -15
@@ -88,21 +88,6 @@ static inline int __is_po2(unsigned long long val)int libcfs_arch_init (void );void libcfs_arch_cleanup (void ); -/* libcfs tcpip */ -int libcfs_ipif_query (char *name,int *up,__u32 *ip,__u32 *mask); -int libcfs_ipif_enumerate (char ***names); -void libcfs_ipif_free_enumeration (char **names,int n); -int libcfs_sock_listen (struct socket **sockp,__u32 ip,int port,int backlog); -int libcfs_sock_accept (struct socket **newsockp,struct socket *sock); -int libcfs_sock_connect (struct socket **sockp,int *fatal, -__u32 local_ip,int local_port, -__u32 peer_ip,int peer_port); -int libcfs_sock_setbuf (struct socket *socket,int txbufsize,int rxbufsize); -int libcfs_sock_getbuf (struct socket *socket,int *txbufsize,int *rxbufsize); -int libcfs_sock_getaddr (struct socket *socket,int remote,__u32 *ip,int *port); -int libcfs_sock_write (struct socket *sock,void *buffer,int nob,int timeout); -int libcfs_sock_read (struct socket *sock,void *buffer,int nob,int timeout); -/* need both kernel and user-land acceptor */ #define LNET_ACCEPTOR_MIN_RESERVED_PORT 512#define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +16 -0
@@ -846,6 +846,22 @@ int lnet_acceptor_port(void);int lnet_acceptor_start (void );void lnet_acceptor_stop (void ); +int lnet_ipif_query (char *name,int *up,__u32 *ip,__u32 *mask); +int lnet_ipif_enumerate (char ***names); +void lnet_ipif_free_enumeration (char **names,int n); +int lnet_sock_setbuf (struct socket *socket,int txbufsize,int rxbufsize); +int lnet_sock_getbuf (struct socket *socket,int *txbufsize,int *rxbufsize); +int lnet_sock_getaddr (struct socket *socket,bool remote,__u32 *ip,int *port); +int lnet_sock_write (struct socket *sock,void *buffer,int nob,int timeout); +int lnet_sock_read (struct socket *sock,void *buffer,int nob,int timeout); + +int lnet_sock_listen (struct socket **sockp,__u32 ip,int port,int backlog); +int lnet_sock_accept (struct socket **newsockp,struct socket *sock); +int lnet_sock_connect (struct socket **sockp,int *fatal, +__u32 local_ip,int local_port, +__u32 peer_ip,int peer_port); +void libcfs_sock_release (struct socket *sock); +void lnet_get_tunables (void );int lnet_peers_start_down (void );int lnet_peer_buffer_credits (lnet_ni_t *ni);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
@@ -2620,7 +2620,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname)int up;int rc; - rc =libcfs_ipif_query (ifname, &up, &ip, &netmask); + rc =lnet_ipif_query (ifname, &up, &ip, &netmask);if (rc !=0 ) {CERROR ("Can't query IPoIB interface %s: %d\n" , ifname, rc);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +5 -6
@@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)__u32 peer_ip;int peer_port; - rc =libcfs_sock_getaddr (sock,1 , &peer_ip, &peer_port); + rc =lnet_sock_getaddr (sock,1 , &peer_ip, &peer_port);LASSERT (rc ==0 );/* we succeeded before */ LIBCFS_ALLOC (cr,sizeof (*cr));
@@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)int rc;int n; - n =libcfs_ipif_enumerate (&names); + n =lnet_ipif_enumerate (&names);if (n <=0 ) {CERROR ("Can't enumerate interfaces: %d\n" , n);return n;
@@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)if (!strcmp (names[i],"lo" ))/* skip the loopback IF */ continue ; - rc =libcfs_ipif_query (names[i], &up, &ip, &mask); + rc =lnet_ipif_query (names[i], &up, &ip, &mask);if (rc !=0 ) {CWARN ("Can't get interface %s info: %d\n" , names[i], rc);
@@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) j++; } -libcfs_ipif_free_enumeration (names, n); +lnet_ipif_free_enumeration (names, n);if (j ==0 )CERROR ("Can't find any usable interfaces\n" );
@@ -2796,8 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni)if (ni->ni_interfaces[i] ==NULL )break ; - rc =libcfs_ipif_query ( - ni->ni_interfaces[i], &up, + rc =lnet_ipif_query (ni->ni_interfaces[i], &up, &net->ksnn_interfaces[i].ksni_ipaddr, &net->ksnn_interfaces[i].ksni_netmask);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +3 -3
@@ -1707,7 +1707,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, timeout = active ? *ksocknal_tunables.ksnd_timeout :lnet_acceptor_timeout (); - rc =libcfs_sock_read (sock, &hello->kshm_magic,sizeof (hello->kshm_magic), timeout); + rc =lnet_sock_read (sock, &hello->kshm_magic,sizeof (hello->kshm_magic), timeout);if (rc !=0 ) {CERROR ("Error %d reading HELLO from %pI4h\n" , rc, &conn->ksnc_ipaddr);
@@ -1726,8 +1726,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,return -EPROTO ; } - rc =libcfs_sock_read (sock, &hello->kshm_version, -sizeof (hello->kshm_version), timeout); + rc =lnet_sock_read (sock, &hello->kshm_version, +sizeof (hello->kshm_version), timeout);if (rc !=0 ) {CERROR ("Error %d reading HELLO from %pI4h\n" , rc, &conn->ksnc_ipaddr);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +6 -9
@@ -39,9 +39,8 @@int ksocknal_lib_get_conn_addrs (ksock_conn_t *conn) { -int rc =libcfs_sock_getaddr (conn->ksnc_sock,1 , - &conn->ksnc_ipaddr, - &conn->ksnc_port); +int rc =lnet_sock_getaddr (conn->ksnc_sock,1 , &conn->ksnc_ipaddr, + &conn->ksnc_port);/* Didn't need the {get,put}connsock dance to deref ksnc_sock... */ LASSERT (!conn->ksnc_closing);
@@ -51,8 +50,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)return rc; } - rc =libcfs_sock_getaddr (conn->ksnc_sock,0 , - &conn->ksnc_myipaddr,NULL ); + rc =lnet_sock_getaddr (conn->ksnc_sock,0 , &conn->ksnc_myipaddr,NULL );if (rc !=0 ) {CERROR ("Error %d getting sock local IP\n" , rc);return rc;
@@ -436,7 +434,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *return -ESHUTDOWN ; } - rc =libcfs_sock_getbuf (sock, txmem, rxmem); + rc =lnet_sock_getbuf (sock, txmem, rxmem);if (rc ==0 ) { len =sizeof (*nagle); rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY,
@@ -498,9 +496,8 @@ ksocknal_lib_setup_sock(struct socket *sock) } } - rc =libcfs_sock_setbuf (sock, - *ksocknal_tunables.ksnd_tx_buffer_size, - *ksocknal_tunables.ksnd_rx_buffer_size); + rc =lnet_sock_setbuf (sock, *ksocknal_tunables.ksnd_tx_buffer_size, + *ksocknal_tunables.ksnd_rx_buffer_size);if (rc !=0 ) { CERROR("Can't set buffer tx %d, rx %d buffers: %d\n", *ksocknal_tunables.ksnd_tx_buffer_size,
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +20 -23
91 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/acceptor.c +19 -24
109 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/config.c +9 -12
@@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)__u32 *ipaddrs2;int nip;char **ifnames; -int nif =libcfs_ipif_enumerate (&ifnames); +int nif =lnet_ipif_enumerate (&ifnames);int i;int rc;
@@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)LIBCFS_ALLOC (ipaddrs, nif *sizeof (*ipaddrs));if (ipaddrs ==NULL ) {CERROR ("Can't allocate ipaddrs[%d]\n" , nif); -libcfs_ipif_free_enumeration (ifnames, nif); +lnet_ipif_free_enumeration (ifnames, nif);return -ENOMEM ; }
@@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)if (!strcmp (ifnames[i],"lo" ))continue ; - rc =libcfs_ipif_query (ifnames[i], &up, - &ipaddrs[nip], &netmask); + rc =lnet_ipif_query (ifnames[i], &up, &ipaddrs[nip], &netmask);if (rc !=0 ) {CWARN ("Can't query interface %s: %d\n" , ifnames[i], rc);
@@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) nip++; } -libcfs_ipif_free_enumeration (ifnames, nif); +lnet_ipif_free_enumeration (ifnames, nif);if (nip == nif) { *ipaddrsp = ipaddrs;
@@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)return -EPERM ; } - rc =libcfs_ipif_query (ni->ni_interfaces[0 ], - &up, &ip, &netmask); + rc =lnet_ipif_query (ni->ni_interfaces[0 ], &up, &ip, &netmask);if (rc !=0 ) {CERROR ("Net %s can't query interface %s: %d\n" ,libcfs_net2str (net), ni->ni_interfaces[0 ], rc);
@@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)return 0 ; } - n =libcfs_ipif_enumerate (&names); + n =lnet_ipif_enumerate (&names);if (n <=0 ) {CERROR ("Net %s can't enumerate interfaces: %d\n" ,libcfs_net2str (net), n);
@@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)if (!strcmp (names[i],"lo" ))/* skip the loopback IF */ continue ; - rc =libcfs_ipif_query (names[i], &up, &ip, &netmask); - + rc =lnet_ipif_query (names[i], &up, &ip, &netmask);if (rc !=0 ) {CWARN ("Net %s can't query interface %s: %d\n" ,libcfs_net2str (net), names[i], rc);
@@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)continue ; } -libcfs_ipif_free_enumeration (names, n); +lnet_ipif_free_enumeration (names, n); ni->ni_nid =LNET_MKNID (net, ip);return 0 ; }CERROR ("Net %s can't find any interfaces\n" ,libcfs_net2str (net)); -libcfs_ipif_free_enumeration (names, n); +lnet_ipif_free_enumeration (names, n);return -ENOENT ; }EXPORT_SYMBOL (lnet_set_ip_niaddr);
drivers/staging/lustre/lnet/lnet/lib-socket.c +31 -35
208 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 4/6 staging:lustre: use available kernel wrappers in lib-socket.c
In reply to a message not in the archiveInstead of handling calls to struct proto ourselves we can use equivalent kernel wrappers. No wrapper exist for unlocked ioctl handling so we create one here for our use. I expect some day that function will be integrated into sock.c.
--- drivers/staging/lustre/lnet/lnet/lib-socket.c | 47 ++++++++++++++++--------- 1 files changed, 30 insertions(+), 17 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-socket.c +30 -17
@@ -35,22 +35,37 @@*/ #define DEBUG_SUBSYSTEM S_LNET -#include "../../include/linux/libcfs/libcfs.h" -#include "../../include/linux/lnet/lib-lnet.h" -#include <linux/if.h> #include <linux/in.h> +#include <linux/net.h> #include <linux/file.h> +#include <linux/pagemap.h> /* For sys_open & sys_close */ #include <linux/syscalls.h> +#include <net/sock.h> + +#include "../../include/linux/libcfs/libcfs.h" +#include "../../include/linux/lnet/lib-lnet.h" + +static int +kernel_sock_unlocked_ioctl (struct file *filp,int cmd,unsigned long arg) +{ +mm_segment_t oldfs =get_fs (); +int err; + +set_fs (KERNEL_DS ); + err = filp->f_op->unlocked_ioctl (filp, cmd, arg); +set_fs (oldfs); + +return err; +}static int lnet_sock_ioctl (int cmd,unsigned long arg) { -mm_segment_t oldmm =get_fs (); +struct file *sock_filp;struct socket *sock;int rc; -struct file *sock_filp; rc =sock_create (PF_INET ,SOCK_STREAM ,0 , &sock);if (rc !=0 ) {
@@ -65,10 +80,7 @@ lnet_sock_ioctl(int cmd, unsigned long arg) goto out; } -set_fs (KERNEL_DS ); -if (sock_filp->f_op->unlocked_ioctl) - rc = sock_filp->f_op->unlocked_ioctl (sock_filp, cmd, arg); -set_fs (oldmm); + rc =kernel_sock_unlocked_ioctl (sock_filp, cmd, arg);fput (sock_filp); out:
@@ -398,8 +410,8 @@ lnet_sock_create (struct socket **sockp, int *fatal, locaddr.sin_addr.s_addr = (local_ip ==0 ) ?INADDR_ANY :htonl (local_ip); - rc = sock->ops->bind (sock, (struct sockaddr *)&locaddr, -sizeof (locaddr)); + rc =kernel_bind (sock, (struct sockaddr *)&locaddr, +sizeof (locaddr));if (rc == -EADDRINUSE ) {CDEBUG (D_NET ,"Port %d already in use\n" , local_port); *fatal =0 ;
@@ -459,8 +471,10 @@ lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port)int len =sizeof (sin);int rc; - rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len, - remote ?2 :0 ); +if (remote) + rc =kernel_getpeername (sock, (struct sockaddr *)&sin, &len); +else + rc =kernel_getsockname (sock, (struct sockaddr *)&sin, &len);if (rc !=0 ) {CERROR ("Error %d getting sock %s IP/port\n" , rc, remote ?"peer" :"local" );
@@ -510,7 +524,7 @@ lnet_sock_listen (struct socket **sockp,return rc; } - rc = (*sockp)->ops->listen (*sockp, backlog); + rc =kernel_listen (*sockp, backlog);if (rc ==0 )return 0 ;
@@ -581,9 +595,8 @@ lnet_sock_connect (struct socket **sockp, int *fatal, srvaddr.sin_port =htons (peer_port); srvaddr.sin_addr.s_addr =htonl (peer_ip); - rc = (*sockp)->ops->connect (*sockp, - (struct sockaddr *)&srvaddr,sizeof (srvaddr), -0 ); + rc =kernel_connect (*sockp, (struct sockaddr *)&srvaddr, +sizeof (srvaddr),0 );if (rc ==0 )return 0 ;
Signature · 1 line
1.7.1
PATCH 5/6 staging:lustre: style cleanups for lib-socket.c
In reply to a message not in the archiveHandle all the style issues reported by checkpatch.pl. Remove general white spaces, spaces in function calls, etc.
--- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 210 +++++++++----------- 2 files changed, 98 insertions(+), 116 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +2 -2
@@ -1378,14 +1378,14 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,ksocknal_txlist_done (ni, &zombies,1 );ksocknal_peer_decref (peer); - failed_1: +failed_1:if (hello !=NULL )LIBCFS_FREE (hello, offsetof(ksock_hello_msg_t , kshm_ips[LNET_MAX_INTERFACES]));LIBCFS_FREE (conn,sizeof (*conn)); - failed_0: +failed_0:sock_release (sock);return rc; }
drivers/staging/lustre/lnet/lnet/lib-socket.c +96 -114
465 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 6/6 staging:lustre: Update license and copyright for lib-socket.c
In reply to a message not in the archivePoint to the right place for GNU license. Update Intel copyright.
--- drivers/staging/lustre/lnet/lnet/lib-socket.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-socket.c +3 -7
@@ -15,11 +15,7 @@* * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see -* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf -* -* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -* CA 95054 USA or visit www.sun.com if you need additional information or -* have any questions. +* http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */
@@ -27,11 +23,11 @@* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * -* Copyright (c) 2012, Intel Corporation. +* Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. +* Lustre is a trademark of Seagate, Inc. */ #define DEBUG_SUBSYSTEM S_LNET
Signature · 1 line
1.7.1
Greg Kroah-Hartman
maintainerRe: [lustre-devel] [PATCH 1/3] staging:lustre: remove tcpip abstraction from libcfs
In reply to Simmons, James A.Quoted 5 lines · James A.
Quoted 2 lines
This patch does a lot of stuff all at once and it is hard to review. It could easily be broken into patches which are easy to review.
I have more very large patches. With breaking them up that means you are going to see hundreds of patches coming from me.
hundreds of patches are not a problem at all for me, please do it that way as what you sent is almost impossible to properly review.
thanks,
greg k-h
Re: [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
In reply to James Simmonsdrivers/staging/lustre/lnet/lnet/lib-socket.c lnet_ipif_enumerate (char ***namesp) · line 169
Quoted 9 lines · James Simmons
drivers/staging/lustre/lnet/lnet/lib-socket.c +2
-2@@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp)if (nalloc *sizeof (*ifr) >PAGE_CACHE_SIZE ) { toobig =1 ; nalloc =PAGE_CACHE_SIZE /sizeof (*ifr); -CWARN ("Too many interfaces: only enumerating first %d\n" , - nalloc); +CWARN ("Too many interfaces: only enumerating " +"first %d\n" , nalloc); }
Don't split string literals, it makes them hard to grep for.
regards,
dan carpenter
RE: [lustre-devel] [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
Quoted 4 lines
Quoted 4 lines · James Simmons
drivers/staging/lustre/lnet/lnet/lib-socket.c +0
-0@@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp)if (nalloc *sizeof (*ifr) >PAGE_CACHE_SIZE ) { toobig =1 ;
Quoted 8 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c lnet_ipif_enumerate (char ***namesp) · line 169
Quoted 6 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c +2
-2nalloc =PAGE_CACHE_SIZE /sizeof (*ifr); -CWARN ("Too many interfaces: only enumerating first %d\n" , - nalloc); +CWARN ("Too many interfaces: only enumerating " +"first %d\n" , nalloc); }Don't split string literals, it makes them hard to grep for.
Will fix. The CWARN will go over 80 characters but from the recent emails that is more acceptable. If this is the only problem then this patch set it ready. I have more patch series that are dependent on this first one. Should I push the other patch series with a note that it is dependent on the tcpip cleanup or wait until it is merged? Also how does one find out when the patch has been merged?
Re: [lustre-devel] [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
Quoted 13 lines · James A.
Quoted 4 lines
Quoted 4 lines · James Simmons
drivers/staging/lustre/lnet/lnet/lib-socket.c +0
-0@@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp)if (nalloc *sizeof (*ifr) >PAGE_CACHE_SIZE ) { toobig =1 ;Quoted 8 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c lnet_ipif_enumerate (char ***namesp) · line 169
Quoted 6 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c +2
-2nalloc =PAGE_CACHE_SIZE /sizeof (*ifr); -CWARN ("Too many interfaces: only enumerating first %d\n" , - nalloc); +CWARN ("Too many interfaces: only enumerating " +"first %d\n" , nalloc); }Don't split string literals, it makes them hard to grep for.
Quoted 2 lines
Will fix. The CWARN will go over 80 characters but from the recent emails that is more acceptable. If this is the only problem then this patch set it ready.
Normally the right thing to do here would be to send a fixed [patch 5/6 v2] using the --in-reply-to option so that it appears as a reply to the original [patch 5/6].
Quoted 3 lines
I have more patch series that are dependent
on this first one. Should I push the other patch series with a note that it is dependent on the tcpip cleanup or wait until it is merged? Also how does one find out when the patch has been merged?
You will get an email when these are merged.
This is the only issue, I had. No one else has complained so that means no one else has any objections. Greg hasn't merged it yet and he might find a problem with it, but it seems like a straight forward patchset so that's unlikely.
The only issue is that this patchset was sent in a confusing way. It doesn't have a v2 tag and it was tacked on to the old thread. Greg tends to not waste time being confused and just deletes the whole thread when that happens.
The notes that "This depends on XXX being applied." are kind of nice but no one spends a lot of time worrying about that stuff. Greg just applies the patches in the order that they hit his inbox and they either apply or he tells people to update and resend.
So send your follow on patches. If everything applies then good. If not then you can resend, which is a few commands in git and not a big deal.
regards,
dan carpenter
RE: [lustre-devel] [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Don't split string literals, it makes them hard to grep for.
Will fix. The CWARN will go over 80 characters but from the recent emails that is more acceptable. If this is the only problem then this patch set it ready.
Normally the right thing to do here would be to send a fixed [patch 5/6 v2] using the --in-reply-to option so that it appears as a reply to the original [patch 5/6].
Made a note of that for future reference.
Quoted 10 lines
Quoted 3 lines
I have more patch series that are dependent
on this first one. Should I push the other patch series with a note that it is dependent on the tcpip cleanup or wait until it is merged? Also how does one find out when the patch has been merged?You will get an email when these are merged.
This is the only issue, I had. No one else has complained so that means no one else has any objections. Greg hasn't merged it yet and he might find a problem with it, but it seems like a straight forward patchset so that's unlikely.
Ugh. I was off by one for the number of patches so I need to send a new batch.
Quoted 4 lines
The only issue is that this patchset was sent in a confusing way. It doesn't have a v2 tag and it was tacked on to the old thread. Greg tends to not waste time being confused and just deletes the whole thread when that happens.
Forgot to change the patch tag number. I will send a new batch with v2 so it is a new thread.