Skip to contentSkip to conversation

Staging: lustre: rpc: Remove unnecessary wrapper function

PATCH Superseded Shivani Bhardwaj 2 participants 3 messages Oct 29, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: lustre: rpc: Remove unnecessary wrapper function

Remove the function srpc_post_active_rqtbuf() and replace its only call with the function srpc_post_active_rdma() by adding and typecasting the appropriate parameters.

---
 drivers/staging/lustre/lnet/selftest/rpc.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/staging/lustre/lnet/selftest/rpc.c +5 -12
index 162f9d3..cb895c3 100644
@@ -445,15 +445,6 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
 }
 
 static int
-srpc_post_active_rqtbuf(lnet_process_id_t peer, int service, void *buf,
-			int len, lnet_handle_md_t *mdh, srpc_event_t *ev)
-{
-	return srpc_post_active_rdma(srpc_serv_portal(service), service,
-				     buf, len, LNET_MD_OP_PUT, peer,
-				     LNET_NID_ANY, mdh, ev);
-}
-
-static int
 srpc_post_passive_rqtbuf(int service, int local, void *buf, int len,
 			 lnet_handle_md_t *mdh, srpc_event_t *ev)
 {
@@ -798,9 +789,11 @@ srpc_send_request(srpc_client_rpc_t *rpc)
 	ev->ev_data  = rpc;
 	ev->ev_type  = SRPC_REQUEST_SENT;
 
-	rc = srpc_post_active_rqtbuf(rpc->crpc_dest, rpc->crpc_service,
-				     &rpc->crpc_reqstmsg, sizeof(srpc_msg_t),
-				     &rpc->crpc_reqstmdh, ev);
+	rc = srpc_post_active_rdma(srpc_serv_portal(rpc->crpc_service),
+				   rpc->crpc_service, &rpc->crpc_reqstmsg,
+				   sizeof(srpc_msg_t), LNET_MD_OP_PUT,
+				   (lnet_process_id_t)rpc->crpc_dest,
+				   LNET_NID_ANY, &rpc->crpc_reqstmdh, ev);
 	if (rc != 0) {
 		LASSERT(rc == -ENOMEM);
 		ev->ev_fired = 1;  /* no more event expected */
Signature · 1 line
2.1.0
#1 lore raw
Quoted 30 lines · Shivani Bhardwaj

Remove the function srpc_post_active_rqtbuf() and replace its only call with the function srpc_post_active_rdma() by adding and typecasting the appropriate parameters.

---
 drivers/staging/lustre/lnet/selftest/rpc.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/staging/lustre/lnet/selftest/rpc.c +0 -9
index 162f9d3..cb895c3 100644
@@ -445,15 +445,6 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len,
 }
 
 static int
-srpc_post_active_rqtbuf(lnet_process_id_t peer, int service, void *buf,
-			int len, lnet_handle_md_t *mdh, srpc_event_t *ev)
-{
-	return srpc_post_active_rdma(srpc_serv_portal(service), service,
-				     buf, len, LNET_MD_OP_PUT, peer,
-				     LNET_NID_ANY, mdh, ev);
-}
-
-static int
 srpc_post_passive_rqtbuf(int service, int local, void *buf, int len,
 			 lnet_handle_md_t *mdh, srpc_event_t *ev)
 {

drivers/staging/lustre/lnet/selftest/rpc.c srpc_send_request(srpc_client_rpc_t *rpc) · line 795

Quoted 10 lines
drivers/staging/lustre/lnet/selftest/rpc.c +4 -3
@@ -798,9 +789,11 @@ srpc_send_request(srpc_client_rpc_t *rpc)
 	ev->ev_data  = rpc;
 	ev->ev_type  = SRPC_REQUEST_SENT;
 
-	rc = srpc_post_active_rqtbuf(rpc->crpc_dest, rpc->crpc_service,
-				     &rpc->crpc_reqstmsg, sizeof(srpc_msg_t),
-				     &rpc->crpc_reqstmdh, ev);
+	rc = srpc_post_active_rdma(srpc_serv_portal(rpc->crpc_service),
+				   rpc->crpc_service, &rpc->crpc_reqstmsg,
+				   sizeof(srpc_msg_t), LNET_MD_OP_PUT,
+				   (lnet_process_id_t)rpc->crpc_dest,

why do you need the typecast to lnet_process_id_t?

crpc_dest is already of the type lnet_process_id_t. check lustre/lnet/selftest/selftest.h file.

regards
sudip

#2 lore raw

On Thu, Oct 29, 2015 at 4:26 PM, Sudip Mukherjee <[email protected]

Quoted 47 lines

wrote:

Review

Quoted 10 lines · Shivani Bhardwaj

Remove the function srpc_post_active_rqtbuf() and replace its only call with the function srpc_post_active_rdma() by adding and typecasting the appropriate parameters.

---
 drivers/staging/lustre/lnet/selftest/rpc.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/lustre/lnet/selftest/rpc.c

drivers/staging/lustre/lnet/selftest/rpc.c srpc_post_active_rdma(int portal, __u64 matchbits,

Quoted 4 lines

index 162f9d3..cb895c3 100644

drivers/staging/lustre/lnet/selftest/rpc.c +0 -0
@@ -445,15 +445,6 @@ srpc_post_active_rdma(int portal, __u64 matchbits,

void *buf, int len,

Quoted 16 lines
drivers/staging/lustre/lnet/selftest/rpc.c +0 -9
 }
 
 static int
-srpc_post_active_rqtbuf(lnet_process_id_t peer, int service, void *buf,
-                     int len, lnet_handle_md_t *mdh, srpc_event_t *ev)
-{
-     return srpc_post_active_rdma(srpc_serv_portal(service), service,
-                                  buf, len, LNET_MD_OP_PUT, peer,
-                                  LNET_NID_ANY, mdh, ev);
-}
-
-static int
 srpc_post_passive_rqtbuf(int service, int local, void *buf, int len,
                       lnet_handle_md_t *mdh, srpc_event_t *ev)
 {

drivers/staging/lustre/lnet/selftest/rpc.c srpc_send_request(srpc_client_rpc_t *rpc) · line 802

Quoted 5 lines
drivers/staging/lustre/lnet/selftest/rpc.c +0 -2
@@ -798,9 +789,11 @@ srpc_send_request(srpc_client_rpc_t *rpc)
      ev->ev_data  = rpc;
      ev->ev_type  = SRPC_REQUEST_SENT;
 
-     rc = srpc_post_active_rqtbuf(rpc->crpc_dest, rpc->crpc_service,
-                                  &rpc->crpc_reqstmsg,

sizeof(srpc_msg_t),

drivers/staging/lustre/lnet/selftest/rpc.c srpc_send_request(srpc_client_rpc_t *rpc) · line 795

Quoted 5 lines
drivers/staging/lustre/lnet/selftest/rpc.c +4 -1
-                                  &rpc->crpc_reqstmdh, ev);
+     rc = srpc_post_active_rdma(srpc_serv_portal(rpc->crpc_service),
+                                rpc->crpc_service, &rpc->crpc_reqstmsg,
+                                sizeof(srpc_msg_t), LNET_MD_OP_PUT,
+                                (lnet_process_id_t)rpc->crpc_dest,
Quoted 8 lines

why do you need the typecast to lnet_process_id_t?

crpc_dest is already of the type lnet_process_id_t. check lustre/lnet/selftest/selftest.h file.

regards
sudip

Thanks for pointing out. I've sent v2. Please check that. Thank you