From patchwork Mon May 9 19:22:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 770272 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p49JMgqp002703 for ; Mon, 9 May 2011 19:22:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754089Ab1EITWk (ORCPT ); Mon, 9 May 2011 15:22:40 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:39658 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754073Ab1EITWi (ORCPT ); Mon, 9 May 2011 15:22:38 -0400 Received: by ywj3 with SMTP id 3so1912717ywj.19 for ; Mon, 09 May 2011 12:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:subject:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=H2QQ3H/AGGQBTxwl8c1wGmkKhz112HHtvUWyDpg5JKc=; b=EG8mGcq8+dg4bWnKSIZMT1XUxkpP1u/h5RlgFwokhnyrVuogai4mtMYEKJckDMU0dk k6ux9zcydZkn3835SeCxk/IymA6hq1mdkwA0DUSfvQ68uWo/Z16TppPxuww/wJL7ccgM Xu8QemKd7MPJuP7xtDdVBLDknX4QZPTS/kC68= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=L5Se42K12GTwryC5Ulq1LLfHv+5UNeYCqFJUu5/gKe1HI1KoPuws9JmJ00AV7AJ7DZ 5p2+dL6zc72l9+ZyAf65BvMfx+S7wc7wAcTCybt8WpVx03td2lwGtJYwtQCPrmpDVCXX So9dMi/cCUayG+zFcAJ8F28of3s/hdemN0B68= Received: by 10.236.186.35 with SMTP id v23mr5144436yhm.40.1304968957688; Mon, 09 May 2011 12:22:37 -0700 (PDT) Received: from matisse.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net [99.26.161.222]) by mx.google.com with ESMTPS id o63sm2744564yhn.4.2011.05.09.12.22.36 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 12:22:36 -0700 (PDT) From: Chuck Lever Subject: [PATCH 3/6] SUNRPC: Rename xs_encode_tcp_fragment_header() To: trond.myklebust@netapp.com Cc: linux-nfs@vger.kernel.org Date: Mon, 09 May 2011 15:22:34 -0400 Message-ID: <20110509192234.16449.45025.stgit@matisse.1015granger.net> In-Reply-To: <20110509191859.16449.73749.stgit@matisse.1015granger.net> References: <20110509191859.16449.73749.stgit@matisse.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 09 May 2011 19:22:43 +0000 (UTC) Clean up: Use a more generic name for xs_encode_tcp_fragment_header(); it's appropriate to use for all stream transport types. We're about to add new stream transport. Also, move it to a place where it is more easily shared amongst the various send_request methods. And finally, replace the "htonl" macro invocation with its modern equivalent. Signed-off-by: Chuck Lever --- net/sunrpc/xprtsock.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index bf005d3..6d54d39 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -495,6 +495,16 @@ static int xs_nospace(struct rpc_task *task) return ret; } +/* + * Construct a stream transport record marker in @buf. + */ +static inline void xs_encode_stream_record_marker(struct xdr_buf *buf) +{ + u32 reclen = buf->len - sizeof(rpc_fraghdr); + rpc_fraghdr *base = buf->head[0].iov_base; + *base = cpu_to_be32(RPC_LAST_STREAM_FRAGMENT | reclen); +} + /** * xs_udp_send_request - write an RPC request to a UDP socket * @task: address of RPC task that manages the state of an RPC request @@ -574,13 +584,6 @@ static void xs_tcp_shutdown(struct rpc_xprt *xprt) kernel_sock_shutdown(sock, SHUT_WR); } -static inline void xs_encode_tcp_record_marker(struct xdr_buf *buf) -{ - u32 reclen = buf->len - sizeof(rpc_fraghdr); - rpc_fraghdr *base = buf->head[0].iov_base; - *base = htonl(RPC_LAST_STREAM_FRAGMENT | reclen); -} - /** * xs_tcp_send_request - write an RPC request to a TCP socket * @task: address of RPC task that manages the state of an RPC request @@ -603,7 +606,7 @@ static int xs_tcp_send_request(struct rpc_task *task) struct xdr_buf *xdr = &req->rq_snd_buf; int status; - xs_encode_tcp_record_marker(&req->rq_snd_buf); + xs_encode_stream_record_marker(&req->rq_snd_buf); xs_pktdump("packet data:", req->rq_svec->iov_base, @@ -2014,10 +2017,7 @@ static int bc_sendto(struct rpc_rqst *req) unsigned long headoff; unsigned long tailoff; - /* - * Set up the rpc header and record marker stuff - */ - xs_encode_tcp_record_marker(xbufp); + xs_encode_stream_record_marker(xbufp); tailoff = (unsigned long)xbufp->tail[0].iov_base & ~PAGE_MASK; headoff = (unsigned long)xbufp->head[0].iov_base & ~PAGE_MASK;