block/elevator.h
Source file repositories/reference/linux-study-clean/block/elevator.h
File Facts
- System
- Linux kernel
- Corpus path
block/elevator.h- Extension
.h- Size
- 6592 bytes
- Lines
- 222
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/percpu.hlinux/hashtable.hblk-mq.h
Detected Declarations
struct io_cqstruct elevator_typestruct blk_mq_debugfs_attrstruct blk_mq_alloc_datastruct blk_mq_hw_ctxstruct elevator_tagsstruct elevator_resourcesstruct elv_change_ctxstruct elevator_mq_opsstruct elv_fs_entrystruct elevator_typestruct elevator_queueenum elv_mergefunction elevator_trygetfunction __elevator_getfunction elevator_put
Annotated Snippet
struct elevator_tags {
/* num. of hardware queues for which tags are allocated */
unsigned int nr_hw_queues;
/* depth used while allocating tags */
unsigned int nr_requests;
/* shared tag is stored at index 0 */
struct blk_mq_tags *tags[];
};
struct elevator_resources {
/* holds elevator data */
void *data;
/* holds elevator tags */
struct elevator_tags *et;
};
/* Holding context data for changing elevator */
struct elv_change_ctx {
const char *name;
bool no_uevent;
/* for unregistering old elevator */
struct elevator_queue *old;
/* for registering new elevator */
struct elevator_queue *new;
/* store elevator type */
struct elevator_type *type;
/* store elevator resources */
struct elevator_resources res;
};
struct elevator_mq_ops {
int (*init_sched)(struct request_queue *, struct elevator_queue *);
void (*exit_sched)(struct elevator_queue *);
int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int);
void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int);
void (*depth_updated)(struct request_queue *);
void *(*alloc_sched_data)(struct request_queue *);
void (*free_sched_data)(void *);
bool (*allow_merge)(struct request_queue *, struct request *, struct bio *);
bool (*bio_merge)(struct request_queue *, struct bio *, unsigned int);
int (*request_merge)(struct request_queue *q, struct request **, struct bio *);
void (*request_merged)(struct request_queue *, struct request *, enum elv_merge);
void (*requests_merged)(struct request_queue *, struct request *, struct request *);
void (*limit_depth)(blk_opf_t, struct blk_mq_alloc_data *);
void (*prepare_request)(struct request *);
void (*finish_request)(struct request *);
void (*insert_requests)(struct blk_mq_hw_ctx *hctx, struct list_head *list,
blk_insert_t flags);
struct request *(*dispatch_request)(struct blk_mq_hw_ctx *);
bool (*has_work)(struct blk_mq_hw_ctx *);
void (*completed_request)(struct request *, u64);
void (*requeue_request)(struct request *);
struct request *(*former_request)(struct request_queue *, struct request *);
struct request *(*next_request)(struct request_queue *, struct request *);
void (*init_icq)(struct io_cq *);
void (*exit_icq)(struct io_cq *);
};
#define ELV_NAME_MAX (16)
struct elv_fs_entry {
struct attribute attr;
ssize_t (*show)(struct elevator_queue *, char *);
ssize_t (*store)(struct elevator_queue *, const char *, size_t);
};
/*
* identifies an elevator type, such as AS or deadline
*/
struct elevator_type
{
/* managed by elevator core */
struct kmem_cache *icq_cache;
/* fields provided by elevator implementation */
struct elevator_mq_ops ops;
size_t icq_size; /* see iocontext.h */
size_t icq_align; /* ditto */
const struct elv_fs_entry *elevator_attrs;
const char *elevator_name;
const char *elevator_alias;
struct module *elevator_owner;
#ifdef CONFIG_BLK_DEBUG_FS
const struct blk_mq_debugfs_attr *queue_debugfs_attrs;
const struct blk_mq_debugfs_attr *hctx_debugfs_attrs;
#endif
Annotation
- Immediate include surface: `linux/percpu.h`, `linux/hashtable.h`, `blk-mq.h`.
- Detected declarations: `struct io_cq`, `struct elevator_type`, `struct blk_mq_debugfs_attr`, `struct blk_mq_alloc_data`, `struct blk_mq_hw_ctx`, `struct elevator_tags`, `struct elevator_resources`, `struct elv_change_ctx`, `struct elevator_mq_ops`, `struct elv_fs_entry`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
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.