diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 4c79aa804887..f544a14e8b5c 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c @@ -486,10 +486,7 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req) if (!ns) goto done; - if (ns->bdev) - nvmet_bdev_ns_revalidate(ns); - else - nvmet_file_ns_revalidate(ns); + nvmet_ns_revalidate(ns); /* * nuse = ncap = nsze isn't always true, but we have no way to find diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 7ce3d3b0f5d6..ee5865568588 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -515,6 +515,14 @@ static void nvmet_p2pmem_ns_add_p2p(struct nvmet_ctrl *ctrl, ns->nsid); } +void nvmet_ns_revalidate(struct nvmet_ns *ns) +{ + if (ns->bdev) + nvmet_bdev_ns_revalidate(ns); + else + nvmet_file_ns_revalidate(ns); +} + int nvmet_ns_enable(struct nvmet_ns *ns) { struct nvmet_subsys *subsys = ns->subsys; diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index 3d981eb6e100..93e0c2aa3e71 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h @@ -500,6 +500,7 @@ u16 nvmet_file_flush(struct nvmet_req *req); void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid); void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns); int nvmet_file_ns_revalidate(struct nvmet_ns *ns); +void nvmet_ns_revalidate(struct nvmet_ns *ns); static inline u32 nvmet_rw_len(struct nvmet_req *req) {