Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: Clean up - convert xprt_prepare_transmit to return a bool

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

+12 -11
+1 -1
include/linux/sunrpc/xprt.h
··· 288 288 int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 289 289 void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 290 290 void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 291 - int xprt_prepare_transmit(struct rpc_task *task); 291 + bool xprt_prepare_transmit(struct rpc_task *task); 292 292 void xprt_transmit(struct rpc_task *task); 293 293 void xprt_end_transmit(struct rpc_task *task); 294 294 int xprt_adjust_timeout(struct rpc_rqst *req);
+2 -4
net/sunrpc/clnt.c
··· 1722 1722 task->tk_action = call_status; 1723 1723 if (task->tk_status < 0) 1724 1724 return; 1725 - task->tk_status = xprt_prepare_transmit(task); 1726 - if (task->tk_status != 0) 1725 + if (!xprt_prepare_transmit(task)) 1727 1726 return; 1728 1727 task->tk_action = call_transmit_status; 1729 1728 /* Encode here so that rpcsec_gss can use correct sequence number. */ ··· 1810 1811 { 1811 1812 struct rpc_rqst *req = task->tk_rqstp; 1812 1813 1813 - task->tk_status = xprt_prepare_transmit(task); 1814 - if (task->tk_status == -EAGAIN) { 1814 + if (!xprt_prepare_transmit(task)) { 1815 1815 /* 1816 1816 * Could not reserve the transport. Try again after the 1817 1817 * transport is released.
+9 -6
net/sunrpc/xprt.c
··· 864 864 * @task: RPC task about to send a request 865 865 * 866 866 */ 867 - int xprt_prepare_transmit(struct rpc_task *task) 867 + bool xprt_prepare_transmit(struct rpc_task *task) 868 868 { 869 869 struct rpc_rqst *req = task->tk_rqstp; 870 870 struct rpc_xprt *xprt = req->rq_xprt; 871 - int err = 0; 871 + bool ret = false; 872 872 873 873 dprintk("RPC: %5u xprt_prepare_transmit\n", task->tk_pid); 874 874 875 875 spin_lock_bh(&xprt->transport_lock); 876 876 if (req->rq_reply_bytes_recvd && !req->rq_bytes_sent) { 877 - err = req->rq_reply_bytes_recvd; 877 + task->tk_status = req->rq_reply_bytes_recvd; 878 878 goto out_unlock; 879 879 } 880 - if (!xprt->ops->reserve_xprt(xprt, task)) 881 - err = -EAGAIN; 880 + if (!xprt->ops->reserve_xprt(xprt, task)) { 881 + task->tk_status = -EAGAIN; 882 + goto out_unlock; 883 + } 884 + ret = true; 882 885 out_unlock: 883 886 spin_unlock_bh(&xprt->transport_lock); 884 - return err; 887 + return ret; 885 888 } 886 889 887 890 void xprt_end_transmit(struct rpc_task *task)