From patchwork Mon Jan 8 19:00:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10150363 X-Patchwork-Delegate: dledford@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AAFD1602CA for ; Mon, 8 Jan 2018 19:01:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5EA8287B1 for ; Mon, 8 Jan 2018 19:01:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAB13289DC; Mon, 8 Jan 2018 19:01:05 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 56101287B1 for ; Mon, 8 Jan 2018 19:01:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932099AbeAHTBD (ORCPT ); Mon, 8 Jan 2018 14:01:03 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:14098 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932097AbeAHTAz (ORCPT ); Mon, 8 Jan 2018 14:00:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1515438056; x=1546974056; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=hSBvIxWG37r6rUC6CKjzlvNO19buxpmDT6mQQ+cgLvI=; b=Roy2hKJU/oEE3XLyzou+6bA61PLDL9GuNbf2V/v1oHOpOQD6NVwYEUt3 oviHI2cyhidy62oVuF8mgfJQGRJaERmYFirQ7NmX10UPrv1fnsRiCcyXL HfhIljxQmZl6u2jncY+5cUrXlCTjqTtiptk4J3pU2tn1x9JPQ+ag/WDvh UJDMJvtMqyJdm6RPu/1ApS+0WunMT+d4s26RCihYhFT8R5P8C+TA2E6Ho 5J5FiYl1vLtUZd3AS7DYayLMpsgl0XQz82ALgKawgOqVlHVM6XB6PY2C2 1k/SZ59NAybKRSy251TxFk84pSbvYjHIilT6LnRSfjsoGxbqQm/A646s3 A==; X-IronPort-AV: E=Sophos;i="5.46,332,1511798400"; d="scan'208";a="68728523" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 09 Jan 2018 03:00:53 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 08 Jan 2018 10:56:50 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Jan 2018 11:00:54 -0800 From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Bart Van Assche Subject: [PATCH 11/12] IB/srpt: Inline srpt_get_cmd_state() Date: Mon, 8 Jan 2018 11:00:50 -0800 Message-Id: <20180108190051.32008-12-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180108190051.32008-1-bart.vanassche@wdc.com> References: <20180108190051.32008-1-bart.vanassche@wdc.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is not necessary to obtain ioctx->spinlock when reading the ioctx state. Since after removal of this locking only a single line remains, inline the srpt_get_cmd_state() function. Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index e4c1446699a9..d2835b0c15e8 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -752,23 +752,6 @@ static void srpt_free_ioctx_ring(struct srpt_ioctx **ioctx_ring, kfree(ioctx_ring); } -/** - * srpt_get_cmd_state - get the state of a SCSI command - * @ioctx: Send I/O context. - */ -static enum srpt_command_state srpt_get_cmd_state(struct srpt_send_ioctx *ioctx) -{ - enum srpt_command_state state; - unsigned long flags; - - BUG_ON(!ioctx); - - spin_lock_irqsave(&ioctx->spinlock, flags); - state = ioctx->state; - spin_unlock_irqrestore(&ioctx->spinlock, flags); - return state; -} - /** * srpt_set_cmd_state - set the state of a SCSI command * @ioctx: Send I/O context. @@ -1303,7 +1286,7 @@ static void srpt_rdma_read_done(struct ib_cq *cq, struct ib_wc *wc) target_execute_cmd(&ioctx->cmd); else pr_err("%s[%d]: wrong state = %d\n", __func__, - __LINE__, srpt_get_cmd_state(ioctx)); + __LINE__, ioctx->state); } /** @@ -2372,7 +2355,7 @@ static int srpt_write_pending_status(struct se_cmd *se_cmd) struct srpt_send_ioctx *ioctx; ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd); - return srpt_get_cmd_state(ioctx) == SRPT_STATE_NEED_DATA; + return ioctx->state == SRPT_STATE_NEED_DATA; } /* @@ -2951,7 +2934,7 @@ static int srpt_get_tcm_cmd_state(struct se_cmd *se_cmd) struct srpt_send_ioctx *ioctx; ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd); - return srpt_get_cmd_state(ioctx); + return ioctx->state; } static int srpt_parse_guid(u64 *guid, const char *name)