drivers/md/dm-bufio.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-bufio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-bufio.c- Extension
.c- Size
- 71439 bytes
- Lines
- 2939
- Domain
- Driver Families
- Bucket
- drivers/md
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/dm-bufio.hlinux/device-mapper.hlinux/dm-io.hlinux/slab.hlinux/sched/mm.hlinux/jiffies.hlinux/vmalloc.hlinux/shrinker.hlinux/module.hlinux/rbtree.hlinux/stacktrace.hlinux/jump_label.hdm.h
Detected Declarations
struct lru_entrystruct lru_iterstruct lrustruct dm_bufferstruct buffer_treestruct dm_buffer_cachestruct lock_historystruct evict_wrapperstruct dm_bufio_clientstruct write_contextenum evict_resultenum data_modeenum it_actionenum new_flagfunction lru_initfunction lru_destroyfunction lru_insertfunction lru_iter_beginfunction lru_iter_endfunction lru_iter_invalidatefunction list_for_each_entryfunction lru_removefunction lru_referencefunction cache_indexfunction cache_read_lockfunction cache_read_unlockfunction cache_write_lockfunction cache_write_unlockfunction lh_initfunction __lh_lockfunction __lh_unlockfunction lh_exitfunction lh_nextfunction cache_initfunction cache_destroyfunction cache_countfunction cache_totalfunction __cache_inc_bufferfunction __evict_predfunction cache_markfunction __cache_mark_manyfunction cache_mark_manyfunction __cache_iteratefunction cache_iteratefunction presentfunction cache_insertfunction onefunction __remove_range
Annotated Snippet
module_init(dm_bufio_init)
module_exit(dm_bufio_exit)
module_param_named(max_cache_size_bytes, dm_bufio_cache_size, ulong, 0644);
MODULE_PARM_DESC(max_cache_size_bytes, "Size of metadata cache");
module_param_named(max_age_seconds, dm_bufio_max_age, uint, 0644);
MODULE_PARM_DESC(max_age_seconds, "No longer does anything");
module_param_named(retain_bytes, dm_bufio_retain_bytes, ulong, 0644);
MODULE_PARM_DESC(retain_bytes, "Try to keep at least this many bytes cached in memory");
module_param_named(peak_allocated_bytes, dm_bufio_peak_allocated, ulong, 0644);
MODULE_PARM_DESC(peak_allocated_bytes, "Tracks the maximum allocated memory");
module_param_named(allocated_kmem_cache_bytes, dm_bufio_allocated_kmem_cache, ulong, 0444);
MODULE_PARM_DESC(allocated_kmem_cache_bytes, "Memory allocated with kmem_cache_alloc");
module_param_named(allocated_kmalloc_bytes, dm_bufio_allocated_kmalloc, ulong, 0444);
MODULE_PARM_DESC(allocated_kmalloc_bytes, "Memory allocated with kmalloc_alloc");
module_param_named(allocated_get_free_pages_bytes, dm_bufio_allocated_get_free_pages, ulong, 0444);
MODULE_PARM_DESC(allocated_get_free_pages_bytes, "Memory allocated with get_free_pages");
module_param_named(allocated_vmalloc_bytes, dm_bufio_allocated_vmalloc, ulong, 0444);
MODULE_PARM_DESC(allocated_vmalloc_bytes, "Memory allocated with vmalloc");
module_param_named(current_allocated_bytes, dm_bufio_current_allocated, ulong, 0444);
MODULE_PARM_DESC(current_allocated_bytes, "Memory currently used by the cache");
MODULE_AUTHOR("Mikulas Patocka <dm-devel@lists.linux.dev>");
MODULE_DESCRIPTION(DM_NAME " buffered I/O library");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/dm-bufio.h`, `linux/device-mapper.h`, `linux/dm-io.h`, `linux/slab.h`, `linux/sched/mm.h`, `linux/jiffies.h`, `linux/vmalloc.h`, `linux/shrinker.h`.
- Detected declarations: `struct lru_entry`, `struct lru_iter`, `struct lru`, `struct dm_buffer`, `struct buffer_tree`, `struct dm_buffer_cache`, `struct lock_history`, `struct evict_wrapper`, `struct dm_bufio_client`, `struct write_context`.
- Atlas domain: Driver Families / drivers/md.
- Implementation status: integration 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.