drivers/md/dm-vdo/action-manager.c
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/action-manager.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/action-manager.c- Extension
.c- Size
- 14059 bytes
- Lines
- 389
- 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
action-manager.hmemory-alloc.hpermassert.hadmin-state.hcompletion.hstatus-codes.htypes.hvdo.h
Detected Declarations
struct actionstruct action_managerfunction no_default_actionfunction no_preamblefunction no_conclusionfunction vdo_make_action_managerfunction get_acting_zone_thread_idfunction preserve_errorfunction prepare_for_next_zonefunction prepare_for_conclusionfunction apply_to_zonefunction handle_preamble_errorfunction launch_current_actionfunction vdo_schedule_default_actionfunction finish_action_callbackfunction vdo_schedule_actionfunction vdo_schedule_operationfunction vdo_schedule_operation_with_context
Annotated Snippet
struct action {
bool in_use;
const struct admin_state_code *operation;
vdo_action_preamble_fn preamble;
vdo_zone_action_fn zone_action;
vdo_action_conclusion_fn conclusion;
struct vdo_completion *parent;
void *context;
struct action *next;
};
/**
* struct action_manager - Definition of an action manager.
* @completion: The completion for performing actions.
* @state: The state of this action manager.
* @actions: The two action slots.
* @current_action: The current action slot.
* @zones: The number of zones in which an action is to be applied.
* @scheduler: A function to schedule a default next action.
* @get_zone_thread_id: A function to get the id of the thread on which to apply an action to a
* zone.
* @initiator_thread_id: The ID of the thread on which actions may be initiated.
* @context: Opaque data associated with this action manager.
* @acting_zone: The zone currently being acted upon.
*/
struct action_manager {
struct vdo_completion completion;
struct admin_state state;
struct action actions[2];
struct action *current_action;
zone_count_t zones;
vdo_action_scheduler_fn scheduler;
vdo_zone_thread_getter_fn get_zone_thread_id;
thread_id_t initiator_thread_id;
void *context;
zone_count_t acting_zone;
};
static inline struct action_manager *as_action_manager(struct vdo_completion *completion)
{
vdo_assert_completion_type(completion, VDO_ACTION_COMPLETION);
return container_of(completion, struct action_manager, completion);
}
/* Implements vdo_action_scheduler_fn. */
static bool no_default_action(void *context __always_unused)
{
return false;
}
/* Implements vdo_action_preamble_fn. */
static void no_preamble(void *context __always_unused, struct vdo_completion *completion)
{
vdo_finish_completion(completion);
}
/* Implements vdo_action_conclusion_fn. */
static int no_conclusion(void *context __always_unused)
{
return VDO_SUCCESS;
}
/**
* vdo_make_action_manager() - Make an action manager.
* @zones: The number of zones to which actions will be applied.
* @get_zone_thread_id: A function to get the thread id associated with a zone.
* @initiator_thread_id: The thread on which actions may initiated.
* @context: The object which holds the per-zone context for the action.
* @scheduler: A function to schedule a next action after an action concludes if there is no
* pending action (may be NULL).
* @vdo: The vdo used to initialize completions.
* @manager_ptr: A pointer to hold the new action manager.
*
* Return: VDO_SUCCESS or an error code.
*/
int vdo_make_action_manager(zone_count_t zones,
vdo_zone_thread_getter_fn get_zone_thread_id,
thread_id_t initiator_thread_id, void *context,
vdo_action_scheduler_fn scheduler, struct vdo *vdo,
struct action_manager **manager_ptr)
{
struct action_manager *manager;
int result = vdo_allocate(1, __func__, &manager);
if (result != VDO_SUCCESS)
return result;
*manager = (struct action_manager) {
.zones = zones,
.scheduler =
Annotation
- Immediate include surface: `action-manager.h`, `memory-alloc.h`, `permassert.h`, `admin-state.h`, `completion.h`, `status-codes.h`, `types.h`, `vdo.h`.
- Detected declarations: `struct action`, `struct action_manager`, `function no_default_action`, `function no_preamble`, `function no_conclusion`, `function vdo_make_action_manager`, `function get_acting_zone_thread_id`, `function preserve_error`, `function prepare_for_next_zone`, `function prepare_for_conclusion`.
- 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.