drivers/md/dm-vdo/admin-state.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/admin-state.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/admin-state.h- Extension
.h- Size
- 6407 bytes
- Lines
- 179
- 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
completion.htypes.h
Detected Declarations
struct admin_state_codestruct admin_statefunction vdo_get_admin_state_codefunction vdo_set_admin_state_codefunction vdo_is_state_normalfunction vdo_is_state_suspendingfunction vdo_is_state_savingfunction vdo_is_state_savedfunction vdo_is_state_drainingfunction vdo_is_state_loadingfunction vdo_is_state_resumingfunction vdo_is_state_clean_loadfunction vdo_is_state_quiescingfunction vdo_is_state_quiescent
Annotated Snippet
struct admin_state_code {
const char *name;
/* Normal operation, data_vios may be active */
bool normal;
/* I/O is draining, new requests should not start */
bool draining;
/* This is a startup time operation */
bool loading;
/* The next state will be quiescent */
bool quiescing;
/* The VDO is quiescent, there should be no I/O */
bool quiescent;
/* Whether an operation is in progress and so no other operation may be started */
bool operating;
};
extern const struct admin_state_code *VDO_ADMIN_STATE_NORMAL_OPERATION;
extern const struct admin_state_code *VDO_ADMIN_STATE_OPERATING;
extern const struct admin_state_code *VDO_ADMIN_STATE_FORMATTING;
extern const struct admin_state_code *VDO_ADMIN_STATE_PRE_LOADING;
extern const struct admin_state_code *VDO_ADMIN_STATE_PRE_LOADED;
extern const struct admin_state_code *VDO_ADMIN_STATE_LOADING;
extern const struct admin_state_code *VDO_ADMIN_STATE_LOADING_FOR_RECOVERY;
extern const struct admin_state_code *VDO_ADMIN_STATE_LOADING_FOR_REBUILD;
extern const struct admin_state_code *VDO_ADMIN_STATE_WAITING_FOR_RECOVERY;
extern const struct admin_state_code *VDO_ADMIN_STATE_NEW;
extern const struct admin_state_code *VDO_ADMIN_STATE_INITIALIZED;
extern const struct admin_state_code *VDO_ADMIN_STATE_RECOVERING;
extern const struct admin_state_code *VDO_ADMIN_STATE_REBUILDING;
extern const struct admin_state_code *VDO_ADMIN_STATE_SAVING;
extern const struct admin_state_code *VDO_ADMIN_STATE_SAVED;
extern const struct admin_state_code *VDO_ADMIN_STATE_SCRUBBING;
extern const struct admin_state_code *VDO_ADMIN_STATE_SAVE_FOR_SCRUBBING;
extern const struct admin_state_code *VDO_ADMIN_STATE_STOPPING;
extern const struct admin_state_code *VDO_ADMIN_STATE_STOPPED;
extern const struct admin_state_code *VDO_ADMIN_STATE_SUSPENDING;
extern const struct admin_state_code *VDO_ADMIN_STATE_SUSPENDED;
extern const struct admin_state_code *VDO_ADMIN_STATE_SUSPENDED_OPERATION;
extern const struct admin_state_code *VDO_ADMIN_STATE_RESUMING;
struct admin_state {
const struct admin_state_code *current_state;
/* The next administrative state (when the current operation finishes) */
const struct admin_state_code *next_state;
/* A completion waiting on a state change */
struct vdo_completion *waiter;
/* Whether an operation is being initiated */
bool starting;
/* Whether an operation has completed in the initiator */
bool complete;
};
/**
* typedef vdo_admin_initiator_fn - A method to be called once an admin operation may be initiated.
*/
typedef void (*vdo_admin_initiator_fn)(struct admin_state *state);
static inline const struct admin_state_code * __must_check
vdo_get_admin_state_code(const struct admin_state *state)
{
return READ_ONCE(state->current_state);
}
/**
* vdo_set_admin_state_code() - Set the current admin state code.
*
* This function should be used primarily for initialization and by adminState internals. Most uses
* should go through the operation interfaces.
*/
static inline void vdo_set_admin_state_code(struct admin_state *state,
const struct admin_state_code *code)
{
WRITE_ONCE(state->current_state, code);
}
static inline bool __must_check vdo_is_state_normal(const struct admin_state *state)
{
return vdo_get_admin_state_code(state)->normal;
}
static inline bool __must_check vdo_is_state_suspending(const struct admin_state *state)
{
return (vdo_get_admin_state_code(state) == VDO_ADMIN_STATE_SUSPENDING);
}
static inline bool __must_check vdo_is_state_saving(const struct admin_state *state)
{
return (vdo_get_admin_state_code(state) == VDO_ADMIN_STATE_SAVING);
}
Annotation
- Immediate include surface: `completion.h`, `types.h`.
- Detected declarations: `struct admin_state_code`, `struct admin_state`, `function vdo_get_admin_state_code`, `function vdo_set_admin_state_code`, `function vdo_is_state_normal`, `function vdo_is_state_suspending`, `function vdo_is_state_saving`, `function vdo_is_state_saved`, `function vdo_is_state_draining`, `function vdo_is_state_loading`.
- 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.