aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvme/target/nvmet.h
diff options
context:
space:
mode:
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>2018-08-07 23:01:07 -0700
committerChristoph Hellwig <hch@lst.de>2018-08-08 12:00:53 +0200
commitdedf0be544614b6d9d395e78d72cc8c30d03e440 (patch)
tree3d1fb89742e040317621eb41f3b3f670ec3c198a /drivers/nvme/target/nvmet.h
parentnvme: set gendisk read only based on nsattr (diff)
downloadlinux-dev-dedf0be544614b6d9d395e78d72cc8c30d03e440.tar.xz
linux-dev-dedf0be544614b6d9d395e78d72cc8c30d03e440.zip
nvmet: add ns write protect support
This patch implements the Namespace Write Protect feature described in "NVMe TP 4005a Namespace Write Protect". In this version, we implement No Write Protect and Write Protect states for target ns which can be toggled by set-features commands from the host side. For write-protect state transition, we need to flush the ns specified as a part of command so we also add helpers for carrying out synchronous flush operations. Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> [hch: fixed an incorrect endianess conversion, minor cleanups] Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to '')
-rw-r--r--drivers/nvme/target/nvmet.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 22941045f46e..ec9af4ee03b6 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -58,6 +58,7 @@ struct nvmet_ns {
struct percpu_ref ref;
struct block_device *bdev;
struct file *file;
+ bool readonly;
u32 nsid;
u32 blksize_shift;
loff_t size;
@@ -429,6 +430,9 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns);
int nvmet_file_ns_enable(struct nvmet_ns *ns);
void nvmet_bdev_ns_disable(struct nvmet_ns *ns);
void nvmet_file_ns_disable(struct nvmet_ns *ns);
+u16 nvmet_bdev_flush(struct nvmet_req *req);
+u16 nvmet_file_flush(struct nvmet_req *req);
+void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid);
static inline u32 nvmet_rw_len(struct nvmet_req *req)
{