mirror of https://gitee.com/openkylin/linux.git
nvme: remove ns->disk checks
By the time a namespace is added to ctrl->namespaces list and thus can be looked up ns->disk has been assigned, and it it never cleared. Remove all the checks for ns->disk being NULL. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This commit is contained in:
parent
359c1f88ab
commit
3913f4f3a6
|
@ -100,7 +100,7 @@ static void nvme_set_queue_dying(struct nvme_ns *ns)
|
||||||
* Revalidating a dead namespace sets capacity to 0. This will end
|
* Revalidating a dead namespace sets capacity to 0. This will end
|
||||||
* buffered writers dirtying pages that can't be synced.
|
* buffered writers dirtying pages that can't be synced.
|
||||||
*/
|
*/
|
||||||
if (!ns->disk || test_and_set_bit(NVME_NS_DEAD, &ns->flags))
|
if (test_and_set_bit(NVME_NS_DEAD, &ns->flags))
|
||||||
return;
|
return;
|
||||||
blk_set_queue_dying(ns->queue);
|
blk_set_queue_dying(ns->queue);
|
||||||
/* Forcibly unquiesce queues to avoid blocking dispatch */
|
/* Forcibly unquiesce queues to avoid blocking dispatch */
|
||||||
|
@ -1429,7 +1429,7 @@ static void nvme_update_formats(struct nvme_ctrl *ctrl, u32 *effects)
|
||||||
|
|
||||||
down_read(&ctrl->namespaces_rwsem);
|
down_read(&ctrl->namespaces_rwsem);
|
||||||
list_for_each_entry(ns, &ctrl->namespaces, list)
|
list_for_each_entry(ns, &ctrl->namespaces, list)
|
||||||
if (ns->disk && _nvme_revalidate_disk(ns->disk))
|
if (_nvme_revalidate_disk(ns->disk))
|
||||||
nvme_set_queue_dying(ns);
|
nvme_set_queue_dying(ns);
|
||||||
else if (blk_queue_is_zoned(ns->disk->queue)) {
|
else if (blk_queue_is_zoned(ns->disk->queue)) {
|
||||||
/*
|
/*
|
||||||
|
@ -3933,7 +3933,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
|
||||||
nvme_mpath_clear_current_path(ns);
|
nvme_mpath_clear_current_path(ns);
|
||||||
synchronize_srcu(&ns->head->srcu); /* wait for concurrent submissions */
|
synchronize_srcu(&ns->head->srcu); /* wait for concurrent submissions */
|
||||||
|
|
||||||
if (ns->disk && ns->disk->flags & GENHD_FL_UP) {
|
if (ns->disk->flags & GENHD_FL_UP) {
|
||||||
del_gendisk(ns->disk);
|
del_gendisk(ns->disk);
|
||||||
blk_cleanup_queue(ns->queue);
|
blk_cleanup_queue(ns->queue);
|
||||||
if (blk_get_integrity(ns->disk))
|
if (blk_get_integrity(ns->disk))
|
||||||
|
@ -3964,7 +3964,7 @@ static void nvme_validate_ns(struct nvme_ctrl *ctrl, unsigned nsid)
|
||||||
|
|
||||||
ns = nvme_find_get_ns(ctrl, nsid);
|
ns = nvme_find_get_ns(ctrl, nsid);
|
||||||
if (ns) {
|
if (ns) {
|
||||||
if (ns->disk && revalidate_disk(ns->disk))
|
if (revalidate_disk(ns->disk))
|
||||||
nvme_ns_remove(ns);
|
nvme_ns_remove(ns);
|
||||||
nvme_put_ns(ns);
|
nvme_put_ns(ns);
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue