block/blk-mq-cpumap.c
Source file repositories/reference/linux-study-clean/block/blk-mq-cpumap.c
File Facts
- System
- Linux kernel
- Corpus path
block/blk-mq-cpumap.c- Extension
.c- Size
- 3419 bytes
- Lines
- 133
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/threads.hlinux/module.hlinux/mm.hlinux/smp.hlinux/cpu.hlinux/group_cpus.hlinux/device/bus.hlinux/sched/isolation.hblk.hblk-mq.h
Detected Declarations
function Copyrightfunction blk_mq_num_possible_queuesfunction blk_mq_num_online_queuesfunction blk_mq_map_queuesfunction blk_mq_hw_queue_to_nodefunction for_each_possible_cpufunction blk_mq_map_hw_queuesexport blk_mq_num_possible_queuesexport blk_mq_num_online_queuesexport blk_mq_map_queuesexport blk_mq_map_hw_queues
Annotated Snippet
* Create a CPU to hardware queue mapping in @qmap. The struct bus_type
* irq_get_affinity callback will be used to retrieve the affinity.
*/
void blk_mq_map_hw_queues(struct blk_mq_queue_map *qmap,
struct device *dev, unsigned int offset)
{
const struct cpumask *mask;
unsigned int queue, cpu;
if (!dev->bus->irq_get_affinity)
goto fallback;
for (queue = 0; queue < qmap->nr_queues; queue++) {
mask = dev->bus->irq_get_affinity(dev, queue + offset);
if (!mask)
goto fallback;
for_each_cpu(cpu, mask)
qmap->mq_map[cpu] = qmap->queue_offset + queue;
}
return;
fallback:
blk_mq_map_queues(qmap);
}
EXPORT_SYMBOL_GPL(blk_mq_map_hw_queues);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/threads.h`, `linux/module.h`, `linux/mm.h`, `linux/smp.h`, `linux/cpu.h`, `linux/group_cpus.h`, `linux/device/bus.h`.
- Detected declarations: `function Copyright`, `function blk_mq_num_possible_queues`, `function blk_mq_num_online_queues`, `function blk_mq_map_queues`, `function blk_mq_hw_queue_to_node`, `function for_each_possible_cpu`, `function blk_mq_map_hw_queues`, `export blk_mq_num_possible_queues`, `export blk_mq_num_online_queues`, `export blk_mq_map_queues`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: pattern 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.