From patchwork Fri Feb 10 01:28:43 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: 9565773 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 4DCD060572 for ; Fri, 10 Feb 2017 01:29:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FB2228552 for ; Fri, 10 Feb 2017 01:29:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 323DF2853A; Fri, 10 Feb 2017 01:29:37 +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 7580F2853A for ; Fri, 10 Feb 2017 01:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbdBJB3b (ORCPT ); Thu, 9 Feb 2017 20:29:31 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:15691 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751452AbdBJB33 (ORCPT ); Thu, 9 Feb 2017 20:29:29 -0500 X-IronPort-AV: E=Sophos;i="5.33,348,1477929600"; d="scan'208";a="82349530" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2017 09:29:00 +0800 Received: from MILHUBIP04.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 A0.97.57638.C571D985; Thu, 9 Feb 2017 17:29:00 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.9.6) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Thu, 9 Feb 2017 17:28:56 -0800 X-AuditID: 0ac94369-26dee9800001e126-ff-589d175c6bf1 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 96.9F.11415.7571D985; Thu, 9 Feb 2017 17:28:55 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Christoph Hellwig , David Disseldorp Subject: [PATCH v5 13/22] target: Reduce number of __transport_wait_for_tasks() arguments Date: Thu, 9 Feb 2017 17:28:43 -0800 Message-ID: <20170210012852.15735-14-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170210012852.15735-1-bart.vanassche@sandisk.com> References: <20170210012852.15735-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRmVeSWpSXmKPExsXCddJ5kW6M+NwIg+XH9Sy+/p/OYrFy9VEm i7bVZxgtWpe+ZXJg8bi//QiTx+6bDWwem09Xe3zeJBfAEsVlk5Kak1mWWqRvl8CVcffIf7aC FzIVzYfvsTcw9kh0MXJySAiYSPS3L2XpYuTiEBJYyiRxY+MGdghnK6PErnnd7DBVG2e0QSU2 Mkqs3fGeCSTBJmAk8e39TBYQWwTIXt2zjAmkiFlgGqNEz+XzjCAJYYFIiY4pi5lBbBYBFYnD 686DTeUVcJD4vXIGM8QGeYldbRdZQWxOoPir2deBbA6gbfYSO3YZgMyUEGhilfjUsBKqV1Di 5MwnYIuZBSQkDr54ATZHSEBd4uSS+UwTGIVmISmbhaRsASPTKkax3Myc4tz01AJDU73ixLyU zOJsveT83E2MkNDO3MF494n3IUYBDkYlHt4XNXMihFgTy4orcw8xSnAwK4nw3uebGyHEm5JY WZValB9fVJqTWnyIUZqDRUmc95zM1AghgfTEktTs1NSC1CKYLBMHp1QDY+78SBYh67S72i/m G4ZlKXfpxew3uTJT58bPZ/NWlydq/b5ey565Zffpg5MkxUtKtvRP89esKp36vlj/cOXVg917 uS2UJU5PqH1qEr9bZfXdN/a1l8QnbJPUPFR7WOvr9wRhJUV/p2MtsgefeS2STPHKYdPdFBlf sLltuu35T5WLS68wOpqkKLEUZyQaajEXFScCAKUneftpAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCJMWRmVeSWpSXmKPExsXCtZGTTTdcfG6EwdoN8hYHf7YxWnz9P53F YuXqo0wWbavPMFq0Ln3L5MDqcX/7ESaP3Tcb2DymrTnP5LH5dLXH501yAaxRXDYpqTmZZalF +nYJXBl3j/xnK3ghU9F8+B57A2OPRBcjJ4eEgInExhlt7CC2kMB6RokFR/NAbDYBI4lv72ey gNgiQPbqnmVMXYxcHMwC0xglrryawgqSEBaIlOiYspgZxGYRUJV4efwJG4jNK+Ag8XLCTHaI BfISu9ougtVzAsVfzb4OZHMALbOX2LHLYAIj9wJGhlWMYrmZOcW56ZkFhoZ6xYl5KZnF2XrJ +bmbGCHhELmD8elE80OMTBycUg2MK188eFWipOn+ZbH3Me5gvRtfe3gjTh1gqPmzV0AyZPXc q2z7NKfnNN2M5FVOiN1910r2nTNfWOz9jW9injm5bXxoG2A9U7bp/eWObWc6DYJeTbrL4hj+ KsX8o1HQehsW8c7Qdxe4rRZN57jc5ZkY6Z/zeHH01EkbWra9COVe+Hdx9fY6rYPVSizFGYmG WsxFxYkA329W2bcBAAA= 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 0eaf69db4d33..89f8c4c3ba47 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2508,28 +2508,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 @@ -2773,9 +2770,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) { @@ -2786,12 +2782,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; @@ -2803,7 +2793,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; @@ -2834,10 +2824,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;