drivers/md/dm-vdo/vdo.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/vdo.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/vdo.h- Extension
.h- Size
- 11646 bytes
- Lines
- 384
- 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/atomic.hlinux/blk_types.hlinux/completion.hlinux/dm-kcopyd.hlinux/list.hlinux/spinlock.hadmin-state.hencodings.hfunnel-workqueue.hpacker.hphysical-zone.hstatistics.hthread-registry.htypes.h
Detected Declarations
struct read_only_listenerstruct vdo_threadstruct atomic_bio_statsstruct atomic_statisticsstruct read_only_notifierstruct thread_configstruct thread_count_configstruct vdo_geometry_blockstruct vdo_super_blockstruct data_vio_poolstruct vdo_administratorstruct vdoenum notifier_statefunction vdo_uses_bio_ack_queuefunction vdo_make_default_thread
Annotated Snippet
struct read_only_listener {
/* The listener */
void *listener;
/* The method to call to notify the listener */
vdo_read_only_notification_fn notify;
/* A pointer to the next listener */
struct read_only_listener *next;
};
struct vdo_thread {
struct vdo *vdo;
thread_id_t thread_id;
struct vdo_work_queue *queue;
/*
* Each thread maintains its own notion of whether the VDO is read-only so that the
* read-only state can be checked from any base thread without worrying about
* synchronization or thread safety. This does mean that knowledge of the VDO going
* read-only does not occur simultaneously across the VDO's threads, but that does not seem
* to cause any problems.
*/
bool is_read_only;
/*
* A list of objects waiting to be notified on this thread that the VDO has entered
* read-only mode.
*/
struct read_only_listener *listeners;
struct registered_thread allocating_thread;
};
/* Keep struct bio statistics atomically */
struct atomic_bio_stats {
atomic64_t read; /* Number of not REQ_WRITE bios */
atomic64_t write; /* Number of REQ_WRITE bios */
atomic64_t discard; /* Number of REQ_DISCARD bios */
atomic64_t flush; /* Number of REQ_FLUSH bios */
atomic64_t empty_flush; /* Number of REQ_PREFLUSH bios without data */
atomic64_t fua; /* Number of REQ_FUA bios */
};
/* Counters are atomic since updates can arrive concurrently from arbitrary threads. */
struct atomic_statistics {
atomic64_t bios_submitted;
atomic64_t bios_completed;
atomic64_t flush_out;
atomic64_t invalid_advice_pbn_count;
atomic64_t no_space_error_count;
atomic64_t read_only_error_count;
struct atomic_bio_stats bios_in;
struct atomic_bio_stats bios_in_partial;
struct atomic_bio_stats bios_out;
struct atomic_bio_stats bios_out_completed;
struct atomic_bio_stats bios_acknowledged;
struct atomic_bio_stats bios_acknowledged_partial;
struct atomic_bio_stats bios_meta;
struct atomic_bio_stats bios_meta_completed;
struct atomic_bio_stats bios_journal;
struct atomic_bio_stats bios_journal_completed;
struct atomic_bio_stats bios_page_cache;
struct atomic_bio_stats bios_page_cache_completed;
};
struct read_only_notifier {
/* The completion for entering read-only mode */
struct vdo_completion completion;
/* A completion waiting for notifications to be drained or enabled */
struct vdo_completion *waiter;
/* Lock to protect the next two fields */
spinlock_t lock;
/* The code of the error which put the VDO into read-only mode */
int read_only_error;
/* The current state of the notifier (values described above) */
enum notifier_state state;
};
/*
* The thread ID returned when the current thread is not a vdo thread, or can not be determined
* (usually due to being at interrupt context).
*/
#define VDO_INVALID_THREAD_ID ((thread_id_t) -1)
struct thread_config {
zone_count_t logical_zone_count;
zone_count_t physical_zone_count;
zone_count_t hash_zone_count;
thread_count_t bio_thread_count;
thread_count_t thread_count;
thread_id_t admin_thread;
thread_id_t journal_thread;
thread_id_t packer_thread;
thread_id_t dedupe_thread;
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/blk_types.h`, `linux/completion.h`, `linux/dm-kcopyd.h`, `linux/list.h`, `linux/spinlock.h`, `admin-state.h`, `encodings.h`.
- Detected declarations: `struct read_only_listener`, `struct vdo_thread`, `struct atomic_bio_stats`, `struct atomic_statistics`, `struct read_only_notifier`, `struct thread_config`, `struct thread_count_config`, `struct vdo_geometry_block`, `struct vdo_super_block`, `struct data_vio_pool`.
- 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.