Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp899902rdb; Fri, 1 Sep 2023 07:21:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXKk0IwiBtlxO2wVeVFAXEubHTVdPZCHkKtORNHPaJE2CY3lrf9YGqLLxEc8BcgjBjtr4h X-Received: by 2002:a17:902:d2cd:b0:1bf:41b6:938e with SMTP id n13-20020a170902d2cd00b001bf41b6938emr3785840plc.40.1693578080774; Fri, 01 Sep 2023 07:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693578080; cv=none; d=google.com; s=arc-20160816; b=eoRRqLXKLgeBVYcgF5Bx1kPoTNcjG4Rqw8BILXu5IeQcgun9CWPAAY9d/mZ/RHvy8i N++0bKLm1/DI7Gw1olaD8IqS6m1eP+LEnoOAljqJTteTtPsJxIMnaXPpzBE6HGX5L+8C ECrrR/vm0uXA98/T5Xn7tLTWuQP9TZMicWChN6VM4AVJOCGXYbqsIYnSfldVYKAlmuwE SMw7VfMLDdepl/E1evEeXVF11Fjs4TtsG6Gq3/7DyincVYvwefcGuK3yJXQ5RroRhs5d oAZCM+8WGoWJWR6aBcZwOjfLe8Ov0DbfehVd7RRlWpDdkrTmw3xTQ6G+NGT92O/NaOm9 Wa0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+BNoU7pIk2xN4hP/kgrtrh1RShx8AmmgLSVbvpkThh0=; fh=U8QwZ5xHaU2/8ln497S/E2sKzHGkM9mdrpYdmq3DJOs=; b=B04pk16OKgzQlIolDyYXjy4GTnkKG9GS0SAcA+dXxfm1J8dNXECExKosyYtOyUGvAW LlbRdsJnVjneR29w89BI8tP9dum8adjFkHQSjs1e7ffDqgHPtuI7KXcSDpFGULZy4dT/ vmFqWRLxSfPl9SpBhSO6a1abXlnecQqtn75YEV4zN1wuynCDmDzribMv7/mL3qSTSUF1 Cdw5aZQviglMyPXVXiOzlEFINMgX1K1uvr+Sqtt/KXB1sGAxXM3cMYTOJi/bKLgCEGzi hXfCav+3e29dTTscTQWav5j8t1z3w+hvEoPSViWXzyKjVaJTQjYTGmxCQFA8NA64f+g0 tlCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk12-20020a170903070c00b001c07bac13d0si2716311plb.383.2023.09.01.07.21.05; Fri, 01 Sep 2023 07:21:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348886AbjIAJmI (ORCPT + 99 others); Fri, 1 Sep 2023 05:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239516AbjIAJmA (ORCPT ); Fri, 1 Sep 2023 05:42:00 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D81410D5; Fri, 1 Sep 2023 02:41:54 -0700 (PDT) Received: from kwepemm600012.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RcY0q1Wbjz1L8yr; Fri, 1 Sep 2023 17:40:11 +0800 (CST) Received: from build.huawei.com (10.175.101.6) by kwepemm600012.china.huawei.com (7.193.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 1 Sep 2023 17:41:51 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , CC: Hannes Reinecke , , , , Wenchao Hao Subject: [RFC PATCH v2 02/19] scsi: scsi_error: Move complete variable eh_action from shost to sdevice Date: Fri, 1 Sep 2023 17:41:10 +0800 Message-ID: <20230901094127.2010873-3-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230901094127.2010873-1-haowenchao2@huawei.com> References: <20230901094127.2010873-1-haowenchao2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600012.china.huawei.com (7.193.23.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org eh_action is used to wait for error handle command's completion if scsi command is send in error handle. Now the error handler might based on scsi_device, so move it to scsi_device. This is preparation for a genernal LUN/target based error handle strategy. Signed-off-by: Wenchao Hao --- drivers/scsi/scsi_error.c | 6 +++--- include/scsi/scsi_device.h | 2 ++ include/scsi/scsi_host.h | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 1d1d97b94613..879fdd7c165b 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -914,7 +914,7 @@ void scsi_eh_done(struct scsi_cmnd *scmd) SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, "%s result: %x\n", __func__, scmd->result)); - eh_action = scmd->device->host->eh_action; + eh_action = scmd->device->eh_action; if (eh_action) complete(eh_action); } @@ -1203,7 +1203,7 @@ static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd, retry: scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes); - shost->eh_action = &done; + sdev->eh_action = &done; scsi_log_send(scmd); scmd->submitter = SUBMITTED_BY_SCSI_ERROR_HANDLER; @@ -1246,7 +1246,7 @@ static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd, rtn = SUCCESS; } - shost->eh_action = NULL; + sdev->eh_action = NULL; scsi_log_completion(scmd, rtn); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 08ed9a03015d..df3f1b8d1390 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -324,6 +324,8 @@ struct scsi_device { enum scsi_device_state sdev_state; struct task_struct *quiesced_by; struct scsi_device_eh *eh; + struct completion *eh_action; /* Wait for specific actions */ + /* on the device. */ unsigned long sdev_data[]; } __attribute__((aligned(sizeof(unsigned long)))); diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 70b7475dcf56..def0d99e9b36 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -554,8 +554,6 @@ struct Scsi_Host { struct list_head eh_abort_list; struct list_head eh_cmd_q; struct task_struct * ehandler; /* Error recovery thread. */ - struct completion * eh_action; /* Wait for specific actions on the - host. */ wait_queue_head_t host_wait; const struct scsi_host_template *hostt; struct scsi_transport_template *transportt; -- 2.35.3