aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvme/target/nvmet.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-07-19 07:35:20 -0700
committerChristoph Hellwig <hch@lst.de>2018-07-27 19:13:02 +0200
commit72efd25dcf4f6310e9e6fa85620aa443b27c23fe (patch)
tree0505847a47806f6d0ac9feed9ae081fe8d55c381 /drivers/nvme/target/nvmet.h
parentnvmet: track and limit the number of namespaces per subsystem (diff)
downloadlinux-dev-72efd25dcf4f6310e9e6fa85620aa443b27c23fe.tar.xz
linux-dev-72efd25dcf4f6310e9e6fa85620aa443b27c23fe.zip
nvmet: add minimal ANA support
Add support for Asynchronous Namespace Access as specified in NVMe 1.3 TP 4004. Just add a default ANA group 1 that is optimized on all ports. This is (and will remain) the default assignment for any namespace not epxlicitly assigned to another ANA group. The ANA state can be manually changed through the configfs interface, including the change state. Includes fixes and improvements from Hannes Reinecke. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <keith.busch@intel.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Diffstat (limited to '')
-rw-r--r--drivers/nvme/target/nvmet.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 701017f7f3df..f7d622fc1aa7 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -64,6 +64,7 @@ struct nvmet_ns {
loff_t size;
u8 nguid[16];
uuid_t uuid;
+ u32 anagrpid;
bool buffered_io;
bool enabled;
@@ -115,6 +116,7 @@ struct nvmet_port {
struct list_head subsystems;
struct config_group referrals_group;
struct list_head referrals;
+ enum nvme_ana_state *ana_state;
void *priv;
bool enabled;
int inline_data_size;
@@ -370,6 +372,15 @@ u32 nvmet_get_log_page_len(struct nvme_command *cmd);
*/
#define NVMET_MAX_NAMESPACES 1024
+/*
+ * 0 is not a valid ANA group ID, so we start numbering at 1.
+ *
+ * ANA Group 1 exists without manual intervention, has namespaces assigned to it
+ * by default, and is available in an optimized state through all ports.
+ */
+#define NVMET_MAX_ANAGRPS 1
+#define NVMET_DEFAULT_ANA_GRPID 1
+
#define NVMET_KAS 10
#define NVMET_DISC_KATO 120
@@ -383,6 +394,10 @@ extern struct nvmet_subsys *nvmet_disc_subsys;
extern u64 nvmet_genctr;
extern struct rw_semaphore nvmet_config_sem;
+extern u32 nvmet_ana_group_enabled[NVMET_MAX_ANAGRPS + 1];
+extern u64 nvmet_ana_chgcnt;
+extern struct rw_semaphore nvmet_ana_sem;
+
bool nvmet_host_allowed(struct nvmet_req *req, struct nvmet_subsys *subsys,
const char *hostnqn);