drivers/md/dm-zero.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-zero.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-zero.c- Extension
.c- Size
- 1659 bytes
- Lines
- 82
- Domain
- Driver Families
- Bucket
- drivers/md
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device-mapper.hlinux/module.hlinux/init.hlinux/bio.h
Detected Declarations
function Copyrightfunction zero_mapfunction zero_io_hints
Annotated Snippet
if (bio->bi_opf & REQ_RAHEAD) {
/* readahead of null bytes only wastes buffer cache */
return DM_MAPIO_KILL;
}
zero_fill_bio(bio);
break;
case REQ_OP_WRITE:
case REQ_OP_DISCARD:
/* writes get silently dropped */
break;
default:
return DM_MAPIO_KILL;
}
bio_endio(bio);
/* accepted bio, don't make new request */
return DM_MAPIO_SUBMITTED;
}
static void zero_io_hints(struct dm_target *ti, struct queue_limits *limits)
{
limits->max_hw_discard_sectors = UINT_MAX;
limits->discard_granularity = 512;
}
static struct target_type zero_target = {
.name = "zero",
.version = {1, 2, 0},
.features = DM_TARGET_NOWAIT,
.module = THIS_MODULE,
.ctr = zero_ctr,
.map = zero_map,
.io_hints = zero_io_hints,
};
module_dm(zero);
MODULE_AUTHOR("Jana Saout <jana@saout.de>");
MODULE_DESCRIPTION(DM_NAME " dummy target returning zeros");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/device-mapper.h`, `linux/module.h`, `linux/init.h`, `linux/bio.h`.
- Detected declarations: `function Copyright`, `function zero_map`, `function zero_io_hints`.
- Atlas domain: Driver Families / drivers/md.
- 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.