From patchwork Wed Dec 13 23:50:27 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: 10111179 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 E613B602A7 for ; Wed, 13 Dec 2017 23:50:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D859E295AB for ; Wed, 13 Dec 2017 23:50:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC9D9297AB; Wed, 13 Dec 2017 23:50: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.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 6D8A0295AB for ; Wed, 13 Dec 2017 23:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750992AbdLMXug (ORCPT ); Wed, 13 Dec 2017 18:50:36 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:25093 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbdLMXuf (ORCPT ); Wed, 13 Dec 2017 18:50:35 -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=1513209035; x=1544745035; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Y995emn5eRUkwU+MLt+SEKqDPt9SH3kzdoqAmtySTZ4=; b=fxitmyFIwipiGT/OIk9E0HGzISqgDZpEl3ou8L3iR2NMMduj/lZUSKB2 r0sFWRM/f/I0kEX3KJ13uSAzPnZy6BaC52gTs+ILYjGNVkCA77gxr5ts3 +78ZVih1piZaqHpHZsZcYUQ1YWL7zupG60c/8NWTHkk5P0ZsRxc6AwipK 8KJdFgcbj/I4yQXNdDFit/ZvhGasjSd0pcSk/+w3oli+JbNpQJD03+pmy KJXsacSuUEEd9IpTAkuaZFMy6HID2QU0430cnqugobkqTO4nHSVG1jv8z UPzOIXNWbmJANvRa1kF1AwCLD6YAx/1DFU3qbItb+raG4MBz7U8JQDDVQ A==; X-IronPort-AV: E=Sophos;i="5.45,398,1508774400"; d="scan'208";a="65384153" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 14 Dec 2017 07:50:32 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 13 Dec 2017 15:46:56 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.166.51]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2017 15:50:32 -0800 From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: Nicholas Bellinger , Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Mike Christie Subject: [PATCH 09/11] target: Simplify transport_generic_free_cmd() (2/2) Date: Wed, 13 Dec 2017 15:50:27 -0800 Message-Id: <20171213235029.581-10-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213235029.581-1-bart.vanassche@wdc.com> References: <20171213235029.581-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: Nicholas Bellinger Cc: Christoph Hellwig Cc: Hannes Reinecke 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 6beab4b89414..7bf2248e9664 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2634,12 +2634,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