From patchwork Thu Nov 12 14:44:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 7603061 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 969489F1C2 for ; Thu, 12 Nov 2015 14:44:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEF16207C2 for ; Thu, 12 Nov 2015 14:44:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B33BC207B7 for ; Thu, 12 Nov 2015 14:44:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754076AbbKLOoj (ORCPT ); Thu, 12 Nov 2015 09:44:39 -0500 Received: from mail-ig0-f182.google.com ([209.85.213.182]:36368 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167AbbKLOoh (ORCPT ); Thu, 12 Nov 2015 09:44:37 -0500 Received: by igcph11 with SMTP id ph11so94751670igc.1; Thu, 12 Nov 2015 06:44:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=V6XTYH5jEVXGypTaGJNX1fAlvrytMsdgcrH/hxlcPQo=; b=g81382qiXxI2dd4zXQOH2yhlNhzIyE40W9NKrSsUSds6AGomEE7FpSnxUKcnrhGIJ9 Q26KIHYqtC5rI/LPFxjcUlfiI4r4vKyfhqNi0InHeX9+DKcReggpuyMEiAbWFIZe99NI J3BLwT9IToQw8LadCJS58EHni1m/bl2M63tu/BlK+yOzxt2flTUSanOVbcuC31Q7bFrv 4UayQvSewJWFDU1YDQStCKowLlyIv5mKZzGeRtPPaeiUDtswByqfx91B9ySWuAU8Jk/J uHkpYbXAMxkg8gcBSIS3y+4oCNco2fBeTgY45LtX1sYtxxVH1adAxioQlppi8otoPPpz ILyg== X-Received: by 10.50.112.100 with SMTP id ip4mr16063060igb.78.1447339476453; Thu, 12 Nov 2015 06:44:36 -0800 (PST) Received: from klimt.1015granger.net ([2604:8800:100:81fc:ec4:7aff:fe6c:6aa0]) by smtp.gmail.com with ESMTPSA id c92sm5105241iod.0.2015.11.12.06.44.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2015 06:44:35 -0800 (PST) Subject: [PATCH] svcrdma: Do not send XDR roundup bytes for a write chunk From: Chuck Lever To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, linux-rmda@vger.kernel.org Date: Thu, 12 Nov 2015 09:44:33 -0500 Message-ID: <20151112144433.13507.34603.stgit@klimt.1015granger.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Minor optimization: when dealing with write chunk XDR roundup, do not post a Write WR for the zero bytes in the pad. Simply update the write segment in the RPC-over-RDMA header to reflect the extra pad bytes. The Reply chunk is also a write chunk, but the server does not use send_write_chunks() to send the Reply chunk. That's OK in this case: the server Upper Layer typically marshals the Reply chunk contents in a single contiguous buffer, without a separate tail for the XDR pad. The comments and the variable naming refer to "chunks" but what is really meant is "segments." The existing code sends only one xdr_write_chunk per RPC reply. The fix assumes this as well. When the XDR pad in the first write chunk is reached, the assumption is the Write list is complete and send_write_chunks() returns. That will remain a valid assumption until the server Upper Layer can support multiple bulk payload results per RPC. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 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/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index 1dfae83..6c48901 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -342,6 +342,13 @@ static int send_write_chunks(struct svcxprt_rdma *xprt, arg_ch->rs_handle, arg_ch->rs_offset, write_len); + + /* Do not send XDR pad bytes */ + if (chunk_no && write_len < 4) { + chunk_no++; + break; + } + chunk_off = 0; while (write_len) { ret = send_write(xprt, rqstp,