From patchwork Wed Feb 8 22:24:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9563677 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 7A8976020F for ; Wed, 8 Feb 2017 22:28:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E1AD284F2 for ; Wed, 8 Feb 2017 22:28:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 417B82852C; Wed, 8 Feb 2017 22:28:36 +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.9 required=2.0 tests=BAYES_00,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 90667284F2 for ; Wed, 8 Feb 2017 22:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751563AbdBHW2e (ORCPT ); Wed, 8 Feb 2017 17:28:34 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:63830 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751443AbdBHW1w (ORCPT ); Wed, 8 Feb 2017 17:27:52 -0500 X-IronPort-AV: E=Sophos;i="5.35,348,1483977600"; d="scan'208";a="76618177" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2017 06:28:21 +0800 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 06.54.57638.BCA9B985; Wed, 8 Feb 2017 14:25:15 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Wed, 8 Feb 2017 14:25:11 -0800 X-AuditID: 0ac94369-26dee9800001e126-fa-589b9acb98ed Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 27.42.18148.7CA9B985; Wed, 8 Feb 2017 14:25:11 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , "Nicholas A . Bellinger" , Christoph Hellwig , David Disseldorp Subject: [PATCH v4 28/37] target: Reduce number of __transport_wait_for_tasks() arguments Date: Wed, 8 Feb 2017 14:24:58 -0800 Message-ID: <20170208222507.25715-29-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170208222507.25715-1-bart.vanassche@sandisk.com> References: <20170208222507.25715-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsXCddJ5ke7pWbMjDB71i1p8/T+dxWLl6qNM Fm2rzzBatC59y+TA4nF/+xEmj903G9g8Np+u9vi8SS6AJYrLJiU1J7MstUjfLoEr49z+66wF L2QqHs06wtrA2CPRxcjJISFgIvHh5F/GLkYuDiGBpUwSj868h3K2M0osn7SNGabq9bofbBCJ jYwSH6f8ZAJJsAkYSXx7P5MFxBYRMJD43XsBrJtZYAajxJutz8ASwgKREmvbtrCC2CwCKhIr H34Am8or4CDxdFMT1AZ5iV1tF8FqOIHiE14+YwSxhQTsJV4d+AI2VEKgi1ViwubF7BDNghIn Zz4BW8AsICFx8MULZogGdYmTS+YzTWAUmoWkbBaSsgWMTKsYxXIzc4pz01MLDE31ihPzUjKL s/WS83M3MUKCO3MH490n3ocYBTgYlXh4KyxnRwixJpYVV+YeYpTgYFYS4U2ZBhTiTUmsrEot yo8vKs1JLT7EKM3BoiTOe05maoSQQHpiSWp2ampBahFMlomDU6qB8ajbZ/ttR9bM0jyw4M22 yd/V5tuffLvmUXOF/2vDxLKDi50PbM15Zbz+0KEahpkLX+zblvB9+nuRk3OOHWJOEEkN+3cz LT77TuzPGZ8n3sp7X7qtg/eoiql1rX7K1EWL9vw40Srbxnr1yg/5/RtmrW5fIvqOLyHwf+nb 0rxN4QZVtxYaJB9u3ndDiaU4I9FQi7moOBEAFSO5G2oCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKJMWRmVeSWpSXmKPExsXCtZGTTff4rNkRBh1fzCwO/mxjtPj6fzqL xcrVR5ks2lafYbRoXfqWyYHV4/72I0weu282sHlMW3OeyWPz6WqPz5vkAlijuGxSUnMyy1KL 9O0SuDLO7b/OWvBCpuLRrCOsDYw9El2MnBwSAiYSr9f9YOti5OIQEljPKHF23XNmkASbgJHE t/czWUBsEQEDid+9FxhBipgFZjBKzHyxgAkkISwQKbG2bQtrFyMHB4uAqsTKt+UgYV4BB4lb X+cxQiyQl9jVdpEVxOYEik94+QwsLiRgL/HqwBfGCYzcCxgZVjGK5WbmFOemZxYYGukVJ+al ZBZn6yXn525ihARE1A7G6xPNDzEycXBKNTDmeunyn5zm2vvnSJ1E5uEnCzpvNG2ckxd6ofn8 7kdXdk3151lXv2iykWxo/eFl9se9WUuPZW5ZWJ8XK/drxeqCY76CM7u6n1Tcms8j6RXi0B3S JFSa+vHE5Knle0wXTZDUu1hT8Hz5myk7jeofnmrUf1NQtOnkm/knFvZEa+7KkJZlefuRr3CV EktxRqKhFnNRcSIAJtX7jLgBAAA= MIME-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The *aborted and *tas variables are set by __transport_wait_for_tasks() but the value that is set is ignored by all callers due to previous patches. Hence remove the code that sets these variables. Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Cc: Nicholas A. Bellinger Cc: Christoph Hellwig Cc: David Disseldorp --- drivers/target/target_core_transport.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 43b49f87dd22..f6d38eba139e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2489,28 +2489,25 @@ static void transport_write_pending_qf(struct se_cmd *cmd) } static bool -__transport_wait_for_tasks(struct se_cmd *, bool, bool *, bool *, - unsigned long *flags); +__transport_wait_for_tasks(struct se_cmd *, bool, unsigned long *flags); -static void target_wait_free_cmd(struct se_cmd *cmd, bool *aborted, bool *tas) +static void target_wait_free_cmd(struct se_cmd *cmd) { unsigned long flags; spin_lock_irqsave(&cmd->t_state_lock, flags); - __transport_wait_for_tasks(cmd, true, aborted, tas, &flags); + __transport_wait_for_tasks(cmd, true, &flags); spin_unlock_irqrestore(&cmd->t_state_lock, flags); } int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) { - bool aborted = false, tas = false; - if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) - target_wait_free_cmd(cmd, &aborted, &tas); + target_wait_free_cmd(cmd); } else { if (wait_for_tasks) - target_wait_free_cmd(cmd, &aborted, &tas); + target_wait_free_cmd(cmd); /* * Handle WRITE failure case where transport_generic_new_cmd() * has already added se_cmd to state_list, but fabric has @@ -2714,9 +2711,8 @@ void transport_clear_lun_ref(struct se_lun *lun) wait_for_completion(&lun->lun_ref_comp); } -static bool -__transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, - bool *aborted, bool *tas, unsigned long *flags) +static bool __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, + unsigned long *flags) __releases(&cmd->t_state_lock) __acquires(&cmd->t_state_lock) { @@ -2727,12 +2723,6 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, if (fabric_stop) cmd->transport_state |= CMD_T_FABRIC_STOP; - if (cmd->transport_state & CMD_T_ABORTED) - *aborted = true; - - if (cmd->transport_state & CMD_T_TAS) - *tas = true; - if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD) && !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) return false; @@ -2744,7 +2734,7 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, if (!(cmd->transport_state & CMD_T_ACTIVE)) return false; - if (fabric_stop && *aborted) + if (fabric_stop && (cmd->transport_state & CMD_T_ABORTED)) return false; cmd->transport_state |= CMD_T_STOP; @@ -2773,10 +2763,10 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, bool transport_wait_for_tasks(struct se_cmd *cmd) { unsigned long flags; - bool ret, aborted = false, tas = false; + bool ret; spin_lock_irqsave(&cmd->t_state_lock, flags); - ret = __transport_wait_for_tasks(cmd, false, &aborted, &tas, &flags); + ret = __transport_wait_for_tasks(cmd, false, &flags); spin_unlock_irqrestore(&cmd->t_state_lock, flags); return ret;