Lines Matching refs:operation

150  * get_next_state() - Determine the state which should be set after a given operation completes
151 * based on the operation and the current state.
152 * @operation The operation to be started.
154 * Return: The state to set when the operation completes or NULL if the operation can not be
158 const struct admin_state_code *operation)
165 if (operation == VDO_ADMIN_STATE_SAVING)
168 if (operation == VDO_ADMIN_STATE_SUSPENDING) {
174 if (operation == VDO_ADMIN_STATE_STOPPING)
177 if (operation == VDO_ADMIN_STATE_PRE_LOADING)
180 if (operation == VDO_ADMIN_STATE_SUSPENDED_OPERATION) {
189 * vdo_finish_operation() - Finish the current operation.
191 * Will notify the operation waiter if there is one. This method should be used for operations
195 * Return: true if there was an operation to finish.
216 * begin_operation() - Begin an operation if it may be started given the current state.
217 * @waiter A completion to notify when the operation is complete; may be NULL.
218 * @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
223 const struct admin_state_code *operation,
228 const struct admin_state_code *next_state = get_next_state(state, operation);
233 operation->name,
238 operation->name);
242 vdo_set_admin_state_code(state, operation);
261 * start_operation() - Start an operation if it may be started given the current state.
262 * @waiter A completion to notify when the operation is complete.
263 * @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
265 * Return: true if the operation was started.
268 const struct admin_state_code *operation,
272 return (begin_operation(state, operation, waiter, initiator) == VDO_SUCCESS);
303 * assert_vdo_drain_operation() - Check that an operation is a drain.
304 * @waiter The completion to finish with an error if the operation is not a drain.
306 * Return: true if the specified operation is a drain.
308 static bool __must_check assert_vdo_drain_operation(const struct admin_state_code *operation,
311 return check_code(operation->draining, operation, "drain operation", waiter);
315 * vdo_start_draining() - Initiate a drain operation if the current state permits it.
316 * @operation The type of drain to initiate.
318 * @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
323 const struct admin_state_code *operation,
328 if (!assert_vdo_drain_operation(operation, waiter))
338 operation->name, code->name);
343 return start_operation(state, operation, waiter, initiator);
347 * vdo_finish_draining() - Finish a drain operation if one was in progress.
357 * vdo_finish_draining_with_result() - Finish a drain operation with a status code.
367 * vdo_assert_load_operation() - Check that an operation is a load.
368 * @waiter The completion to finish with an error if the operation is not a load.
370 * Return: true if the specified operation is a load.
372 bool vdo_assert_load_operation(const struct admin_state_code *operation,
375 return check_code(operation->loading, operation, "load operation", waiter);
379 * vdo_start_loading() - Initiate a load operation if the current state permits it.
380 * @operation The type of load to initiate.
382 * @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
387 const struct admin_state_code *operation,
390 return (vdo_assert_load_operation(operation, waiter) &&
391 start_operation(state, operation, waiter, initiator));
395 * vdo_finish_loading() - Finish a load operation if one was in progress.
405 * vdo_finish_loading_with_result() - Finish a load operation with a status code.
406 * @result The result of the load operation.
416 * assert_vdo_resume_operation() - Check whether an admin_state_code is a resume operation.
417 * @waiter The completion to notify if the operation is not a resume operation; may be NULL.
419 * Return: true if the code is a resume operation.
421 static bool __must_check assert_vdo_resume_operation(const struct admin_state_code *operation,
424 return check_code(operation == VDO_ADMIN_STATE_RESUMING, operation,
425 "resume operation", waiter);
429 * vdo_start_resuming() - Initiate a resume operation if the current state permits it.
430 * @operation The type of resume to start.
432 * @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
437 const struct admin_state_code *operation,
440 return (assert_vdo_resume_operation(operation, waiter) &&
441 start_operation(state, operation, waiter, initiator));
445 * vdo_finish_resuming() - Finish a resume operation if one was in progress.
455 * vdo_finish_resuming_with_result() - Finish a resume operation with a status code.
456 * @result The result of the resume operation.
466 * vdo_resume_if_quiescent() - Change the state to normal operation if the current state is
481 * vdo_start_operation() - Attempt to start an operation.
483 * Return: VDO_SUCCESS if the operation was started, VDO_INVALID_ADMIN_STATE if not
486 const struct admin_state_code *operation)
488 return vdo_start_operation_with_waiter(state, operation, NULL, NULL);
492 * vdo_start_operation_with_waiter() - Attempt to start an operation.
493 * @waiter the completion to notify when the operation completes or fails to start; may be NULL.
494 * @initiator The vdo_admin_initiator_fn to call if the operation may begin; may be NULL.
496 * Return: VDO_SUCCESS if the operation was started, VDO_INVALID_ADMIN_STATE if not
499 const struct admin_state_code *operation,
503 return (check_code(operation->operating, operation, "operation", waiter) ?
504 begin_operation(state, operation, waiter, initiator) :