From patchwork Thu Mar 1 22:26:27 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: 10252753 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 06BF560365 for ; Thu, 1 Mar 2018 22:26:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC34E27816 for ; Thu, 1 Mar 2018 22:26:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E10BE286A9; Thu, 1 Mar 2018 22:26:43 +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 8C27F27816 for ; Thu, 1 Mar 2018 22:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162602AbeCAW0m (ORCPT ); Thu, 1 Mar 2018 17:26:42 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:7150 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162585AbeCAW0j (ORCPT ); Thu, 1 Mar 2018 17:26:39 -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=1519943200; x=1551479200; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Q96llpqbrieFTEg5zmGBG0pwxlaxGtCz9AIFjwuP/Qc=; b=F6JXWP+bgdWkIzf8jg/cKxpOUBc8E/bPSHSgzHITyoXTCRm/JT75mGBd NdGffz0jhKIH+8ioE43HIoFEZqlXQbqGeC2nH3tbVzpBR3aiwF22xtJ70 hS+06+1ZtDyQjP/GQU1dajAmND5U0gpGXyF5g2g6kTgauFq1btX3aIONi mpCNqzkkqPQBxCXDqFc2W3p/I4fJEhWLd7vKzlxRax0/VToLopsolnBvC ZW3Kzsb1LAg5O/NmbpeSNBtznxXgwfXISNzRYSqjupo+lmxYLA5BFw6xO MohQKY6c5k2wivUlTnw03+Avq/VRLVGxF5hf5nMah3Z3b84oaT8HmWa9n A==; X-IronPort-AV: E=Sophos;i="5.47,409,1515427200"; d="scan'208";a="72564601" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Mar 2018 06:26:35 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 01 Mar 2018 14:20:38 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Mar 2018 14:26:35 -0800 From: Bart Van Assche To: Nicholas Bellinger Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Mike Christie Subject: [PATCH 09/14] target: Simplify transport_generic_free_cmd() (2/2) Date: Thu, 1 Mar 2018 14:26:27 -0800 Message-Id: <20180301222632.31507-10-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180301222632.31507-1-bart.vanassche@wdc.com> References: <20180301222632.31507-1-bart.vanassche@wdc.com> 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 Since target_wait_free_cmd() skips TMFs with no associated LUN, it is safe to call that function for such commands. Use this to simplify transport_generic_free_cmd(). The only functional change in this patch is that CMD_T_FABRIC_STOP gets set for TMFs with no associated LUN by transport_generic_free_cmd(). Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Mike Christie --- drivers/target/target_core_transport.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 92682400995e..c8f19a143f5c 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2599,12 +2599,10 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) int ret = 0; 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); - } else { - if (wait_for_tasks) - target_wait_free_cmd(cmd, &aborted, &tas); + if (wait_for_tasks) + target_wait_free_cmd(cmd, &aborted, &tas); + + if (cmd->se_cmd_flags & SCF_SE_LUN_CMD) { /* * Handle WRITE failure case where transport_generic_new_cmd() * has already added se_cmd to state_list, but fabric has