drivers/md/dm-cache-policy-internal.h
Source file repositories/reference/linux-study-clean/drivers/md/dm-cache-policy-internal.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/md/dm-cache-policy-internal.h- Extension
.h- Size
- 4531 bytes
- Lines
- 168
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/vmalloc.hdm-cache-policy.h
Detected Declarations
function Copyrightfunction policy_lookup_with_workfunction policy_get_background_workfunction policy_complete_background_workfunction policy_set_dirtyfunction policy_clear_dirtyfunction policy_load_mappingfunction policy_invalidate_mappingfunction policy_get_hintfunction policy_residencyfunction policy_tickfunction policy_emit_config_valuesfunction policy_set_config_valuefunction policy_allow_migrationsfunction bitset_size_in_bytesfunction clear_bitsetfunction free_bitset
Annotated Snippet
#ifndef DM_CACHE_POLICY_INTERNAL_H
#define DM_CACHE_POLICY_INTERNAL_H
#include <linux/vmalloc.h>
#include "dm-cache-policy.h"
/*----------------------------------------------------------------*/
static inline int policy_lookup(struct dm_cache_policy *p, dm_oblock_t oblock, dm_cblock_t *cblock,
int data_dir, bool fast_copy, bool *background_queued)
{
return p->lookup(p, oblock, cblock, data_dir, fast_copy, background_queued);
}
static inline int policy_lookup_with_work(struct dm_cache_policy *p,
dm_oblock_t oblock, dm_cblock_t *cblock,
int data_dir, bool fast_copy,
struct policy_work **work)
{
if (!p->lookup_with_work) {
*work = NULL;
return p->lookup(p, oblock, cblock, data_dir, fast_copy, NULL);
}
return p->lookup_with_work(p, oblock, cblock, data_dir, fast_copy, work);
}
static inline int policy_get_background_work(struct dm_cache_policy *p,
bool idle, struct policy_work **result)
{
return p->get_background_work(p, idle, result);
}
static inline void policy_complete_background_work(struct dm_cache_policy *p,
struct policy_work *work,
bool success)
{
return p->complete_background_work(p, work, success);
}
static inline void policy_set_dirty(struct dm_cache_policy *p, dm_cblock_t cblock)
{
p->set_dirty(p, cblock);
}
static inline void policy_clear_dirty(struct dm_cache_policy *p, dm_cblock_t cblock)
{
p->clear_dirty(p, cblock);
}
static inline int policy_load_mapping(struct dm_cache_policy *p,
dm_oblock_t oblock, dm_cblock_t cblock,
bool dirty, uint32_t hint, bool hint_valid)
{
return p->load_mapping(p, oblock, cblock, dirty, hint, hint_valid);
}
static inline int policy_invalidate_mapping(struct dm_cache_policy *p,
dm_cblock_t cblock)
{
return p->invalidate_mapping(p, cblock);
}
static inline uint32_t policy_get_hint(struct dm_cache_policy *p,
dm_cblock_t cblock)
{
return p->get_hint ? p->get_hint(p, cblock) : 0;
}
static inline dm_cblock_t policy_residency(struct dm_cache_policy *p)
{
return p->residency(p);
}
static inline void policy_tick(struct dm_cache_policy *p, bool can_block)
{
if (p->tick)
return p->tick(p, can_block);
}
static inline int policy_emit_config_values(struct dm_cache_policy *p, char *result,
unsigned int maxlen, ssize_t *sz_ptr)
{
ssize_t sz = *sz_ptr;
if (p->emit_config_values)
return p->emit_config_values(p, result, maxlen, sz_ptr);
DMEMIT("0 ");
*sz_ptr = sz;
Annotation
- Immediate include surface: `linux/vmalloc.h`, `dm-cache-policy.h`.
- Detected declarations: `function Copyright`, `function policy_lookup_with_work`, `function policy_get_background_work`, `function policy_complete_background_work`, `function policy_set_dirty`, `function policy_clear_dirty`, `function policy_load_mapping`, `function policy_invalidate_mapping`, `function policy_get_hint`, `function policy_residency`.
- 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.