From patchwork Tue Sep 4 21:05:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10587939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48C44180E for ; Tue, 4 Sep 2018 21:06:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3861E29FC2 for ; Tue, 4 Sep 2018 21:06:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D00029BBA; Tue, 4 Sep 2018 21:06:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65B1C29FC2 for ; Tue, 4 Sep 2018 21:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726888AbeIEBdT (ORCPT ); Tue, 4 Sep 2018 21:33:19 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:37638 "EHLO mail-it0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbeIEBdT (ORCPT ); Tue, 4 Sep 2018 21:33:19 -0400 Received: by mail-it0-f42.google.com with SMTP id h20-v6so6706051itf.2 for ; Tue, 04 Sep 2018 14:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=QiQToRvWO3nZ8sJ1DhZaRK+NV0hO8Tc1hr5kzGMQxPo=; b=UQjyJ5IjwDeY16ww0kpn2vocswxHUrAHlsvZeqVqr2lssOz9vtYdMqtDamVwJPWq5j ptWaqTUpyVxrl3hzJrMzynM21eYZZ+VOddFZa3wvlQFqsfs4sA2y8M8nGrC84y2sbr+H d2SSabS3ToQGTh2JK537qs+/IXrMwVmczDHuJfHrKOd8a//J15sP+DtQCY9THtlmmJhU 5J3j0izuXj0WhZVzuD/R4eoSt1arB5Zii3fmGULmX5/SqmsV3DSRG/tDBP1XjXbGiG79 tcEJoKqlESeoA2fy69KdCL6jTVvniaWEtZgA7cYD2y/3KFB+ZvkSvtzSB6YlTnT5sQn7 zfdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QiQToRvWO3nZ8sJ1DhZaRK+NV0hO8Tc1hr5kzGMQxPo=; b=QhsjpFkM7J3wiIma2WiB3n1xhvvjnPt2D7H+h4x6W6dP+TvMNTUun/TUIG68JXcV8l GWJ/faB/MSxFz1LcbVEF/65BtC8SwWkwi4fp5jWwcqMnMayYUw3zY+3remLB5tqEqBN7 W6BFm0AyngaVaMbeZqrFKfTMxj0GCVcIEw94CE1hqTNruqGUphoL7XfLCbIh1KnOk834 dZRlUHCmZuIB1438J11TKMwluU5gBPd2WYU6kLtMZOqFxyKYduhdpiE42pYVO8BU2jDH ozKIRDH5pu5N7vIoPYiR9buzxrXmDGrOV3kBpAi1brfBDt5nT9cy/PIOCFbOQFxlCgnT P0rQ== X-Gm-Message-State: APzg51DtlBmu1ZLW6u9g5b5h2tl2T9mvwPUl+fPk7IrWSW0uXmYCN7O6 6XAiowrT0XeLzmrQmEbjGByN7wE= X-Google-Smtp-Source: ANB0VdbRc3/pDbIe5dPqxRbqDguDs8iC0PbfL1OBZtcIrPOPTE5Mk1x8PBsOlr0CxZ+6tgsDH9H6jw== X-Received: by 2002:a02:1643:: with SMTP id a64-v6mr23903727jaa.133.1536095187396; Tue, 04 Sep 2018 14:06:27 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (c-68-40-195-73.hsd1.mi.comcast.net. [68.40.195.73]) by smtp.gmail.com with ESMTPSA id t64-v6sm172860ita.13.2018.09.04.14.06.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Sep 2018 14:06:26 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v2 22/34] SUNRPC: Simplify xprt_prepare_transmit() Date: Tue, 4 Sep 2018 17:05:37 -0400 Message-Id: <20180904210549.81673-23-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180904210549.81673-22-trond.myklebust@hammerspace.com> References: <20180904210549.81673-1-trond.myklebust@hammerspace.com> <20180904210549.81673-2-trond.myklebust@hammerspace.com> <20180904210549.81673-3-trond.myklebust@hammerspace.com> <20180904210549.81673-4-trond.myklebust@hammerspace.com> <20180904210549.81673-5-trond.myklebust@hammerspace.com> <20180904210549.81673-6-trond.myklebust@hammerspace.com> <20180904210549.81673-7-trond.myklebust@hammerspace.com> <20180904210549.81673-8-trond.myklebust@hammerspace.com> <20180904210549.81673-9-trond.myklebust@hammerspace.com> <20180904210549.81673-10-trond.myklebust@hammerspace.com> <20180904210549.81673-11-trond.myklebust@hammerspace.com> <20180904210549.81673-12-trond.myklebust@hammerspace.com> <20180904210549.81673-13-trond.myklebust@hammerspace.com> <20180904210549.81673-14-trond.myklebust@hammerspace.com> <20180904210549.81673-15-trond.myklebust@hammerspace.com> <20180904210549.81673-16-trond.myklebust@hammerspace.com> <20180904210549.81673-17-trond.myklebust@hammerspace.com> <20180904210549.81673-18-trond.myklebust@hammerspace.com> <20180904210549.81673-19-trond.myklebust@hammerspace.com> <20180904210549.81673-20-trond.myklebust@hammerspace.com> <20180904210549.81673-21-trond.myklebust@hammerspace.com> <20180904210549.81673-22-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove the checks for whether or not we need to transmit, and whether or not a reply has been received. Those are already handled in call_transmit() itself. Signed-off-by: Trond Myklebust --- net/sunrpc/xprt.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 305aa9570873..f1301d391399 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1102,27 +1102,12 @@ bool xprt_prepare_transmit(struct rpc_task *task) { struct rpc_rqst *req = task->tk_rqstp; struct rpc_xprt *xprt = req->rq_xprt; - bool ret = false; dprintk("RPC: %5u xprt_prepare_transmit\n", task->tk_pid); - spin_lock_bh(&xprt->transport_lock); - if (!req->rq_bytes_sent) { - if (req->rq_reply_bytes_recvd) { - task->tk_status = req->rq_reply_bytes_recvd; - goto out_unlock; - } - if (!test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) - goto out_unlock; - } - if (!xprt->ops->reserve_xprt(xprt, task)) { - task->tk_status = -EAGAIN; - goto out_unlock; - } - ret = true; -out_unlock: - spin_unlock_bh(&xprt->transport_lock); - return ret; + if (!xprt_lock_write(xprt, task)) + return false; + return true; } void xprt_end_transmit(struct rpc_task *task)