From patchwork Wed Feb 8 22:24:55 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: 9563667 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 A6E9E6020F for ; Wed, 8 Feb 2017 22:28:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 798A9284F2 for ; Wed, 8 Feb 2017 22:28:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E9972852C; Wed, 8 Feb 2017 22:28:15 +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 DE64D284F2 for ; Wed, 8 Feb 2017 22:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751910AbdBHW2N (ORCPT ); Wed, 8 Feb 2017 17:28:13 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:63832 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751727AbdBHW2I (ORCPT ); Wed, 8 Feb 2017 17:28:08 -0500 X-IronPort-AV: E=Sophos;i="5.35,348,1483977600"; d="scan'208";a="76618053" Received: from unknown (HELO milsmgep14.sandisk.com) ([63.163.107.225]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2017 06:28:24 +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 48.72.18895.DCA9B985; Wed, 8 Feb 2017 14:25:17 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Wed, 8 Feb 2017 14:25:11 -0800 X-AuditID: 0ac94371-0fadb980000049cf-03-589b9acd151b Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 36.42.18148.7CA9B985; Wed, 8 Feb 2017 14:25:11 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: Subject: [PATCH v4 25/37] target: Remove command flag CMD_T_BUSY Date: Wed, 8 Feb 2017 14:24:55 -0800 Message-ID: <20170208222507.25715-26-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+NgFtrBLMWRmVeSWpSXmKPExsXCddJ5ke7ZWbMjDJY91LFoXfqWyYHR4/Mm uQDGKC6blNSczLLUIn27BK6M6Y1/2Qomylecbz3J1MB4VKqLkZNDQsBE4uuVvcxdjFwcQgJL mSS63h5lgXC2M0qsfLiZCaZq+pSPUImNjBLdHXPAEmwCRhLf3s9kAbFFBAwkfvdeYASxmQWU JPZMXQZWIyzgIPFz/gPWLkYODhYBFYkXW2VAwrxA4W1T5jBDzJeX2NV2kRXE5gSKT3j5DGyM kIC9xKsDXxhB9koIXGaROLF0OyNEs6DEyZlPWCB2SUgcfPGCGaJBXeLkkvlMExiFZiEpm4Wk bAEj0ypGsdzMnOLc9NQCQxO94sS8lMzibL3k/NxNjJDwLNzB+Pq29yFGAQ5GJR7eC9azI4RY E8uKK3MPMUpwMCuJ8KZMAwrxpiRWVqUW5ccXleakFh9ilOZgURLnzZKdGiEkkJ5YkpqdmlqQ WgSTZeLglGpg9JP9um/+c1GfZb3t62NE5l/oc/xXbSHS53cgaJOk47mdC95NMN7TLl7UcS4t +tGLAyFnn5p6Zk9Nfq0++eefvVor6ySW6L4Kv2Z17rdQpXXyASGOKXNeRK/X/5r+Uo37USXL Hou13s3rYqdUvbnmZrl4XZeSWeyNbu6dHWfThfcu8rq+ZtkKGyWW4oxEQy3mouJEAO62JDJL AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkuLIzCtJLcpLzFFi42Lh2sjJpnt81uwIg0+9JhYHf7YxWrQufcvk wOQxbc15Jo/Pm+QCmKK4bFJSczLLUov07RK4MqY3/mUrmChfcb71JFMD41GpLkZODgkBE4np Uz6ydDFycQgJrGeUePThDgtIgk3ASOLb+5lgtoiAgcTv3guMIDazgILExamzwGxhAQeJn/Mf sILYLAKqEht/t4DZvEDxaff2MUMskJfY1XYRLM4JFJ/w8hlYr5CAvcSrA18YJzByL2BkWMUo lpuZU5ybnllgaKRXnJiXklmcrZecn7uJEeLXqB2M1yeaH2Jk4uCUamBs/fvSeOYF+7fPxISX y+1py37002Bb4lRFE9sjhccu18dNO9r3q3ceY5Y9T3h39Oytrn4qzrUv3+1+6BQjMO3pa8vY NVZbH+xs8Xi0zGWvS6pa1QzTg0JR8UoxG/z2Pn5i5sL0pHFH7+ldGmfjSsMV1OfEvFR+P/Xa Kamf3RKn4sV8dpmYzWtWYinOSDTUYi4qTgQAG4GwHZsBAAA= 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 patch that reworks task management function handling guarantees that target_remove_from_state_list() is always called with CMD_T_BUSY cleared. Since that function is the only function that tests that flag this means that that flag is now superfluous. Hence remove that flag. Signed-off-by: Bart Van Assche Reviewed-by: Andy Grover Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Reviewed-by: Hannes Reinecke --- drivers/target/target_core_sbc.c | 2 +- drivers/target/target_core_transport.c | 12 ++++-------- include/target/target_core_base.h | 1 - 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 4879e70e2eef..2eca544c7392 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -600,7 +600,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes spin_lock_irq(&cmd->t_state_lock); cmd->t_state = TRANSPORT_PROCESSING; - cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT; + cmd->transport_state |= CMD_T_ACTIVE | CMD_T_SENT; spin_unlock_irq(&cmd->t_state_lock); __target_execute_cmd(cmd, false); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 4fcfa37a6d2b..646e051d87bf 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -585,9 +585,6 @@ static void target_remove_from_state_list(struct se_cmd *cmd) if (!dev) return; - if (cmd->transport_state & CMD_T_BUSY) - return; - spin_lock_irqsave(&dev->execute_task_lock, flags); if (cmd->state_active) { list_del(&cmd->state_list); @@ -729,7 +726,6 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) cmd->scsi_status = scsi_status; spin_lock_irqsave(&cmd->t_state_lock, flags); - cmd->transport_state &= ~CMD_T_BUSY; if (dev && dev->transport->transport_complete) { dev->transport->transport_complete(cmd, @@ -1798,7 +1794,7 @@ void __target_execute_cmd(struct se_cmd *cmd, bool do_checks) return; err: spin_lock_irq(&cmd->t_state_lock); - cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT); + cmd->transport_state &= ~CMD_T_SENT; spin_unlock_irq(&cmd->t_state_lock); transport_generic_request_failure(cmd, ret); @@ -1826,7 +1822,7 @@ static int target_write_prot_action(struct se_cmd *cmd) sectors, 0, cmd->t_prot_sg, 0); if (unlikely(cmd->pi_err)) { spin_lock_irq(&cmd->t_state_lock); - cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT); + cmd->transport_state &= ~CMD_T_SENT; spin_unlock_irq(&cmd->t_state_lock); transport_generic_request_failure(cmd, cmd->pi_err); return -1; @@ -1912,7 +1908,7 @@ void target_execute_cmd(struct se_cmd *cmd) } cmd->t_state = TRANSPORT_PROCESSING; - cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT; + cmd->transport_state |= CMD_T_ACTIVE | CMD_T_SENT; spin_unlock_irq(&cmd->t_state_lock); if (target_write_prot_action(cmd)) @@ -1920,7 +1916,7 @@ void target_execute_cmd(struct se_cmd *cmd) if (target_handle_task_attr(cmd)) { spin_lock_irq(&cmd->t_state_lock); - cmd->transport_state &= ~(CMD_T_BUSY | CMD_T_SENT); + cmd->transport_state &= ~CMD_T_SENT; spin_unlock_irq(&cmd->t_state_lock); return; } diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 163b98fd11c1..67cb16302fca 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -488,7 +488,6 @@ struct se_cmd { #define CMD_T_SENT (1 << 4) #define CMD_T_STOP (1 << 5) #define CMD_T_DEV_ACTIVE (1 << 7) -#define CMD_T_BUSY (1 << 9) #define CMD_T_TAS (1 << 10) #define CMD_T_FABRIC_STOP (1 << 11) spinlock_t t_state_lock;