Lines Matching full:action

6 #include "action-manager.h"
18 * struct action - An action to be performed in each of a set of zones.
20 * @operation: The admin operation associated with this action.
21 * @preamble: The method to run on the initiator thread before the action is applied to each zone.
22 * @zone_action: The action to be performed in each zone.
23 * @conclusion: The method to run on the initiator thread after the action is applied to each zone.
24 * @parent: The object to notify when the action is complete.
25 * @context: The action specific context.
26 * @next: The action to perform after this one.
28 struct action { struct
36 struct action *next; argument
40 * struct action_manager - Definition of an action manager.
42 * @state: The state of this action manager.
43 * @actions: The two action slots.
44 * @current_action: The current action slot.
45 * @zones: The number of zones in which an action is to be applied.
46 * @Scheduler: A function to schedule a default next action.
47 * @get_zone_thread_id: A function to get the id of the thread on which to apply an action to a
50 * @context: Opaque data associated with this action manager.
56 struct action actions[2];
57 struct action *current_action;
91 * vdo_make_action_manager() - Make an action manager.
95 * @context: The object which holds the per-zone context for the action.
96 * @scheduler: A function to schedule a next action after an action concludes if there is no
97 * pending action (may be NULL).
99 * @manager_ptr: A pointer to hold the new action manager.
207 struct action *action = manager->current_action; in launch_current_action() local
208 int result = vdo_start_operation(&manager->state, action->operation); in launch_current_action()
211 if (action->parent != NULL) in launch_current_action()
212 vdo_set_completion_result(action->parent, result); in launch_current_action()
215 action->conclusion = no_conclusion; in launch_current_action()
220 if (action->zone_action == NULL) { in launch_current_action()
230 action->preamble(manager->context, &manager->completion); in launch_current_action()
234 * vdo_schedule_default_action() - Attempt to schedule the default action.
235 * @manager: The action manager.
237 * If the manager is not operating normally, the action will not be scheduled.
239 * Return: true if an action was scheduled.
243 /* Don't schedule a default action if we are operating or not in normal operation. */ in vdo_schedule_default_action()
255 struct action action = *(manager->current_action); in finish_action_callback() local
266 result = action.conclusion(manager->context); in finish_action_callback()
268 if (action.parent != NULL) in finish_action_callback()
269 vdo_continue_completion(action.parent, result); in finish_action_callback()
276 * vdo_schedule_action() - Schedule an action to be applied to all zones.
277 * @manager: The action manager to schedule the action on.
278 * @preamble: A method to be invoked on the initiator thread once this action is started but before
280 * @action: The action to apply to each zone; may be NULL.
281 * @conclusion: A method to be invoked back on the initiator thread once the action has been
283 * @parent: The object to notify once the action is complete or if the action can not be scheduled;
286 * The action will be launched immediately if there is no current action, or as soon as the current
287 * action completes. If there is already a pending action, this action will not be scheduled, and,
288 * if it has a parent, that parent will be notified. At least one of the preamble, action, or
291 * Return: true if the action was scheduled.
294 vdo_zone_action_fn action, vdo_action_conclusion_fn conclusion, in vdo_schedule_action() argument
298 action, conclusion, parent); in vdo_schedule_action()
303 * @manager: The action manager to schedule the action on.
304 * @operation: The operation this action will perform
305 * @preamble: A method to be invoked on the initiator thread once this action is started but before
307 * @action: The action to apply to each zone; may be NULL.
308 * @conclusion: A method to be invoked back on the initiator thread once the action has been
310 * @parent: The object to notify once the action is complete or if the action can not be scheduled;
313 * The operation's action will be launched immediately if there is no current action, or as soon as
314 * the current action completes. If there is already a pending action, this operation will not be
316 * action, or conclusion must not be NULL.
318 * Return: true if the action was scheduled.
322 vdo_action_preamble_fn preamble, vdo_zone_action_fn action, in vdo_schedule_operation() argument
326 return vdo_schedule_operation_with_context(manager, operation, preamble, action, in vdo_schedule_operation()
332 * @manager: The action manager to schedule the action on.
333 * @operation: The operation this action will perform.
334 * @preamble: A method to be invoked on the initiator thread once this action is started but before
336 * @action: The action to apply to each zone; may be NULL.
337 * @conclusion: A method to be invoked back on the initiator thread once the action has been
339 * @context: An action-specific context which may be retrieved via
341 * @parent: The object to notify once the action is complete or if the action can not be scheduled;
344 * The operation's action will be launched immediately if there is no current action, or as soon as
345 * the current action completes. If there is already a pending action, this operation will not be
347 * action, or conclusion must not be NULL.
349 * Return: true if the action was scheduled
354 vdo_zone_action_fn action, in vdo_schedule_operation_with_context() argument
358 struct action *current_action; in vdo_schedule_operation_with_context()
361 "action initiated from correct thread"); in vdo_schedule_operation_with_context()
373 *current_action = (struct action) { in vdo_schedule_operation_with_context()
377 .zone_action = action, in vdo_schedule_operation_with_context()