Commit 463c5fab authored by Chaitanya Kulkarni's avatar Chaitanya Kulkarni Committed by Christoph Hellwig

nvmet: add helper to revalidate bdev and file ns

This patch adds a wrapper helper to indicate size change in the bdev &
file-backed namespace when revalidating ns. This helper is needed in
order to minimize code repetition in the next patch for configfs.c and
existing admin-cmd.c.  
Signed-off-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimbeg.me>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 696ece75
...@@ -486,10 +486,7 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req) ...@@ -486,10 +486,7 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req)
if (!ns) if (!ns)
goto done; goto done;
if (ns->bdev) nvmet_ns_revalidate(ns);
nvmet_bdev_ns_revalidate(ns);
else
nvmet_file_ns_revalidate(ns);
/* /*
* nuse = ncap = nsze isn't always true, but we have no way to find * nuse = ncap = nsze isn't always true, but we have no way to find
......
...@@ -515,6 +515,14 @@ static void nvmet_p2pmem_ns_add_p2p(struct nvmet_ctrl *ctrl, ...@@ -515,6 +515,14 @@ static void nvmet_p2pmem_ns_add_p2p(struct nvmet_ctrl *ctrl,
ns->nsid); 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) int nvmet_ns_enable(struct nvmet_ns *ns)
{ {
struct nvmet_subsys *subsys = ns->subsys; struct nvmet_subsys *subsys = ns->subsys;
......
...@@ -500,6 +500,7 @@ u16 nvmet_file_flush(struct nvmet_req *req); ...@@ -500,6 +500,7 @@ u16 nvmet_file_flush(struct nvmet_req *req);
void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid); void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid);
void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns); void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns);
int nvmet_file_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) static inline u32 nvmet_rw_len(struct nvmet_req *req)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment