minor changes regarding multipath-head assertion
cover minor changes regarding multipath-head assertion
Irvin Cote (2):
nvme-core: remove redundant condition in nvme_ns_head_multipath
nvme-core: use nvme_ns_head_multipath instead of ns->head->disk
drivers/nvme/host/core.c | 2 +- drivers/nvme/host/nvme.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2
PATCH 1/2 nvme-core: remove redundant condition in nvme_ns_head_multipath
head->disk implies IS_ENABLED(CONFIG_NVME_MULTIPATH) (c.f nvme_mpath_alloc_disk) hence the condition is redundant.
--- drivers/nvme/host/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/nvme.h +1 -1
@@ -453,7 +453,7 @@ struct nvme_ns_head {static inline bool nvme_ns_head_multipath (struct nvme_ns_head *head) { -return IS_ENABLED (CONFIG_NVME_MULTIPATH ) && head->disk; +return head->disk; }enum nvme_ns_features {
Signature · 1 line
2.39.2
Jens Axboe
maintainerRe: [PATCH 1/2] nvme-core: remove redundant condition in nvme_ns_head_multipath
Quoted 13 lines · Irvin Cote
head->diskimpliesIS_ENABLED(CONFIG_NVME_MULTIPATH)(c.fnvme_mpath_alloc_disk) hence the condition is redundant.Signed-off-by Irvin Cote <[email protected]>--- drivers/nvme/host/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvme/host/nvme.h +0
-0
drivers/nvme/host/nvme.h struct nvme_ns_head { · line 457
Quoted 6 lines
drivers/nvme/host/nvme.h +1
-1@@ -453,7 +453,7 @@ struct nvme_ns_head {static inline bool nvme_ns_head_multipath (struct nvme_ns_head *head) { -return IS_ENABLED (CONFIG_NVME_MULTIPATH ) && head->disk; +return head->disk; }
Might not matter for this case, but this changes something that'd compile away for !CONFIG_NVME_MULTIPATH to now needing to read disk->head instead. That doesn't seem like a good change.
Signature · 1 line
Jens Axboe
Christoph Hellwig
maintainerRe: [PATCH 1/2] nvme-core: remove redundant condition in nvme_ns_head_multipath
Quoted 9 lines · Jens Axboe
drivers/nvme/host/nvme.h struct nvme_ns_head { · line 457
Quoted 5 lines
static inline bool
nvme_ns_head_multipath(struct nvme_ns_head *head){drivers/nvme/host/nvme.h +1
-1-return IS_ENABLED (CONFIG_NVME_MULTIPATH ) && head->disk; +return head->disk; }Might not matter for this case, but this changes something that'd compile away for !CONFIG_NVME_MULTIPATH to now needing to read
disk->headinstead. That doesn't seem like a good change.
Exactly. That's the reason why this helper and check exist.
PATCH 2/2 nvme-core: use nvme_ns_head_multipath instead of ns->head->disk
In reply to Irvin CoteChange the way we check for a multipath nshead so as to consistently use the same check to assert the same condition.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -4310,7 +4310,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)* instance as shared namespaces will show up as multiple block * devices. */ -if (ns->head->disk) { +if (nvme_ns_head_multipath (ns->head)) {sprintf (disk->disk_name,"nvme%dc%dn%d" , ctrl->subsys->instance, ctrl->instance, ns->head->instance); disk->flags |=GENHD_FL_HIDDEN ;
Signature · 1 line
2.39.2
Re: [PATCH 2/2] nvme-core: use nvme_ns_head_multipath instead of ns->head->disk
Quoted 4 lines · Irvin Cote
Change the way we check for a multipath nshead so as to consistently use the same check to assert the same condition.
Signed-off-by Irvin Cote <[email protected]>
Looks good:
Re: [PATCH 2/2] nvme-core: use nvme_ns_head_multipath instead of ns->head->disk
In reply to Irvin CoteThanks, applied to nvme-6.5, skipping patch 1/2.