All of lore.kernel.org
 help / color / mirror / Atom feed
From: hare@suse.de (Hannes Reinecke)
Subject: [PATCH 5/5] nvme: ANA base support
Date: Sat, 5 May 2018 15:23:01 +0200	[thread overview]
Message-ID: <a5fa01aa-d4c4-1ada-cc99-d267250042cd@suse.de> (raw)
In-Reply-To: <SN6PR06MB3984921468FB9721423BD0ED8C860@SN6PR06MB3984.namprd06.prod.outlook.com>

On 05/05/2018 12:11 AM, Schremmer, Steven wrote:
>>   int nvme_reset_ctrl(struct nvme_ctrl *ctrl)
>>   {
>> @@ -1488,6 +1489,9 @@ static int nvme_revalidate_disk(struct gendisk *disk)
>>   		goto out;
>>   	}
>>
>> +	if (ctrl->subsys->cmic & (1 << 3))
>> +		nvme_get_ana_log(ctrl, ns);
>> +
> If __nvme_revalidate_disk() would save the groupid from the Identify Namespace data,
> then finding the ANA state in the log page could be done more quickly.
> 
Good idea. Will be doing it.

>>   	__nvme_revalidate_disk(disk, id);
>>   	nvme_report_ns_ids(ctrl, ns->head->ns_id, id, &ids);
>>   	if (!nvme_ns_ids_equal(&ns->head->ids, &ids)) {
>> @@ -2276,6 +2280,61 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl)
>>   	return ret;
>>   }
>>
>> +static void nvme_get_ana_log(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
>> +{
>> +	int i, j;
>> +	struct nvmf_ana_rsp_page_header *ana_log;
>> +	size_t ana_log_size = 4096;
>> +
>> +	ana_log = kzalloc(ana_log_size, GFP_KERNEL);
>> +	if (!ana_log)
>> +		return;
>> +
>> +	if (nvme_get_log(ctrl, NVME_LOG_ANA, ana_log, ana_log_size))
>> +		dev_warn(ctrl->device,
>> +			 "Get ANA log error\n");
>> +	for (i = 0; i < ana_log->grpid_num; i++) {
>> +		struct nvmf_ana_group_descriptor *desc =
>> +			&ana_log->desc[i];
>> +		for (j = 0; j < desc->nsid_num; j++) {
>> +			if (desc->nsid[j] == ns->head->ns_id) {
>> +				ns->ana_state = desc->ana_state;
>> +				ns->ana_group = desc->groupid;
> Maybe jump out of the for loops here?
> 
Yes, should be doing so.

>> @@ -3370,6 +3485,10 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
>>   	case NVME_AER_NOTICE_FW_ACT_STARTING:
>>   		queue_work(nvme_wq, &ctrl->fw_act_work);
>>   		break;
>> +	case NVME_AER_NOTICE_ANA_CHANGE:
>> +		dev_info(ctrl->device, "ANA state change\n");
>> +		queue_work(nvme_wq, &ctrl->ana_change_work);
>> +		break;
> I think eventually we'll need a way for the AER work to potentially force a call to
> __nvme_find_path() to choose a better current_path based on the updated ANA states.
> 
Actually, it should be sufficient to just unset the current path; the 
algorithm will find the next best path then.
But yes, true, we should be doing it.
(I had the Optimized/Inaccessible scenario in mind here; there the new 
path will be selected automatically as we'd be getting an error from the 
Inaccessible path. But for Optimized/non-optimized the new path won't be 
chosen automatically as the original path remains valid.)

Thanks for the hints.

Cheers,

Hannes

  reply	other threads:[~2018-05-05 13:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 11:28 [RFC PATCH 0/5] nvme: ANA support Hannes Reinecke
2018-05-04 11:28 ` [PATCH 1/5] nvmet: EUI64 support Hannes Reinecke
2018-05-07  7:17   ` Johannes Thumshirn
2018-05-09  7:08   ` Christoph Hellwig
2018-05-09  7:45     ` Hannes Reinecke
2018-05-09  7:52       ` Christoph Hellwig
2018-05-09 15:43   ` Ewan D. Milne
2018-05-04 11:28 ` [PATCH 2/5] nvme: Add ANA base definitions Hannes Reinecke
2018-05-04 16:17   ` Keith Busch
2018-05-04 17:03     ` Meneghini, John
2018-05-04 17:21       ` Knight, Frederick
2018-05-05 13:17       ` Hannes Reinecke
2018-05-04 21:12   ` Schremmer, Steven
2018-05-09  7:27   ` Christoph Hellwig
2018-05-04 11:28 ` [PATCH 3/5] nvmet: Add ANA base support Hannes Reinecke
2018-05-06  2:42   ` Guan Junxiong
2018-05-04 11:28 ` [PATCH 4/5] block: BLK_STS_NEXUS is a path failure Hannes Reinecke
2018-05-09  7:31   ` Christoph Hellwig
2018-05-04 11:28 ` [PATCH 5/5] nvme: ANA base support Hannes Reinecke
2018-05-04 22:11   ` Schremmer, Steven
2018-05-05 13:23     ` Hannes Reinecke [this message]
2018-05-06  3:23   ` Guan Junxiong
2018-05-07  7:21   ` Johannes Thumshirn
2018-05-09 18:49   ` Ewan D. Milne
2018-05-09 19:03   ` Ewan D. Milne
2018-05-10  9:16     ` Sriram Popuri
     [not found]     ` <CAGYjvj0Mk0MFAfUEApOOyQ9Prm3CvGcZH14PJzDQT2+Qc+w81w@mail.gmail.com>
2018-05-10 13:40       ` Hannes Reinecke
2018-05-11  7:50       ` Hannes Reinecke
2018-05-11  8:22         ` Popuri, Sriram
2018-05-11  8:36           ` Popuri, Sriram
2018-05-11 16:24             ` Knight, Frederick
2018-05-12 13:31   ` Christoph Hellwig
2018-05-13 10:33     ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5fa01aa-d4c4-1ada-cc99-d267250042cd@suse.de \
    --to=hare@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.