Skip to contentSkip to conversation

SUNRPC: Clean up bc_send()

PATCH In review Chuck Lever 2 participants 3 messages May 7, 2015 – May 11, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SUNRPC: Clean up bc_send()

Clean up: Merge bc_svc.c into backchannel_rqst.c, and adopt a more consistent naming scheme for bc_send().

---
 include/linux/sunrpc/bc_xprt.h |    2 +
 net/sunrpc/Makefile            |    2 +
 net/sunrpc/backchannel_rqst.c  |   22 ++++++++++++++
 net/sunrpc/bc_svc.c            |   63 ----------------------------------------
 net/sunrpc/svc.c               |    2 +
 5 files changed, 25 insertions(+), 66 deletions(-)
 delete mode 100644 net/sunrpc/bc_svc.c
include/linux/sunrpc/bc_xprt.h +1 -1
index 2ca67b5..2e4b86e4 100644
@@ -37,7 +37,7 @@ void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied);
 void xprt_free_bc_request(struct rpc_rqst *req);
 int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
 void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
-int bc_send(struct rpc_rqst *req);
+int xprt_send_bc_reply(struct rpc_rqst *req);
 
 /*
  * Determine if a shared backchannel is in use
net/sunrpc/Makefile +1 -1
index 15e6f6c..1b8e68d 100644
@@ -15,6 +15,6 @@ sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
 	    sunrpc_syms.o cache.o rpc_pipe.o \
 	    svc_xprt.o
 sunrpc-$(CONFIG_SUNRPC_DEBUG) += debugfs.o
-sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o bc_svc.o
+sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o
 sunrpc-$(CONFIG_PROC_FS) += stats.o
 sunrpc-$(CONFIG_SYSCTL) += sysctl.o
net/sunrpc/backchannel_rqst.c +22 -0
index 9dd0ea8d..6b4ebeb 100644
@@ -323,3 +323,25 @@ void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied)
 	spin_unlock(&bc_serv->sv_cb_lock);
 }
 
+/*
+ * Send a backward direction reply on a connection the client
+ * has established.
+ */
+int xprt_send_bc_reply(struct rpc_rqst *req)
+{
+	static const struct rpc_call_ops rpc_bc_call_ops = { };
+	struct rpc_task *task;
+	int ret;
+
+	dprintk("RPC:       bc_send req= %p\n", req);
+	task = rpc_run_bc_task(req, &rpc_bc_call_ops);
+	if (IS_ERR(task))
+		ret = PTR_ERR(task);
+	else {
+		WARN_ON_ONCE(atomic_read(&task->tk_count) != 1);
+		ret = task->tk_status;
+		rpc_put_task(task);
+	}
+	dprintk("RPC:       bc_send ret= %d\n", ret);
+	return ret;
+}
net/sunrpc/bc_svc.c deleted +0 -63

63 lines not on this page · raw message

net/sunrpc/svc.c +1 -1
index 78974e4..4f46dd4 100644
@@ -1381,7 +1381,7 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
 	if (svc_process_common(rqstp, argv, resv)) {
 		memcpy(&req->rq_snd_buf, &rqstp->rq_res,
 						sizeof(req->rq_snd_buf));
-		return bc_send(req);
+		return xprt_send_bc_reply(req);
 	} else {
 		/* drop request */
 		xprt_free_bc_request(req);
#1 lore raw
Quoted 2 lines · Chuck Lever

Clean up: Merge bc_svc.c into backchannel_rqst.c, and adopt a more consistent naming scheme for bc_send().

Seems like a bit of an odd choise as none of the callchain bc_send is in really touches backchannel_rqst.c.

How about just killing bc_send() and open coding it in bc_svc_process?

And while we're at it - bc_svc_process seems totally generic RPC code that might want to be moved to net/sunrpc and converted to a workqueue.

#2 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 2 lines · Chuck Lever

Clean up: Merge bc_svc.c into backchannel_rqst.c, and adopt a more consistent naming scheme for bc_send().

Seems like a bit of an odd choise as none of the callchain bc_send is in really touches backchannel_rqst.c.

How about just killing bc_send() and open coding it in bc_svc_process?

OK, that sounds reasonable.

Quoted 3 lines

And while we're at it - bc_svc_process seems totally generic RPC code that might want to be moved to net/sunrpc and converted to a workqueue.

That is underway.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com