Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/action-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct action {
* @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.
* @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.
Expand Down
75 changes: 50 additions & 25 deletions drivers/md/dm-vdo/admin-state.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ const struct admin_state_code *VDO_ADMIN_STATE_RESUMING = &VDO_CODE_RESUMING;
/**
* get_next_state() - Determine the state which should be set after a given operation completes
* based on the operation and the current state.
* @operation The operation to be started.
* @state: The current admin state.
* @operation: The operation to be started.
*
* Return: The state to set when the operation completes or NULL if the operation can not be
* started in the current state.
Expand Down Expand Up @@ -187,6 +188,8 @@ static const struct admin_state_code *get_next_state(const struct admin_state *s

/**
* vdo_finish_operation() - Finish the current operation.
* @state: The current admin state.
* @result: The result of the operation.
*
* Will notify the operation waiter if there is one. This method should be used for operations
* started with vdo_start_operation(). For operations which were started with vdo_start_draining(),
Expand Down Expand Up @@ -214,8 +217,10 @@ bool vdo_finish_operation(struct admin_state *state, int result)

/**
* begin_operation() - Begin an operation if it may be started given the current state.
* @waiter A completion to notify when the operation is complete; may be NULL.
* @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
* @state: The current admin state.
* @operation: The operation to be started.
* @waiter: A completion to notify when the operation is complete; may be NULL.
* @initiator: The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
*
* Return: VDO_SUCCESS or an error.
*/
Expand Down Expand Up @@ -259,8 +264,10 @@ static int __must_check begin_operation(struct admin_state *state,

/**
* start_operation() - Start an operation if it may be started given the current state.
* @waiter A completion to notify when the operation is complete.
* @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
* @state: The current admin state.
* @operation: The operation to be started.
* @waiter: A completion to notify when the operation is complete; may be NULL.
* @initiator: The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
*
* Return: true if the operation was started.
*/
Expand All @@ -274,10 +281,10 @@ static inline bool __must_check start_operation(struct admin_state *state,

/**
* check_code() - Check the result of a state validation.
* @valid true if the code is of an appropriate type.
* @code The code which failed to be of the correct type.
* @what What the code failed to be, for logging.
* @waiter The completion to notify of the error; may be NULL.
* @valid: True if the code is of an appropriate type.
* @code: The code which failed to be of the correct type.
* @what: What the code failed to be, for logging.
* @waiter: The completion to notify of the error; may be NULL.
*
* If the result failed, log an invalid state error and, if there is a waiter, notify it.
*
Expand All @@ -301,7 +308,8 @@ static bool check_code(bool valid, const struct admin_state_code *code, const ch

/**
* assert_vdo_drain_operation() - Check that an operation is a drain.
* @waiter The completion to finish with an error if the operation is not a drain.
* @operation: The operation to check.
* @waiter: The completion to finish with an error if the operation is not a drain.
*
* Return: true if the specified operation is a drain.
*/
Expand All @@ -313,9 +321,10 @@ static bool __must_check assert_vdo_drain_operation(const struct admin_state_cod

/**
* vdo_start_draining() - Initiate a drain operation if the current state permits it.
* @operation The type of drain to initiate.
* @waiter The completion to notify when the drain is complete.
* @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
* @state: The current admin state.
* @operation: The type of drain to initiate.
* @waiter: The completion to notify when the drain is complete.
* @initiator: The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
*
* Return: true if the drain was initiated, if not the waiter will be notified.
*/
Expand Down Expand Up @@ -345,6 +354,7 @@ bool vdo_start_draining(struct admin_state *state,

/**
* vdo_finish_draining() - Finish a drain operation if one was in progress.
* @state: The current admin state.
*
* Return: true if the state was draining; will notify the waiter if so.
*/
Expand All @@ -355,6 +365,8 @@ bool vdo_finish_draining(struct admin_state *state)

/**
* vdo_finish_draining_with_result() - Finish a drain operation with a status code.
* @state: The current admin state.
* @result: The result of the drain operation.
*
* Return: true if the state was draining; will notify the waiter if so.
*/
Expand All @@ -365,7 +377,8 @@ bool vdo_finish_draining_with_result(struct admin_state *state, int result)

/**
* vdo_assert_load_operation() - Check that an operation is a load.
* @waiter The completion to finish with an error if the operation is not a load.
* @operation: The operation to check.
* @waiter: The completion to finish with an error if the operation is not a load.
*
* Return: true if the specified operation is a load.
*/
Expand All @@ -377,9 +390,10 @@ bool vdo_assert_load_operation(const struct admin_state_code *operation,

/**
* vdo_start_loading() - Initiate a load operation if the current state permits it.
* @operation The type of load to initiate.
* @waiter The completion to notify when the load is complete (may be NULL).
* @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
* @state: The current admin state.
* @operation: The type of load to initiate.
* @waiter: The completion to notify when the load is complete; may be NULL.
* @initiator: The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
*
* Return: true if the load was initiated, if not the waiter will be notified.
*/
Expand All @@ -393,6 +407,7 @@ bool vdo_start_loading(struct admin_state *state,

/**
* vdo_finish_loading() - Finish a load operation if one was in progress.
* @state: The current admin state.
*
* Return: true if the state was loading; will notify the waiter if so.
*/
Expand All @@ -403,7 +418,8 @@ bool vdo_finish_loading(struct admin_state *state)

/**
* vdo_finish_loading_with_result() - Finish a load operation with a status code.
* @result The result of the load operation.
* @state: The current admin state.
* @result: The result of the load operation.
*
* Return: true if the state was loading; will notify the waiter if so.
*/
Expand All @@ -414,7 +430,8 @@ bool vdo_finish_loading_with_result(struct admin_state *state, int result)

/**
* assert_vdo_resume_operation() - Check whether an admin_state_code is a resume operation.
* @waiter The completion to notify if the operation is not a resume operation; may be NULL.
* @operation: The operation to check.
* @waiter: The completion to notify if the operation is not a resume operation; may be NULL.
*
* Return: true if the code is a resume operation.
*/
Expand All @@ -427,9 +444,10 @@ static bool __must_check assert_vdo_resume_operation(const struct admin_state_co

/**
* vdo_start_resuming() - Initiate a resume operation if the current state permits it.
* @operation The type of resume to start.
* @waiter The completion to notify when the resume is complete (may be NULL).
* @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
* @state: The current admin state.
* @operation: The type of resume to start.
* @waiter: The completion to notify when the resume is complete; may be NULL.
* @initiator: The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
*
* Return: true if the resume was initiated, if not the waiter will be notified.
*/
Expand All @@ -443,6 +461,7 @@ bool vdo_start_resuming(struct admin_state *state,

/**
* vdo_finish_resuming() - Finish a resume operation if one was in progress.
* @state: The current admin state.
*
* Return: true if the state was resuming; will notify the waiter if so.
*/
Expand All @@ -453,7 +472,8 @@ bool vdo_finish_resuming(struct admin_state *state)

/**
* vdo_finish_resuming_with_result() - Finish a resume operation with a status code.
* @result The result of the resume operation.
* @state: The current admin state.
* @result: The result of the resume operation.
*
* Return: true if the state was resuming; will notify the waiter if so.
*/
Expand All @@ -465,6 +485,7 @@ bool vdo_finish_resuming_with_result(struct admin_state *state, int result)
/**
* vdo_resume_if_quiescent() - Change the state to normal operation if the current state is
* quiescent.
* @state: The current admin state.
*
* Return: VDO_SUCCESS if the state resumed, VDO_INVALID_ADMIN_STATE otherwise.
*/
Expand All @@ -479,6 +500,8 @@ int vdo_resume_if_quiescent(struct admin_state *state)

/**
* vdo_start_operation() - Attempt to start an operation.
* @state: The current admin state.
* @operation: The operation to attempt to start.
*
* Return: VDO_SUCCESS if the operation was started, VDO_INVALID_ADMIN_STATE if not
*/
Expand All @@ -490,8 +513,10 @@ int vdo_start_operation(struct admin_state *state,

/**
* vdo_start_operation_with_waiter() - Attempt to start an operation.
* @waiter the completion to notify when the operation completes or fails to start; may be NULL.
* @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
* @state: The current admin state.
* @operation: The operation to attempt to start.
* @waiter: The completion to notify when the operation completes or fails to start; may be NULL.
* @initiator: The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
*
* Return: VDO_SUCCESS if the operation was started, VDO_INVALID_ADMIN_STATE if not
*/
Expand Down
Loading