drivers/md/dm-vdo/io-submitter.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/io-submitter.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/io-submitter.c- Extension
.c- Size
- 16010 bytes
- Lines
- 507
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
io-submitter.hlinux/bio.hlinux/kernel.hlinux/mutex.hmemory-alloc.hpermassert.hdata-vio.hlogger.htypes.hvdo.hvio.h
Detected Declarations
struct bio_queue_datastruct io_submitterfunction start_bio_queuefunction finish_bio_queuefunction count_all_biosfunction assert_in_bio_zonefunction send_bio_to_devicefunction vdo_submit_viofunction get_bio_listfunction submit_data_viofunction get_mergeable_lockedfunction map_merged_viofunction merge_to_prev_tailfunction merge_to_next_headfunction try_bio_map_mergefunction vdo_submit_data_viofunction submissionfunction vdo_submit_metadata_vio_waitfunction vdo_make_io_submitterfunction vdo_cleanup_io_submitterfunction vdo_free_io_submitter
Annotated Snippet
struct bio_queue_data {
struct vdo_work_queue *queue;
struct blk_plug plug;
struct int_map *map;
struct mutex lock;
unsigned int queue_number;
};
struct io_submitter {
unsigned int num_bio_queues_used;
unsigned int bio_queue_rotation_interval;
struct bio_queue_data bio_queue_data[];
};
static void start_bio_queue(void *ptr)
{
struct bio_queue_data *bio_queue_data = ptr;
blk_start_plug(&bio_queue_data->plug);
}
static void finish_bio_queue(void *ptr)
{
struct bio_queue_data *bio_queue_data = ptr;
blk_finish_plug(&bio_queue_data->plug);
}
static const struct vdo_work_queue_type bio_queue_type = {
.start = start_bio_queue,
.finish = finish_bio_queue,
.max_priority = BIO_Q_MAX_PRIORITY,
.default_priority = BIO_Q_DATA_PRIORITY,
};
/**
* count_all_bios() - Determine which bio counter to use.
* @vio: The vio associated with the bio.
* @bio: The bio to count.
*/
static void count_all_bios(struct vio *vio, struct bio *bio)
{
struct atomic_statistics *stats = &vio->completion.vdo->stats;
if (is_data_vio(vio)) {
vdo_count_bios(&stats->bios_out, bio);
return;
}
vdo_count_bios(&stats->bios_meta, bio);
if (vio->type == VIO_TYPE_RECOVERY_JOURNAL)
vdo_count_bios(&stats->bios_journal, bio);
else if (vio->type == VIO_TYPE_BLOCK_MAP)
vdo_count_bios(&stats->bios_page_cache, bio);
}
/**
* assert_in_bio_zone() - Assert that a vio is in the correct bio zone and not in interrupt
* context.
* @vio: The vio to check.
*/
static void assert_in_bio_zone(struct vio *vio)
{
VDO_ASSERT_LOG_ONLY(!in_interrupt(), "not in interrupt context");
assert_vio_in_bio_zone(vio);
}
/**
* send_bio_to_device() - Update stats and tracing info, then submit the supplied bio to the OS for
* processing.
* @vio: The vio associated with the bio.
* @bio: The bio to submit to the OS.
*/
static void send_bio_to_device(struct vio *vio, struct bio *bio)
{
struct vdo *vdo = vio->completion.vdo;
assert_in_bio_zone(vio);
atomic64_inc(&vdo->stats.bios_submitted);
count_all_bios(vio, bio);
bio_set_dev(bio, vdo_get_backing_device(vdo));
submit_bio_noacct(bio);
}
/**
* vdo_submit_vio() - Submits a vio's bio to the underlying block device. May block if the device
* is busy. This callback should be used by vios which did not attempt to merge.
* @completion: The vio to submit.
*/
void vdo_submit_vio(struct vdo_completion *completion)
Annotation
- Immediate include surface: `io-submitter.h`, `linux/bio.h`, `linux/kernel.h`, `linux/mutex.h`, `memory-alloc.h`, `permassert.h`, `data-vio.h`, `logger.h`.
- Detected declarations: `struct bio_queue_data`, `struct io_submitter`, `function start_bio_queue`, `function finish_bio_queue`, `function count_all_bios`, `function assert_in_bio_zone`, `function send_bio_to_device`, `function vdo_submit_vio`, `function get_bio_list`, `function submit_data_vio`.
- Atlas domain: Driver Families / drivers/md.
- Implementation status: source 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.