#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) {
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,
return p->complete_background_work(p, work, success);
static inline void policy_set_dirty(struct dm_cache_policy *p, dm_cblock_t 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);