drivers/md/dm-vdo/completion.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-vdo/completion.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-vdo/completion.h- Extension
.h- Size
- 4777 bytes
- Lines
- 153
- 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
permassert.hstatus-codes.htypes.h
Detected Declarations
function vdo_run_completionfunction vdo_reset_completionfunction vdo_launch_completionfunction vdo_continue_completionfunction vdo_fail_completionfunction vdo_assert_completion_typefunction vdo_set_completion_callbackfunction vdo_launch_completion_callbackfunction vdo_prepare_completionfunction vdo_prepare_completion_for_requeue
Annotated Snippet
#ifndef VDO_COMPLETION_H
#define VDO_COMPLETION_H
#include "permassert.h"
#include "status-codes.h"
#include "types.h"
/**
* vdo_run_completion() - Run a completion's callback or error handler on the current thread.
*
* Context: This function must be called from the correct callback thread.
*/
static inline void vdo_run_completion(struct vdo_completion *completion)
{
if ((completion->result != VDO_SUCCESS) && (completion->error_handler != NULL)) {
completion->error_handler(completion);
return;
}
completion->callback(completion);
}
void vdo_set_completion_result(struct vdo_completion *completion, int result);
void vdo_initialize_completion(struct vdo_completion *completion, struct vdo *vdo,
enum vdo_completion_type type);
/**
* vdo_reset_completion() - Reset a completion to a clean state, while keeping the type, vdo and
* parent information.
*/
static inline void vdo_reset_completion(struct vdo_completion *completion)
{
completion->result = VDO_SUCCESS;
completion->complete = false;
}
void vdo_launch_completion_with_priority(struct vdo_completion *completion,
enum vdo_completion_priority priority);
/**
* vdo_launch_completion() - Launch a completion with default priority.
*/
static inline void vdo_launch_completion(struct vdo_completion *completion)
{
vdo_launch_completion_with_priority(completion, VDO_WORK_Q_DEFAULT_PRIORITY);
}
/**
* vdo_continue_completion() - Continue processing a completion.
* @result: The current result (will not mask older errors).
*
* Continue processing a completion by setting the current result and calling
* vdo_launch_completion().
*/
static inline void vdo_continue_completion(struct vdo_completion *completion, int result)
{
vdo_set_completion_result(completion, result);
vdo_launch_completion(completion);
}
void vdo_finish_completion(struct vdo_completion *completion);
/**
* vdo_fail_completion() - Set the result of a completion if it does not already have an error,
* then finish it.
*/
static inline void vdo_fail_completion(struct vdo_completion *completion, int result)
{
vdo_set_completion_result(completion, result);
vdo_finish_completion(completion);
}
/**
* vdo_assert_completion_type() - Assert that a completion is of the correct type.
*
* Return: VDO_SUCCESS or an error
*/
static inline int vdo_assert_completion_type(struct vdo_completion *completion,
enum vdo_completion_type expected)
{
return VDO_ASSERT(expected == completion->type,
"completion type should be %u, not %u", expected,
completion->type);
}
static inline void vdo_set_completion_callback(struct vdo_completion *completion,
vdo_action_fn callback,
thread_id_t callback_thread_id)
Annotation
- Immediate include surface: `permassert.h`, `status-codes.h`, `types.h`.
- Detected declarations: `function vdo_run_completion`, `function vdo_reset_completion`, `function vdo_launch_completion`, `function vdo_continue_completion`, `function vdo_fail_completion`, `function vdo_assert_completion_type`, `function vdo_set_completion_callback`, `function vdo_launch_completion_callback`, `function vdo_prepare_completion`, `function vdo_prepare_completion_for_requeue`.
- 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.