nvmet.h (793c7cfce02ce88b7bd67d43834c052d16c096e3) nvmet.h (72efd25dcf4f6310e9e6fa85620aa443b27c23fe)
1/*
2 * Copyright (c) 2015-2016 HGST, a Western Digital Company.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT

--- 50 unchanged lines hidden (view full) ---

59 struct percpu_ref ref;
60 struct block_device *bdev;
61 struct file *file;
62 u32 nsid;
63 u32 blksize_shift;
64 loff_t size;
65 u8 nguid[16];
66 uuid_t uuid;
1/*
2 * Copyright (c) 2015-2016 HGST, a Western Digital Company.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT

--- 50 unchanged lines hidden (view full) ---

59 struct percpu_ref ref;
60 struct block_device *bdev;
61 struct file *file;
62 u32 nsid;
63 u32 blksize_shift;
64 loff_t size;
65 u8 nguid[16];
66 uuid_t uuid;
67 u32 anagrpid;
67
68 bool buffered_io;
69 bool enabled;
70 struct nvmet_subsys *subsys;
71 const char *device_path;
72
73 struct config_group device_group;
74 struct config_group group;

--- 35 unchanged lines hidden (view full) ---

110struct nvmet_port {
111 struct list_head entry;
112 struct nvmf_disc_rsp_page_entry disc_addr;
113 struct config_group group;
114 struct config_group subsys_group;
115 struct list_head subsystems;
116 struct config_group referrals_group;
117 struct list_head referrals;
68
69 bool buffered_io;
70 bool enabled;
71 struct nvmet_subsys *subsys;
72 const char *device_path;
73
74 struct config_group device_group;
75 struct config_group group;

--- 35 unchanged lines hidden (view full) ---

111struct nvmet_port {
112 struct list_head entry;
113 struct nvmf_disc_rsp_page_entry disc_addr;
114 struct config_group group;
115 struct config_group subsys_group;
116 struct list_head subsystems;
117 struct config_group referrals_group;
118 struct list_head referrals;
119 enum nvme_ana_state *ana_state;
118 void *priv;
119 bool enabled;
120 int inline_data_size;
121};
122
123static inline struct nvmet_port *to_nvmet_port(struct config_item *item)
124{
125 return container_of(to_config_group(item), struct nvmet_port,

--- 239 unchanged lines hidden (view full) ---

365#define NVMET_MAX_CMD NVMET_QUEUE_SIZE
366
367/*
368 * Nice round number that makes a list of nsids fit into a page.
369 * Should become tunable at some point in the future.
370 */
371#define NVMET_MAX_NAMESPACES 1024
372
120 void *priv;
121 bool enabled;
122 int inline_data_size;
123};
124
125static inline struct nvmet_port *to_nvmet_port(struct config_item *item)
126{
127 return container_of(to_config_group(item), struct nvmet_port,

--- 239 unchanged lines hidden (view full) ---

367#define NVMET_MAX_CMD NVMET_QUEUE_SIZE
368
369/*
370 * Nice round number that makes a list of nsids fit into a page.
371 * Should become tunable at some point in the future.
372 */
373#define NVMET_MAX_NAMESPACES 1024
374
375/*
376 * 0 is not a valid ANA group ID, so we start numbering at 1.
377 *
378 * ANA Group 1 exists without manual intervention, has namespaces assigned to it
379 * by default, and is available in an optimized state through all ports.
380 */
381#define NVMET_MAX_ANAGRPS 1
382#define NVMET_DEFAULT_ANA_GRPID 1
383
373#define NVMET_KAS 10
374#define NVMET_DISC_KATO 120
375
376int __init nvmet_init_configfs(void);
377void __exit nvmet_exit_configfs(void);
378
379int __init nvmet_init_discovery(void);
380void nvmet_exit_discovery(void);
381
382extern struct nvmet_subsys *nvmet_disc_subsys;
383extern u64 nvmet_genctr;
384extern struct rw_semaphore nvmet_config_sem;
385
384#define NVMET_KAS 10
385#define NVMET_DISC_KATO 120
386
387int __init nvmet_init_configfs(void);
388void __exit nvmet_exit_configfs(void);
389
390int __init nvmet_init_discovery(void);
391void nvmet_exit_discovery(void);
392
393extern struct nvmet_subsys *nvmet_disc_subsys;
394extern u64 nvmet_genctr;
395extern struct rw_semaphore nvmet_config_sem;
396
397extern u32 nvmet_ana_group_enabled[NVMET_MAX_ANAGRPS + 1];
398extern u64 nvmet_ana_chgcnt;
399extern struct rw_semaphore nvmet_ana_sem;
400
386bool nvmet_host_allowed(struct nvmet_req *req, struct nvmet_subsys *subsys,
387 const char *hostnqn);
388
389int nvmet_bdev_ns_enable(struct nvmet_ns *ns);
390int nvmet_file_ns_enable(struct nvmet_ns *ns);
391void nvmet_bdev_ns_disable(struct nvmet_ns *ns);
392void nvmet_file_ns_disable(struct nvmet_ns *ns);
393
394static inline u32 nvmet_rw_len(struct nvmet_req *req)
395{
396 return ((u32)le16_to_cpu(req->cmd->rw.length) + 1) <<
397 req->ns->blksize_shift;
398}
399#endif /* _NVMET_H */
401bool nvmet_host_allowed(struct nvmet_req *req, struct nvmet_subsys *subsys,
402 const char *hostnqn);
403
404int nvmet_bdev_ns_enable(struct nvmet_ns *ns);
405int nvmet_file_ns_enable(struct nvmet_ns *ns);
406void nvmet_bdev_ns_disable(struct nvmet_ns *ns);
407void nvmet_file_ns_disable(struct nvmet_ns *ns);
408
409static inline u32 nvmet_rw_len(struct nvmet_req *req)
410{
411 return ((u32)le16_to_cpu(req->cmd->rw.length) + 1) <<
412 req->ns->blksize_shift;
413}
414#endif /* _NVMET_H */