* [PATCH] nvme: remove ns->disk checks
@ 2020-07-08 14:40 Christoph Hellwig
2020-07-08 17:03 ` Chaitanya Kulkarni
2020-07-08 17:12 ` Keith Busch
0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-07-08 14:40 UTC (permalink / raw)
To: sagi, kbusch; +Cc: linux-nvme
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>
---
drivers/nvme/host/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4aaffc4fa150b0..3d00ea4e7146ee 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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
* 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;
blk_set_queue_dying(ns->queue);
/* 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);
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);
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);
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);
blk_cleanup_queue(ns->queue);
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);
if (ns) {
- if (ns->disk && revalidate_disk(ns->disk))
+ if (revalidate_disk(ns->disk))
nvme_ns_remove(ns);
nvme_put_ns(ns);
} else
--
2.26.2
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: remove ns->disk checks
2020-07-08 14:40 [PATCH] nvme: remove ns->disk checks Christoph Hellwig
@ 2020-07-08 17:03 ` Chaitanya Kulkarni
2020-07-08 17:12 ` Keith Busch
1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2020-07-08 17:03 UTC (permalink / raw)
To: Christoph Hellwig, sagi, kbusch; +Cc: linux-nvme
On 7/8/20 07:50, Christoph Hellwig wrote:
> 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>
Looks good to me.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: remove ns->disk checks
2020-07-08 14:40 [PATCH] nvme: remove ns->disk checks Christoph Hellwig
2020-07-08 17:03 ` Chaitanya Kulkarni
@ 2020-07-08 17:12 ` Keith Busch
1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2020-07-08 17:12 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: sagi, linux-nvme
On Wed, Jul 08, 2020 at 04:40:15PM +0200, Christoph Hellwig wrote:
> 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.
Looks like all these pointless checks were from an older interaction
with lightnvm that is no longer applicable, so looks good.
Reviewed-by: Keith Busch <kbusch@kernel.org>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-08 17:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 14:40 [PATCH] nvme: remove ns->disk checks Christoph Hellwig
2020-07-08 17:03 ` Chaitanya Kulkarni
2020-07-08 17:12 ` Keith Busch
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.