Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp857783ybh; Tue, 10 Mar 2020 09:32:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuP6vKEc11wbKufpouJ8ChS6FrXe/n+MQJ/spo7qfyexGKta5ObNBYHYIC1LaxfUWYPGyk6 X-Received: by 2002:a54:4119:: with SMTP id l25mr1796325oic.83.1583857938834; Tue, 10 Mar 2020 09:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583857938; cv=none; d=google.com; s=arc-20160816; b=PE77whE8PPZ1c7pZiD3FSTqV9Zj9ogM+bZHuuXYM8xJLKYL/nZtfdK3ehNv41opPsA /OOl4BycS5XKgXnGJy0dXwpa1104xHvhckRxGYBV7ro2aWD2sEvExQ0pb/izzwuFsEpx 16K1gZnc4R0d7uJmWz3IlnbrY01WfBzeJhrJQah6EjwHtS8yQvnGKBGnuU0yQOh0+yji mTibEQdBZ6yMo7D/lsSsabn31bCAKayhGCMyfhvTJPS0AM9wMysoCmUrPS+wlLtk/Ce3 swLb/SlwAfri5xyO+VrOOTFqBsfLLm6LEqZ3io3rLTODX6UuDcUro+wg0/Krsc5PVi/A 3ONg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=95pcO40GyU6+43PhMc1DAtDrPdQUsQfJmPsIwvHEgnw=; b=mMiFlSlXT/d5DJzgukH4KYEgMOObEGOR7HfycPaPrCIKHzLPpAiZ94V1ajhJJ/u1dY mMV/ZKu20E9qusg/S45iWHfYyxZV/8We9eb+p5b4oLYP8/D8HXJokPwIXEAeG1x3gs7w SR5BlJTqRLN7z1LGq2FCO8dHgCsFT7vMkF+YThevqqzD4pokcLCvI+vacIV7Idjcd/ci ER7n/wUSQUoRuyi3/UHIgOC4NDYeN4yPD0bhdZyzkRM3aCzCLnkhLIUIN5nSEZyKEWG7 Egon0Qhc/vFpGOrO602yj53EutcGmgUyhZkqY7pbdbPADcIM/7sL1krk3MG+U/AAA5+v 4kfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j12si5997625oie.187.2020.03.10.09.32.06; Tue, 10 Mar 2020 09:32:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727533AbgCJQbZ (ORCPT + 99 others); Tue, 10 Mar 2020 12:31:25 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11217 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726971AbgCJQbX (ORCPT ); Tue, 10 Mar 2020 12:31:23 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id BBED8F606B6A729E0B6A; Wed, 11 Mar 2020 00:30:38 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Wed, 11 Mar 2020 00:30:31 +0800 From: John Garry To: , , , , , , CC: , , , , , , Hannes Reinecke Subject: [PATCH RFC v2 21/24] dpt_i2o: drop cmd_list usage Date: Wed, 11 Mar 2020 00:25:47 +0800 Message-ID: <1583857550-12049-22-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1583857550-12049-1-git-send-email-john.garry@huawei.com> References: <1583857550-12049-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hannes Reinecke Now each command has a unique tag, so we can drop the legacy 'cmd_list' usage and rely on the tag to identify the command. Signed-off-by: Hannes Reinecke --- drivers/scsi/dpt_i2o.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index abc74fd474dc..4c7305bf6b57 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -2335,7 +2335,6 @@ static s32 adpt_scsi_host_alloc(adpt_hba* pHba, struct scsi_host_template *sht) host->unique_id = (u32)sys_tbl_pa + pHba->unit; host->sg_tablesize = pHba->sg_tablesize; host->can_queue = pHba->post_fifo_size; - host->use_cmd_list = 1; return 0; } @@ -2647,20 +2646,18 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) return 0; } -static void adpt_fail_posted_scbs(adpt_hba* pHba) +static bool adpt_fail_posted_scbs_iter(struct request *req, void *data, bool reserved) { - struct scsi_cmnd* cmd = NULL; - struct scsi_device* d = NULL; + struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); - shost_for_each_device(d, pHba->host) { - unsigned long flags; - spin_lock_irqsave(&d->list_lock, flags); - list_for_each_entry(cmd, &d->cmd_list, list) { - cmd->result = (DID_OK << 16) | (QUEUE_FULL <<1); - cmd->scsi_done(cmd); - } - spin_unlock_irqrestore(&d->list_lock, flags); - } + cmd->result = (DID_OK << 16) | (QUEUE_FULL <<1); + cmd->scsi_done(cmd); + return true; +} + +static void adpt_fail_posted_scbs(adpt_hba* pHba) +{ + blk_mq_tagset_busy_iter(&pHba->host->tag_set, adpt_fail_posted_scbs_iter, NULL); } -- 2.17.1