drivers/nvme/target/nvmet.h
Source file repositories/reference/linux-study-clean/drivers/nvme/target/nvmet.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/nvme/target/nvmet.h- Extension
.h- Size
- 28169 bytes
- Lines
- 994
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hlinux/types.hlinux/device.hlinux/kref.hlinux/percpu-refcount.hlinux/list.hlinux/mutex.hlinux/uuid.hlinux/nvme.hlinux/configfs.hlinux/rcupdate.hlinux/blkdev.hlinux/radix-tree.hlinux/t10-pi.hlinux/kfifo.h
Detected Declarations
struct nvmet_pr_registrantstruct nvmet_prstruct nvmet_pr_per_ctrl_refstruct nvmet_nsstruct nvmet_cqstruct nvmet_sqstruct nvmet_ana_groupstruct nvmet_portstruct nvmet_pr_log_mgrstruct nvmet_ctrlstruct nvmet_subsysstruct nvmet_hoststruct nvmet_host_linkstruct nvmet_subsys_linkstruct nvmet_reqstruct nvmet_fabrics_opsstruct nvmet_reqstruct nvmet_async_eventstruct nvmet_alloc_ctrl_argsstruct nvmet_feat_irq_coalescestruct nvmet_feat_irq_configstruct nvmet_feat_arbitrationfunction nvmet_port_disc_addr_treq_secure_channelfunction nvmet_port_secure_channel_requiredfunction nvmet_set_resultfunction nvmet_data_dirfunction nvmet_clear_aen_bitfunction nvmet_aen_bit_disabledfunction nvmet_rw_data_lenfunction nvmet_rw_metadata_lenfunction nvmet_dsm_lenfunction nvmet_is_disc_subsysfunction nvmet_is_pci_ctrlfunction nvmet_ctrl_mdtsfunction nvmet_is_passthru_subsysfunction nvmet_passthru_subsys_freefunction nvmet_parse_passthru_io_cmdfunction nvmet_is_passthru_subsysfunction nvmet_is_passthru_reqfunction nvmet_cc_enfunction nvmet_cc_cssfunction nvmet_cc_mpsfunction nvmet_cc_amsfunction nvmet_cc_shnfunction nvmet_cc_iosqesfunction nvmet_cc_iocqesfunction to0basedfunction nvmet_ns_has_pi
Annotated Snippet
struct nvmet_pr_registrant {
u64 rkey;
uuid_t hostid;
enum nvme_pr_type rtype;
struct list_head entry;
struct rcu_head rcu;
};
struct nvmet_pr {
bool enable;
unsigned long notify_mask;
atomic_t generation;
struct nvmet_pr_registrant __rcu *holder;
/*
* During the execution of the reservation command, mutual
* exclusion is required throughout the process. However,
* while waiting asynchronously for the 'per controller
* percpu_ref' to complete before the 'preempt and abort'
* command finishes, a semaphore is needed to ensure mutual
* exclusion instead of a mutex.
*/
struct semaphore pr_sem;
struct list_head registrant_list;
};
struct nvmet_pr_per_ctrl_ref {
struct percpu_ref ref;
struct completion free_done;
struct completion confirm_done;
uuid_t hostid;
};
struct nvmet_ns {
struct percpu_ref ref;
struct file *bdev_file;
struct block_device *bdev;
struct file *file;
bool readonly;
u32 nsid;
u32 blksize_shift;
loff_t size;
u8 nguid[16];
uuid_t uuid;
u32 anagrpid;
bool buffered_io;
bool enabled;
struct nvmet_subsys *subsys;
const char *device_path;
struct config_group device_group;
struct config_group group;
struct completion disable_done;
mempool_t *bvec_pool;
struct pci_dev *p2p_dev;
int use_p2pmem;
int pi_type;
int metadata_size;
u8 csi;
struct nvmet_pr pr;
struct xarray pr_per_ctrl_refs;
};
static inline struct nvmet_ns *to_nvmet_ns(struct config_item *item)
{
return container_of(to_config_group(item), struct nvmet_ns, group);
}
static inline struct device *nvmet_ns_dev(struct nvmet_ns *ns)
{
return ns->bdev ? disk_to_dev(ns->bdev->bd_disk) : NULL;
}
struct nvmet_cq {
struct nvmet_ctrl *ctrl;
u16 qid;
u16 size;
refcount_t ref;
};
struct nvmet_sq {
struct nvmet_ctrl *ctrl;
struct percpu_ref ref;
struct nvmet_cq *cq;
u16 qid;
u16 size;
u32 sqhd;
bool sqhd_disabled;
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/types.h`, `linux/device.h`, `linux/kref.h`, `linux/percpu-refcount.h`, `linux/list.h`, `linux/mutex.h`, `linux/uuid.h`.
- Detected declarations: `struct nvmet_pr_registrant`, `struct nvmet_pr`, `struct nvmet_pr_per_ctrl_ref`, `struct nvmet_ns`, `struct nvmet_cq`, `struct nvmet_sq`, `struct nvmet_ana_group`, `struct nvmet_port`, `struct nvmet_pr_log_mgr`, `struct nvmet_ctrl`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.