[PATCH v2 10/13] nvme-multipath: add nvme_{add,delete}_ns()
John Garry
john.g.garry at oracle.com
Tue Apr 28 04:12:53 PDT 2026
Add functions to call into the mpath_add_device() and mpath_delete_device()
functions.
The per-NS gendisk pointer is used as the mpath_device disk pointer, which
is used in libmultipath for references the per-path block device.
Signed-off-by: John Garry <john.g.garry at oracle.com>
---
drivers/nvme/host/nvme.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index cc63ed8131c36..b4fe7a7dd7f73 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -1025,6 +1025,19 @@ extern const struct block_device_operations nvme_bdev_ops;
void nvme_delete_ctrl_sync(struct nvme_ctrl *ctrl);
struct nvme_ns *nvme_find_path(struct nvme_ns_head *head);
+
+static inline void nvme_add_ns(struct nvme_ns *ns)
+{
+ ns->mpath_device.disk = ns->disk;
+ ns->mpath_device.numa_node = ns->ctrl->numa_node;
+ mpath_add_device(ns->head->mpath_head, &ns->mpath_device);
+}
+
+static inline bool nvme_delete_ns(struct nvme_ns *ns)
+{
+ return mpath_delete_device(&ns->mpath_device);
+}
+
#ifdef CONFIG_NVME_MULTIPATH
static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl)
{
--
2.43.5
More information about the Linux-nvme
mailing list