Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6555401imu; Wed, 30 Jan 2019 17:31:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN4sHsmUwOHuPV+mSntOopmjRyuWBM5HWyJaYL7RsP3z7oCaaGo2xSxYoQOnZ15PB52heqn/ X-Received: by 2002:a17:902:6b0c:: with SMTP id o12mr33211276plk.291.1548898310569; Wed, 30 Jan 2019 17:31:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548898310; cv=none; d=google.com; s=arc-20160816; b=HXIfX2Wccb/eZsFzR8kY7vhSf/8FtTdvUkmsM40anId800gm3AxLV9O8Nt4eFpnyku KS4oMMIAxUc3vbs1GKHj9iYDwDdlUdB3rSqk6z26XZW1SdsWz2997W00bW1h9NoTcazP QgYlC+7gA5qSY5TfW+EVMpT/vKasJ5qzUVx1/n8kyYBRQ/tpIq5oETdEfMPI8FUdJGQ1 5k0jo89T8pbUliriEb2Uo8P23XJWZ3y9dVPXX5pkXm0tmX64NoY5k/TdoosM/U7lmol5 2nC0CEfrcOfuCvuij4iNWAVHE9jeVEg+Bc2cVq51ZjIM0rnRS8RH/TqRxXEb09tnGXQ2 ke2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=iCOl/jKXljcUexmlVj6bENtmvfpbNOZkKz6nHRpSLxk=; b=uSvJrDfG26TFnNCKcPixcXEV+Eoprb1kzG6mMMqnSScIIWkN88C+ly+ADUY2iL8kEC +q/z2rURtR4PtKAQXSMh09JFf7CpgUOkDp11LyUL7u1esH3ig4hoyEhS0iT+F+P6Soif cVsfKZ8mQ79XcGkLLZUpWERB85/gs81LRaMQmfGe46++RtxyoiEtJJY9YdLw+w8JDxCI 7kX7xjidE5qltPieZb/1Wfg8HN54DHLgg+qcWaFwx4YMP/JoNQOoSYmKlrAGbaJfIhyY NqY9YxCcOi/R54Jxi+3OWQUJOLV9WSjCVEuF7jKwPwYb1kfowbXmfPmlH2TAYVTqbbPl +yFw== 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 a35si3087399pla.226.2019.01.30.17.31.33; Wed, 30 Jan 2019 17:31:50 -0800 (PST) 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 S1728326AbfAaBb2 (ORCPT + 99 others); Wed, 30 Jan 2019 20:31:28 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3253 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725535AbfAaBb2 (ORCPT ); Wed, 30 Jan 2019 20:31:28 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 4BE451F5ADE38AD18F50; Thu, 31 Jan 2019 09:31:25 +0800 (CST) Received: from [127.0.0.1] (10.177.96.203) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Thu, 31 Jan 2019 09:31:16 +0800 Subject: Re: [PATCH v2 3/7] scsi: libsas: optimize the debug print of the revalidate process To: John Garry , , References: <20190130082412.9357-1-yanaijie@huawei.com> <20190130082412.9357-4-yanaijie@huawei.com> <2ffa6821-93d4-7925-d435-e34338f323ec@huawei.com> CC: , , , , , , , , , , , , Ewan Milne , Tomas Henzl From: Jason Yan Message-ID: <5C524FE2.9070801@huawei.com> Date: Thu, 31 Jan 2019 09:31:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <2ffa6821-93d4-7925-d435-e34338f323ec@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.96.203] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/1/31 0:41, John Garry wrote: > On 30/01/2019 08:24, Jason Yan wrote: >> sas_rediscover() returns error code if discover failed for a expander >> phy. And sas_ex_revalidate_domain() only returns the last phy's error >> code. So when sas_revalidate_domain() prints the return value of the >> discover process, we do not know if the revalidation for every phy is >> successful or not. We just know the last bcast phy revalidation >> succeeded or not. >> >> No need to return a error code for sas_ex_revalidate_domain() and >> sas_rediscover(), and just print the debug log for each bcast phy >> directly >> in sas_rediscover(). > > do we want to know about every PHY, or just the PHY where res != 0? > Here I mean every PHY that raises bcast. >> > > I don't see any optimisation here. Maybe an improvement. > Thanks, I will change the wording. > >> Signed-off-by: Jason Yan >> CC: John Garry >> CC: Johannes Thumshirn >> CC: Ewan Milne >> CC: Christoph Hellwig >> CC: Tomas Henzl >> CC: Dan Williams >> CC: Hannes Reinecke >> --- >> drivers/scsi/libsas/sas_discover.c | 7 +++---- >> drivers/scsi/libsas/sas_expander.c | 11 ++++++----- >> include/scsi/libsas.h | 2 +- >> 3 files changed, 10 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/scsi/libsas/sas_discover.c >> b/drivers/scsi/libsas/sas_discover.c >> index 726ada9b8c79..ffc571a12916 100644 >> --- a/drivers/scsi/libsas/sas_discover.c >> +++ b/drivers/scsi/libsas/sas_discover.c >> @@ -500,7 +500,6 @@ static void sas_discover_domain(struct work_struct >> *work) >> >> static void sas_revalidate_domain(struct work_struct *work) >> { >> - int res = 0; >> struct sas_discovery_event *ev = to_sas_discovery_event(work); >> struct asd_sas_port *port = ev->port; >> struct sas_ha_struct *ha = port->ha; >> @@ -521,10 +520,10 @@ static void sas_revalidate_domain(struct >> work_struct *work) >> >> if (ddev && (ddev->dev_type == SAS_FANOUT_EXPANDER_DEVICE || >> ddev->dev_type == SAS_EDGE_EXPANDER_DEVICE)) >> - res = sas_ex_revalidate_domain(ddev); >> + sas_ex_revalidate_domain(ddev); >> >> - pr_debug("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", >> - port->id, task_pid_nr(current), res); >> + pr_debug("done REVALIDATING DOMAIN on port %d, pid:%d\n", >> + port->id, task_pid_nr(current)); >> out: >> mutex_unlock(&ha->disco_mutex); >> >> diff --git a/drivers/scsi/libsas/sas_expander.c >> b/drivers/scsi/libsas/sas_expander.c >> index 7b0e6dcef6e6..5cd720f93f96 100644 >> --- a/drivers/scsi/libsas/sas_expander.c >> +++ b/drivers/scsi/libsas/sas_expander.c >> @@ -2062,7 +2062,7 @@ static int sas_rediscover_dev(struct >> domain_device *dev, int phy_id, bool last) >> * first phy,for other phys in this port, we add it to the port to >> * forming the wide-port. >> */ >> -static int sas_rediscover(struct domain_device *dev, const int phy_id) >> +static void sas_rediscover(struct domain_device *dev, const int phy_id) >> { >> struct expander_device *ex = &dev->ex_dev; >> struct ex_phy *changed_phy = &ex->ex_phy[phy_id]; >> @@ -2090,7 +2090,9 @@ static int sas_rediscover(struct domain_device >> *dev, const int phy_id) >> res = sas_rediscover_dev(dev, phy_id, last); >> } else >> res = sas_discover_new(dev, phy_id); >> - return res; >> + >> + pr_debug("ex %016llx phy%d discover returned 0x%x\n", > > Hmmm.. this is not just discover, but also rediscover > Yes, will fix. >> + SAS_ADDR(dev->sas_addr), phy_id, res); >> } >> >> /** >> @@ -2102,7 +2104,7 @@ static int sas_rediscover(struct domain_device >> *dev, const int phy_id) >> * Discover process only interrogates devices in order to discover the >> * domain. >> */ >> -int sas_ex_revalidate_domain(struct domain_device *port_dev) >> +void sas_ex_revalidate_domain(struct domain_device *port_dev) >> { >> int res; >> struct domain_device *dev = NULL; >> @@ -2117,11 +2119,10 @@ int sas_ex_revalidate_domain(struct >> domain_device *port_dev) >> res = sas_find_bcast_phy(dev, &phy_id, i, true); > > this was missed Yes, the return value of sas_find_bcast_phy() is actually unused, and inside the function debug info has been printed. So we can directly make it a void function. > >> if (phy_id == -1) >> break; >> - res = sas_rediscover(dev, phy_id); >> + sas_rediscover(dev, phy_id); >> i = phy_id + 1; >> } while (i < ex->num_phys); >> } >> - return res; >> } >> >> void sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost, >> diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h >> index 420156cea3ee..e557bcb0c266 100644 >> --- a/include/scsi/libsas.h >> +++ b/include/scsi/libsas.h >> @@ -692,7 +692,7 @@ int sas_discover_root_expander(struct >> domain_device *); >> >> void sas_init_ex_attr(void); >> >> -int sas_ex_revalidate_domain(struct domain_device *); >> +void sas_ex_revalidate_domain(struct domain_device *); >> >> void sas_unregister_domain_devices(struct asd_sas_port *port, int gone); >> void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *); >> > > > > . >