linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH v3] nvme: make sure ns head inherits underlying device limits
Date: Fri, 2 Nov 2018 10:16:21 -0700	[thread overview]
Message-ID: <7b322de4-020f-71ee-9660-a131305f7cee@grimberg.me> (raw)
In-Reply-To: <20181102054139.GA16212@lst.de>

>> @@ -1482,6 +1482,7 @@ static bool nvme_ns_ids_equal(struct nvme_ns_ids *a, struct nvme_ns_ids *b)
>>   static void nvme_update_disk_info(struct gendisk *disk,
>>   		struct nvme_ns *ns, struct nvme_id_ns *id)
>>   {
>> +	struct nvme_ns *n;
>>   	sector_t capacity = le64_to_cpup(&id->nsze) << (ns->lba_shift - 9);
>>   	unsigned short bs = 1 << ns->lba_shift;
>>   
>> @@ -1506,6 +1507,9 @@ static void nvme_update_disk_info(struct gendisk *disk,
>>   	else
>>   		set_disk_ro(disk, false);
>>   
>> +	list_for_each_entry_rcu(n, &ns->head->list, siblings)
>> +		blk_queue_stack_limits(disk->queue, n->queue);
> 
> I think this should only be done for ns->head_disk, nor the disks
> attached to the namespaces.

Well the siblings list would be empty for the namespaces themselves.

I could move this to the call site:
--
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4325f1aeea1f..ff5d543624a4 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1535,8 +1535,10 @@ static void __nvme_revalidate_disk(struct gendisk 
*disk, struct nvme_id_ns *id)
         if (ns->ndev)
                 nvme_nvm_update_nvm_info(ns);
  #ifdef CONFIG_NVME_MULTIPATH
-       if (ns->head->disk)
+       if (ns->head->disk) {
                 nvme_update_disk_info(ns->head->disk, ns, id);
+               blk_queue_stack_limits(ns->head->disk->queue, ns->queue);
+       }
  #endif
  }
--


>> @@ -2960,6 +2964,10 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
>>   	if (ret)
>>   		goto out_cleanup_srcu;
>>   
>> +#ifdef CONFIG_NVME_MULTIPATH
>> +	blk_set_stacking_limits(&head->disk->queue->limits);
>> +#endif
> 
> And this should probably done in nvme_mpath_alloc_disk.

Yes, I can do that (the original version had it there but can't
remember why I decided to have it here instead).

      reply	other threads:[~2018-11-02 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 16:04 [PATCH v3] nvme: make sure ns head inherits underlying device limits Sagi Grimberg
2018-11-02  5:41 ` Christoph Hellwig
2018-11-02 17:16   ` Sagi Grimberg [this message]

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=7b322de4-020f-71ee-9660-a131305f7cee@grimberg.me \
    --to=sagi@grimberg.me \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).