block/error-injection.c
Source file repositories/reference/linux-study-clean/block/error-injection.c
File Facts
- System
- Linux kernel
- Corpus path
block/error-injection.c- Extension
.c- Size
- 7542 bytes
- Lines
- 316
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/blkdev.hlinux/parser.hlinux/seq_file.hblk.herror-injection.h
Detected Declarations
struct blk_error_injectenum optionsfunction __blk_error_injectfunction error_inject_addfunction error_inject_removeallfunction match_opfunction match_statusfunction blk_error_injection_parse_optionsfunction blk_error_injection_writefunction blk_error_injection_showfunction blk_error_injection_openfunction blk_error_injection_releasefunction blk_error_injection_initfunction blk_error_injection_exit
Annotated Snippet
static const struct file_operations blk_error_injection_fops = {
.owner = THIS_MODULE,
.write = blk_error_injection_write,
.read = seq_read,
.open = blk_error_injection_open,
.release = blk_error_injection_release,
};
void blk_error_injection_init(struct gendisk *disk)
{
debugfs_create_file("error_injection", 0600, disk->queue->debugfs_dir,
disk, &blk_error_injection_fops);
}
void blk_error_injection_exit(struct gendisk *disk)
{
error_inject_removeall(disk);
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/blkdev.h`, `linux/parser.h`, `linux/seq_file.h`, `blk.h`, `error-injection.h`.
- Detected declarations: `struct blk_error_inject`, `enum options`, `function __blk_error_inject`, `function error_inject_add`, `function error_inject_removeall`, `function match_op`, `function match_status`, `function blk_error_injection_parse_options`, `function blk_error_injection_write`, `function blk_error_injection_show`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: pattern 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.