drivers/md/dm-vdo/vio.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/vio.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/vio.h- Extension
.h- Size
- 6490 bytes
- Lines
- 207
- 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
linux/bio.hlinux/blkdev.hlinux/compiler.hlinux/kernel.hlinux/list.hcompletion.hconstants.htypes.hvdo.h
Detected Declarations
struct pooled_viostruct vio_poolfunction as_viofunction get_vio_bio_zone_thread_idfunction assert_vio_in_bio_zonefunction create_metadata_viofunction initialize_viofunction is_data_viofunction get_metadata_priorityfunction continue_viofunction continue_vio_after_io
Annotated Snippet
struct pooled_vio {
/* The underlying vio */
struct vio vio;
/* The list entry for chaining pooled vios together */
struct list_head list_entry;
/* The context set by the pool */
void *context;
/* The list entry used by the pool */
struct list_head pool_entry;
/* The pool this vio is allocated from */
struct vio_pool *pool;
};
/**
* as_vio() - Convert a generic vdo_completion to a vio.
* @completion: The completion to convert.
*
* Return: The completion as a vio.
*/
static inline struct vio *as_vio(struct vdo_completion *completion)
{
vdo_assert_completion_type(completion, VIO_COMPLETION);
return container_of(completion, struct vio, completion);
}
/**
* get_vio_bio_zone_thread_id() - Get the thread id of the bio zone in which a vio should submit
* its I/O.
* @vio: The vio.
*
* Return: The id of the bio zone thread the vio should use.
*/
static inline thread_id_t __must_check get_vio_bio_zone_thread_id(struct vio *vio)
{
return vio->completion.vdo->thread_config.bio_threads[vio->bio_zone];
}
physical_block_number_t __must_check pbn_from_vio_bio(struct bio *bio);
/**
* assert_vio_in_bio_zone() - Check that a vio is running on the correct thread for its bio zone.
* @vio: The vio to check.
*/
static inline void assert_vio_in_bio_zone(struct vio *vio)
{
thread_id_t expected = get_vio_bio_zone_thread_id(vio);
thread_id_t thread_id = vdo_get_callback_thread_id();
VDO_ASSERT_LOG_ONLY((expected == thread_id),
"vio I/O for physical block %llu on thread %u, should be on bio zone thread %u",
(unsigned long long) pbn_from_vio_bio(vio->bio), thread_id,
expected);
}
int vdo_create_bio(struct bio **bio_ptr);
void vdo_free_bio(struct bio *bio);
int allocate_vio_components(struct vdo *vdo, enum vio_type vio_type,
enum vio_priority priority, void *parent,
unsigned int block_count, char *data, struct vio *vio);
int __must_check create_multi_block_metadata_vio(struct vdo *vdo, enum vio_type vio_type,
enum vio_priority priority,
void *parent, unsigned int block_count,
char *data, struct vio **vio_ptr);
static inline int __must_check create_metadata_vio(struct vdo *vdo, enum vio_type vio_type,
enum vio_priority priority,
void *parent, char *data,
struct vio **vio_ptr)
{
return create_multi_block_metadata_vio(vdo, vio_type, priority, parent, 1, data,
vio_ptr);
}
void free_vio_components(struct vio *vio);
void free_vio(struct vio *vio);
/**
* initialize_vio() - Initialize a vio.
* @vio: The vio to initialize.
* @bio: The bio this vio should use for its I/O.
* @block_count: The size of this vio in vdo blocks.
* @vio_type: The vio type.
* @priority: The relative priority of the vio.
* @vdo: The vdo for this vio.
*/
static inline void initialize_vio(struct vio *vio, struct bio *bio,
unsigned int block_count, enum vio_type vio_type,
enum vio_priority priority, struct vdo *vdo)
{
/* data_vio's may not span multiple blocks */
Annotation
- Immediate include surface: `linux/bio.h`, `linux/blkdev.h`, `linux/compiler.h`, `linux/kernel.h`, `linux/list.h`, `completion.h`, `constants.h`, `types.h`.
- Detected declarations: `struct pooled_vio`, `struct vio_pool`, `function as_vio`, `function get_vio_bio_zone_thread_id`, `function assert_vio_in_bio_zone`, `function create_metadata_vio`, `function initialize_vio`, `function is_data_vio`, `function get_metadata_priority`, `function continue_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.