Re: [PATCH] nvmet: add revalidation support to bdev and file backed namespaces

From: Sagi Grimberg
Date: Thu Apr 02 2020 - 18:14:32 EST



+void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns)
+{
+ loff_t size;
+
+ size = i_size_read(ns->bdev->bd_inode);
+
+ if (ns->size != size)
+ ns->size = size;

Why is the if useful?

+}
+
static u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
{
u16 status = NVME_SC_SUCCESS;
diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c
index cd5670b83118..c102437db72a 100644
--- a/drivers/nvme/target/io-cmd-file.c
+++ b/drivers/nvme/target/io-cmd-file.c
@@ -80,6 +80,20 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
return ret;
}
+void nvmet_file_ns_revalidate(struct nvmet_ns *ns)
+{
+ struct kstat stat;
+
+ if (!ns->file)
+ return;

When is !ns->file expected?