Open CAS Framework
Open source framework of Cache Acceleration Software
Data Structures | Typedefs | Functions
ocf_mngt.h File Reference

OCF management operations definitions. More...

#include "ocf_cache.h"
#include "ocf_core.h"

Go to the source code of this file.

Data Structures

struct  ocf_mngt_core_config
 Core start configuration. More...
 
struct  ocf_mngt_cache_config
 Cache start configuration. More...
 
struct  ocf_mngt_cache_device_config
 Cache attach configuration. More...
 
struct  ocf_mngt_io_class_config
 IO class configuration. More...
 
struct  ocf_mngt_io_classes_config
 

Typedefs

typedef void(* ocf_mngt_cache_lock_end_t) (ocf_cache_t cache, void *priv, int error)
 Lock cache for management oparations (write lock, exclusive) More...
 
typedef int(* ocf_mngt_cache_visitor_t) (ocf_cache_t cache, void *cntx)
 Cache visitor function. More...
 
typedef void(* ocf_mngt_cache_stop_end_t) (ocf_cache_t cache, void *priv, int error)
 Completion callback of cache stop operation. More...
 
typedef void(* ocf_mngt_cache_attach_end_t) (ocf_cache_t cache, void *priv, int error)
 Completion callback of cache attach operation. More...
 
typedef void(* ocf_mngt_cache_detach_end_t) (ocf_cache_t cache, void *priv, int error)
 Completion callback of cache detach operation. More...
 
typedef void(* ocf_mngt_cache_load_end_t) (ocf_cache_t cache, void *priv, int error)
 Completion callback of cache load operation. More...
 
typedef void(* ocf_mngt_cache_add_core_end_t) (ocf_cache_t cache, ocf_core_t core, void *priv, int error)
 Completion callback of add core operation. More...
 
typedef void(* ocf_mngt_cache_remove_core_end_t) (void *priv, int error)
 Completion callback of remove core operation. More...
 
typedef void(* ocf_mngt_cache_detach_core_end_t) (void *priv, int error)
 Completion callback of detach core operation. More...
 
typedef void(* ocf_mngt_cache_flush_end_t) (ocf_cache_t cache, void *priv, int error)
 Completion callback of cache flush operation. More...
 
typedef void(* ocf_mngt_core_flush_end_t) (ocf_core_t core, void *priv, int error)
 Completion callback of core flush operation. More...
 
typedef void(* ocf_mngt_cache_purge_end_t) (ocf_cache_t cache, void *priv, int error)
 Completion callback of cache purge operation. More...
 
typedef void(* ocf_mngt_core_purge_end_t) (ocf_core_t core, void *priv, int error)
 Completion callback of core purge operation. More...
 
typedef void(* ocf_mngt_cache_save_end_t) (ocf_cache_t cache, void *priv, int error)
 Completion callback of save operation. More...
 

Functions

uint32_t ocf_mngt_cache_get_count (ocf_ctx_t ctx)
 Get number of OCF caches. More...
 
int ocf_mngt_cache_get_by_name (ocf_ctx_t ctx, const char *name, size_t name_len, ocf_cache_t *cache)
 Get OCF cache by name. More...
 
int ocf_mngt_cache_get (ocf_cache_t cache)
 Increment reference counter of cache. More...
 
void ocf_mngt_cache_put (ocf_cache_t cache)
 Decrease reference counter in cache. More...
 
void ocf_mngt_cache_lock (ocf_cache_t cache, ocf_mngt_cache_lock_end_t cmpl, void *priv)
 Lock cache for management oparations (write lock, exclusive) More...
 
void ocf_mngt_cache_read_lock (ocf_cache_t cache, ocf_mngt_cache_lock_end_t cmpl, void *priv)
 Lock cache for read - assures cache config does not change while lock is being held, while allowing other users to acquire read lock in parallel. More...
 
int ocf_mngt_cache_trylock (ocf_cache_t cache)
 Lock cache for management oparations (write lock, exclusive) More...
 
int ocf_mngt_cache_read_trylock (ocf_cache_t cache)
 Lock cache for read - assures cache config does not change while lock is being held, while allowing other users to acquire read lock in parallel. More...
 
void ocf_mngt_cache_unlock (ocf_cache_t cache)
 Write-unlock cache. More...
 
void ocf_mngt_cache_read_unlock (ocf_cache_t cache)
 Read-unlock cache. More...
 
int ocf_mngt_cache_visit (ocf_ctx_t ctx, ocf_mngt_cache_visitor_t visitor, void *cntx)
 Loop for each cache. More...
 
int ocf_mngt_cache_visit_reverse (ocf_ctx_t ctx, ocf_mngt_cache_visitor_t visitor, void *cntx)
 Loop for each cache reverse. More...
 
int ocf_mngt_cache_start (ocf_ctx_t ctx, ocf_cache_t *cache, struct ocf_mngt_cache_config *cfg)
 Start cache instance. More...
 
int ocf_mngt_cache_set_mngt_queue (ocf_cache_t cache, ocf_queue_t queue)
 Set queue to be used during management operations. More...
 
void ocf_mngt_cache_stop (ocf_cache_t cache, ocf_mngt_cache_stop_end_t cmpl, void *priv)
 Stop cache instance. More...
 
int ocf_mngt_get_ram_needed (ocf_cache_t cache, struct ocf_mngt_cache_device_config *cfg, uint64_t *ram_needed)
 Get amount of free RAM needed to attach cache volume. More...
 
void ocf_mngt_cache_attach (ocf_cache_t cache, struct ocf_mngt_cache_device_config *cfg, ocf_mngt_cache_attach_end_t cmpl, void *priv)
 Attach caching device to cache instance. More...
 
void ocf_mngt_cache_detach (ocf_cache_t cache, ocf_mngt_cache_detach_end_t cmpl, void *priv)
 Detach caching cache. More...
 
void ocf_mngt_cache_load (ocf_cache_t cache, struct ocf_mngt_cache_device_config *cfg, ocf_mngt_cache_load_end_t cmpl, void *priv)
 Load cache instance. More...
 
void ocf_mngt_cache_add_core (ocf_cache_t cache, struct ocf_mngt_core_config *cfg, ocf_mngt_cache_add_core_end_t cmpl, void *priv)
 Add core to cache instance. More...
 
void ocf_mngt_cache_remove_core (ocf_core_t core, ocf_mngt_cache_remove_core_end_t cmpl, void *priv)
 Remove core from cache instance. More...
 
void ocf_mngt_cache_detach_core (ocf_core_t core, ocf_mngt_cache_detach_core_end_t cmpl, void *priv)
 Detach core from cache instance. More...
 
void ocf_mngt_cache_flush (ocf_cache_t cache, ocf_mngt_cache_flush_end_t cmpl, void *priv)
 Flush data from given cache. More...
 
bool ocf_mngt_core_is_dirty (ocf_core_t core)
 Check if core is dirty. More...
 
bool ocf_mngt_cache_is_dirty (ocf_cache_t cache)
 Check if cache is dirty. More...
 
void ocf_mngt_core_flush (ocf_core_t core, ocf_mngt_core_flush_end_t cmpl, void *priv)
 Flush data to given core. More...
 
void ocf_mngt_cache_purge (ocf_cache_t cache, ocf_mngt_cache_purge_end_t cmpl, void *priv)
 Purge data from given cache. More...
 
void ocf_mngt_core_purge (ocf_core_t core, ocf_mngt_core_purge_end_t cmpl, void *priv)
 Purge data to given core. More...
 
void ocf_mngt_cache_flush_interrupt (ocf_cache_t cache)
 Interrupt existing flushing of cache or core. More...
 
void ocf_mngt_cache_save (ocf_cache_t cache, ocf_mngt_cache_save_end_t cmpl, void *priv)
 Save cache configuration data on cache volume. More...
 
int ocf_mngt_cache_set_mode (ocf_cache_t cache, ocf_cache_mode_t mode)
 Set cache mode in given cache. More...
 
int ocf_mngt_cache_cleaning_set_policy (ocf_cache_t cache, ocf_cleaning_t type)
 Set cleaning policy in given cache. More...
 
int ocf_mngt_cache_cleaning_get_policy (ocf_cache_t cache, ocf_cleaning_t *type)
 Get current cleaning policy from given cache. More...
 
int ocf_mngt_cache_cleaning_set_param (ocf_cache_t cache, ocf_cleaning_t type, uint32_t param_id, uint32_t param_value)
 Set cleaning parameter in given cache. More...
 
int ocf_mngt_cache_cleaning_get_param (ocf_cache_t cache, ocf_cleaning_t type, uint32_t param_id, uint32_t *param_value)
 Get cleaning parameter from given cache. More...
 
int ocf_mngt_cache_promotion_set_policy (ocf_cache_t cache, ocf_promotion_t type)
 Set promotion policy in given cache. More...
 
ocf_promotion_t ocf_mngt_cache_promotion_get_policy (ocf_cache_t cache)
 Get promotion policy in given cache. More...
 
int ocf_mngt_cache_promotion_set_param (ocf_cache_t cache, ocf_promotion_t type, uint8_t param_id, uint32_t param_value)
 Set promotion policy parameter for given cache. More...
 
int ocf_mngt_cache_promotion_get_param (ocf_cache_t cache, ocf_promotion_t type, uint8_t param_id, uint32_t *param_value)
 Get promotion policy parameter for given cache. More...
 
int ocf_mngt_cache_io_classes_configure (ocf_cache_t cache, const struct ocf_mngt_io_classes_config *cfg)
 Configure IO classes in given cache. More...
 
int ocf_mngt_core_set_uuid (ocf_core_t core, const struct ocf_volume_uuid *uuid)
 Asociate new UUID value with given core. More...
 
int ocf_mngt_core_set_user_metadata (ocf_core_t core, void *data, size_t size)
 Set persistent user metadata for given core. More...
 
int ocf_mngt_core_get_user_metadata (ocf_core_t core, void *data, size_t size)
 Get persistent user metadata from given core. More...
 
int ocf_mngt_core_set_seq_cutoff_threshold (ocf_core_t core, uint32_t thresh)
 Set core sequential cutoff threshold. More...
 
int ocf_mngt_core_set_seq_cutoff_threshold_all (ocf_cache_t cache, uint32_t thresh)
 Set sequential cutoff threshold for all cores in cache. More...
 
int ocf_mngt_core_get_seq_cutoff_threshold (ocf_core_t core, uint32_t *thresh)
 Get core sequential cutoff threshold. More...
 
int ocf_mngt_core_set_seq_cutoff_policy (ocf_core_t core, ocf_seq_cutoff_policy policy)
 Set core sequential cutoff policy. More...
 
int ocf_mngt_core_set_seq_cutoff_policy_all (ocf_cache_t cache, ocf_seq_cutoff_policy policy)
 Set sequential cutoff policy for all cores in cache. More...
 
int ocf_mngt_core_get_seq_cutoff_policy (ocf_core_t core, ocf_seq_cutoff_policy *policy)
 Get core sequential cutoff policy. More...
 
int ocf_mngt_cache_set_fallback_pt_error_threshold (ocf_cache_t cache, uint32_t threshold)
 Set cache fallback Pass Through error threshold. More...
 
int ocf_mngt_cache_get_fallback_pt_error_threshold (ocf_cache_t cache, uint32_t *threshold)
 Get cache fallback Pass Through error threshold. More...
 
int ocf_mngt_cache_reset_fallback_pt_error_counter (ocf_cache_t cache)
 Reset cache fallback Pass Through error counter. More...
 
int ocf_mngt_core_pool_get_count (ocf_ctx_t ctx)
 Get core pool count. More...
 
int ocf_mngt_core_pool_add (ocf_ctx_t ctx, ocf_uuid_t uuid, uint8_t type)
 Add core to pool. More...
 
ocf_volume_t ocf_mngt_core_pool_lookup (ocf_ctx_t ctx, ocf_uuid_t uuid, ocf_volume_type_t type)
 Add core to pool. More...
 
int ocf_mngt_core_pool_visit (ocf_ctx_t ctx, int(*visitor)(ocf_uuid_t, void *), void *visitor_ctx)
 Iterate over all object in pool and call visitor callback. More...
 
void ocf_mngt_core_pool_remove (ocf_ctx_t ctx, ocf_volume_t volume)
 Remove volume from pool. More...
 

Detailed Description

OCF management operations definitions.

Typedef Documentation

◆ ocf_mngt_cache_add_core_end_t

typedef void(* ocf_mngt_cache_add_core_end_t) (ocf_cache_t cache, ocf_core_t core, void *priv, int error)

Completion callback of add core operation.

Parameters
[in]cacheCache handle
[in]coreCore handle on success or NULL on failure
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_attach_end_t

typedef void(* ocf_mngt_cache_attach_end_t) (ocf_cache_t cache, void *priv, int error)

Completion callback of cache attach operation.

Parameters
[in]cacheCache handle
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_detach_core_end_t

typedef void(* ocf_mngt_cache_detach_core_end_t) (void *priv, int error)

Completion callback of detach core operation.

Parameters
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_detach_end_t

typedef void(* ocf_mngt_cache_detach_end_t) (ocf_cache_t cache, void *priv, int error)

Completion callback of cache detach operation.

Parameters
[in]cacheCache handle
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_flush_end_t

typedef void(* ocf_mngt_cache_flush_end_t) (ocf_cache_t cache, void *priv, int error)

Completion callback of cache flush operation.

Parameters
[in]cacheCache handle
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_load_end_t

typedef void(* ocf_mngt_cache_load_end_t) (ocf_cache_t cache, void *priv, int error)

Completion callback of cache load operation.

Parameters
[in]cacheCache handle
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_lock_end_t

typedef void(* ocf_mngt_cache_lock_end_t) (ocf_cache_t cache, void *priv, int error)

Lock cache for management oparations (write lock, exclusive)

Parameters
[in]cacheHandle to cache
[in]errorStatus error code. Can be one of the following: 0 Cache successfully locked -OCF_ERR_CACHE_NOT_EXIST Can not lock cache - cache is already stopping -OCF_ERR_NO_MEM Cannot allocate needed memory -OCF_ERR_INTR Wait operation interrupted

◆ ocf_mngt_cache_purge_end_t

typedef void(* ocf_mngt_cache_purge_end_t) (ocf_cache_t cache, void *priv, int error)

Completion callback of cache purge operation.

Parameters
[in]cacheCache handle
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_remove_core_end_t

typedef void(* ocf_mngt_cache_remove_core_end_t) (void *priv, int error)

Completion callback of remove core operation.

Parameters
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_save_end_t

typedef void(* ocf_mngt_cache_save_end_t) (ocf_cache_t cache, void *priv, int error)

Completion callback of save operation.

Parameters
[in]cacheCache handle
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_stop_end_t

typedef void(* ocf_mngt_cache_stop_end_t) (ocf_cache_t cache, void *priv, int error)

Completion callback of cache stop operation.

Parameters
[in]cacheCache handle
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_cache_visitor_t

typedef int(* ocf_mngt_cache_visitor_t) (ocf_cache_t cache, void *cntx)

Cache visitor function.

Parameters
[in]cacheHandle to cache
[in]cntxVisitor function context
Return values
0Success
Non-zeroError

◆ ocf_mngt_core_flush_end_t

typedef void(* ocf_mngt_core_flush_end_t) (ocf_core_t core, void *priv, int error)

Completion callback of core flush operation.

Parameters
[in]coreCore handle
[in]privCallback context
[in]errorError code (zero on success)

◆ ocf_mngt_core_purge_end_t

typedef void(* ocf_mngt_core_purge_end_t) (ocf_core_t core, void *priv, int error)

Completion callback of core purge operation.

Parameters
[in]coreCore handle
[in]privCallback context
[in]errorError code (zero on success)

Function Documentation

◆ ocf_mngt_cache_add_core()

void ocf_mngt_cache_add_core ( ocf_cache_t  cache,
struct ocf_mngt_core_config cfg,
ocf_mngt_cache_add_core_end_t  cmpl,
void *  priv 
)

Add core to cache instance.

Parameters
[in]cacheCache handle
[in]cfgCore configuration
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_attach()

void ocf_mngt_cache_attach ( ocf_cache_t  cache,
struct ocf_mngt_cache_device_config cfg,
ocf_mngt_cache_attach_end_t  cmpl,
void *  priv 
)

Attach caching device to cache instance.

Parameters
[in]cacheCache handle
[in]cfgCaching device configuration
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_cleaning_get_param()

int ocf_mngt_cache_cleaning_get_param ( ocf_cache_t  cache,
ocf_cleaning_t  type,
uint32_t  param_id,
uint32_t *  param_value 
)

Get cleaning parameter from given cache.

Parameters
[in]cacheCache handle
[in]typeCleaning policy type
[in]param_idCleaning policy parameter id
[out]param_valueVariable to store parameter value
Return values
0Parameter has been get successfully
Non-zeroError occurred and parameter has not been get

◆ ocf_mngt_cache_cleaning_get_policy()

int ocf_mngt_cache_cleaning_get_policy ( ocf_cache_t  cache,
ocf_cleaning_t type 
)

Get current cleaning policy from given cache.

Parameters
[in]cacheCache handle
[out]typeVariable to store current cleaning policy type
Return values
0Policy has been get successfully
Non-zeroError occurred and policy has not been get

◆ ocf_mngt_cache_cleaning_set_param()

int ocf_mngt_cache_cleaning_set_param ( ocf_cache_t  cache,
ocf_cleaning_t  type,
uint32_t  param_id,
uint32_t  param_value 
)

Set cleaning parameter in given cache.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]cacheCache handle
[in]typeCleaning policy type
[in]param_idCleaning policy parameter id
[in]param_valueCleaning policy parameter value
Return values
0Parameter has been set successfully
Non-zeroError occurred and parameter has not been set

◆ ocf_mngt_cache_cleaning_set_policy()

int ocf_mngt_cache_cleaning_set_policy ( ocf_cache_t  cache,
ocf_cleaning_t  type 
)

Set cleaning policy in given cache.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]cacheCache handle
[in]typeCleaning policy type
Return values
0Policy has been set successfully
Non-zeroError occurred and policy has not been set

◆ ocf_mngt_cache_detach()

void ocf_mngt_cache_detach ( ocf_cache_t  cache,
ocf_mngt_cache_detach_end_t  cmpl,
void *  priv 
)

Detach caching cache.

Parameters
[in]cacheCache handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_detach_core()

void ocf_mngt_cache_detach_core ( ocf_core_t  core,
ocf_mngt_cache_detach_core_end_t  cmpl,
void *  priv 
)

Detach core from cache instance.

Parameters
[in]coreCore handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_flush()

void ocf_mngt_cache_flush ( ocf_cache_t  cache,
ocf_mngt_cache_flush_end_t  cmpl,
void *  priv 
)

Flush data from given cache.

Parameters
[in]cacheCache handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_flush_interrupt()

void ocf_mngt_cache_flush_interrupt ( ocf_cache_t  cache)

Interrupt existing flushing of cache or core.

Parameters
[in]cacheCache instance

◆ ocf_mngt_cache_get()

int ocf_mngt_cache_get ( ocf_cache_t  cache)

Increment reference counter of cache.

Parameters
[in]cacheOCF cache handle
Return values
0Reference counter incremented
-OCF_ERR_CACHE_NOT_AVAILcache isn't initialised yet

◆ ocf_mngt_cache_get_by_name()

int ocf_mngt_cache_get_by_name ( ocf_ctx_t  ctx,
const char *  name,
size_t  name_len,
ocf_cache_t cache 
)

Get OCF cache by name.

Note
This function on success also increases reference counter in given cache
Parameters
[in]ctxOCF context
[in]nameOCF cache name
[in]name_lenCache name length
[out]cacheOCF cache handle
Return values
0Get cache successfully
-OCF_ERR_CACHE_NOT_EXISTCache with given name doesn't exist

◆ ocf_mngt_cache_get_count()

uint32_t ocf_mngt_cache_get_count ( ocf_ctx_t  ctx)

Get number of OCF caches.

Parameters
[in]ctxOCF context
Return values
Numberof caches in given OCF instance

◆ ocf_mngt_cache_get_fallback_pt_error_threshold()

int ocf_mngt_cache_get_fallback_pt_error_threshold ( ocf_cache_t  cache,
uint32_t *  threshold 
)

Get cache fallback Pass Through error threshold.

Parameters
[in]cacheCache handle
[out]thresholdFallback-PT threshold
Return values
0Fallback-PT threshold have been get successfully
Non-zeroError occurred

◆ ocf_mngt_cache_io_classes_configure()

int ocf_mngt_cache_io_classes_configure ( ocf_cache_t  cache,
const struct ocf_mngt_io_classes_config cfg 
)

Configure IO classes in given cache.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]cacheCache handle
[in]cfgIO class configuration
Return values
0Configuration have been set successfully
Non-zeroError occurred and configuration not been set

◆ ocf_mngt_cache_is_dirty()

bool ocf_mngt_cache_is_dirty ( ocf_cache_t  cache)

Check if cache is dirty.

Parameters
[in]cacheCache handle
Return values
trueif cache is dirty, false otherwise

◆ ocf_mngt_cache_load()

void ocf_mngt_cache_load ( ocf_cache_t  cache,
struct ocf_mngt_cache_device_config cfg,
ocf_mngt_cache_load_end_t  cmpl,
void *  priv 
)

Load cache instance.

Parameters
[in]cacheCache handle
[in]cfgCaching device configuration
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_lock()

void ocf_mngt_cache_lock ( ocf_cache_t  cache,
ocf_mngt_cache_lock_end_t  cmpl,
void *  priv 
)

Lock cache for management oparations (write lock, exclusive)

Parameters
[in]cacheHandle to cache
[in]cmplCompletion callback
[in]privPrivate context of completion callback

◆ ocf_mngt_cache_promotion_get_param()

int ocf_mngt_cache_promotion_get_param ( ocf_cache_t  cache,
ocf_promotion_t  type,
uint8_t  param_id,
uint32_t *  param_value 
)

Get promotion policy parameter for given cache.

Parameters
[in]cacheCache handle
[in]typePromotion policy type
[in]param_idPromotion policy parameter id
[out]param_valueVariable to store parameter value
Return values
0Parameter has been retrieved successfully
Non-zeroError occurred and parameter has not been retrieved

◆ ocf_mngt_cache_promotion_get_policy()

ocf_promotion_t ocf_mngt_cache_promotion_get_policy ( ocf_cache_t  cache)

Get promotion policy in given cache.

Parameters
[in]cacheCache handle
Return values
Currentlyset promotion policy type

◆ ocf_mngt_cache_promotion_set_param()

int ocf_mngt_cache_promotion_set_param ( ocf_cache_t  cache,
ocf_promotion_t  type,
uint8_t  param_id,
uint32_t  param_value 
)

Set promotion policy parameter for given cache.

Parameters
[in]cacheCache handle
[in]typePromotion policy type
[in]param_idPromotion policy parameter id
[in]param_valuePromotion policy parameter value
Return values
0Parameter has been set successfully
Non-zeroError occurred and parameter has not been set

◆ ocf_mngt_cache_promotion_set_policy()

int ocf_mngt_cache_promotion_set_policy ( ocf_cache_t  cache,
ocf_promotion_t  type 
)

Set promotion policy in given cache.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]cacheCache handle
[in]typePromotion policy type
Return values
0Policy has been set successfully
Non-zeroError occurred and policy has not been set

◆ ocf_mngt_cache_purge()

void ocf_mngt_cache_purge ( ocf_cache_t  cache,
ocf_mngt_cache_purge_end_t  cmpl,
void *  priv 
)

Purge data from given cache.

Parameters
[in]cacheCache handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_put()

void ocf_mngt_cache_put ( ocf_cache_t  cache)

Decrease reference counter in cache.

Note
If cache don't have any reference - deallocate it
Parameters
[in]cacheHandle to cache

◆ ocf_mngt_cache_read_lock()

void ocf_mngt_cache_read_lock ( ocf_cache_t  cache,
ocf_mngt_cache_lock_end_t  cmpl,
void *  priv 
)

Lock cache for read - assures cache config does not change while lock is being held, while allowing other users to acquire read lock in parallel.

Parameters
[in]cacheHandle to cache
[in]cmplCompletion callback
[in]privPrivate context of completion callback

◆ ocf_mngt_cache_read_trylock()

int ocf_mngt_cache_read_trylock ( ocf_cache_t  cache)

Lock cache for read - assures cache config does not change while lock is being held, while allowing other users to acquire read lock in parallel.

Parameters
[in]cacheHandle to cache
Return values
0Cache successfully locked
-OCF_ERR_CACHE_NOT_EXISTCan not lock cache - cache is already stopping
-OCF_ERR_NO_LOCKLock not acquired

◆ ocf_mngt_cache_read_unlock()

void ocf_mngt_cache_read_unlock ( ocf_cache_t  cache)

Read-unlock cache.

Parameters
[in]cacheHandle to cache

◆ ocf_mngt_cache_remove_core()

void ocf_mngt_cache_remove_core ( ocf_core_t  core,
ocf_mngt_cache_remove_core_end_t  cmpl,
void *  priv 
)

Remove core from cache instance.

Parameters
[in]coreCore handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_reset_fallback_pt_error_counter()

int ocf_mngt_cache_reset_fallback_pt_error_counter ( ocf_cache_t  cache)

Reset cache fallback Pass Through error counter.

Parameters
[in]cacheCache handle
Return values
0Threshold have been reset successfully

◆ ocf_mngt_cache_save()

void ocf_mngt_cache_save ( ocf_cache_t  cache,
ocf_mngt_cache_save_end_t  cmpl,
void *  priv 
)

Save cache configuration data on cache volume.

This function should be called after changing cache or core parameters in order to make changes persistent.

Parameters
[in]cacheCache handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_set_fallback_pt_error_threshold()

int ocf_mngt_cache_set_fallback_pt_error_threshold ( ocf_cache_t  cache,
uint32_t  threshold 
)

Set cache fallback Pass Through error threshold.

Parameters
[in]cacheCache handle
[in]thresholdValue to be set as threshold
Return values
0Fallback-PT threshold have been set successfully
Non-zeroError occurred

◆ ocf_mngt_cache_set_mngt_queue()

int ocf_mngt_cache_set_mngt_queue ( ocf_cache_t  cache,
ocf_queue_t  queue 
)

Set queue to be used during management operations.

Parameters
[in]cacheCache object
[in]queueQueue object
Return values
0Success
Non-zeroError occurred

◆ ocf_mngt_cache_set_mode()

int ocf_mngt_cache_set_mode ( ocf_cache_t  cache,
ocf_cache_mode_t  mode 
)

Set cache mode in given cache.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]cacheCache handle
[in]modeCache mode to set
Return values
0Cache mode have been set successfully
Non-zeroError occurred and cache mode not been set

◆ ocf_mngt_cache_start()

int ocf_mngt_cache_start ( ocf_ctx_t  ctx,
ocf_cache_t cache,
struct ocf_mngt_cache_config cfg 
)

Start cache instance.

Parameters
[in]ctxOCF context
[out]cacheCache handle
[in]cfgStarting cache configuration
Return values
0Cache started successfully
Non-zeroError occurred and starting cache failed

◆ ocf_mngt_cache_stop()

void ocf_mngt_cache_stop ( ocf_cache_t  cache,
ocf_mngt_cache_stop_end_t  cmpl,
void *  priv 
)

Stop cache instance.

Parameters
[in]cacheCache handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_cache_trylock()

int ocf_mngt_cache_trylock ( ocf_cache_t  cache)

Lock cache for management oparations (write lock, exclusive)

Parameters
[in]cacheHandle to cache
Return values
0Cache successfully locked
-OCF_ERR_CACHE_NOT_EXISTCan not lock cache - cache is already stopping
-OCF_ERR_NO_LOCKLock not acquired

◆ ocf_mngt_cache_unlock()

void ocf_mngt_cache_unlock ( ocf_cache_t  cache)

Write-unlock cache.

Parameters
[in]cacheHandle to cache

◆ ocf_mngt_cache_visit()

int ocf_mngt_cache_visit ( ocf_ctx_t  ctx,
ocf_mngt_cache_visitor_t  visitor,
void *  cntx 
)

Loop for each cache.

Note
Visitor function is called for each cache
Parameters
[in]ctxOCF context
[in]visitorOCF cache visitor function
[in]cntxContext for cache visitor function
Return values
0Success
Non-zeroError

◆ ocf_mngt_cache_visit_reverse()

int ocf_mngt_cache_visit_reverse ( ocf_ctx_t  ctx,
ocf_mngt_cache_visitor_t  visitor,
void *  cntx 
)

Loop for each cache reverse.

Note
Visitor function is called for each cache
Parameters
[in]ctxOCF context
[in]visitorOCF cache visitor function
[in]cntxContext for cache visitor function
Return values
0Success
Non-zeroError

◆ ocf_mngt_core_flush()

void ocf_mngt_core_flush ( ocf_core_t  core,
ocf_mngt_core_flush_end_t  cmpl,
void *  priv 
)

Flush data to given core.

Parameters
[in]coreCore handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_core_get_seq_cutoff_policy()

int ocf_mngt_core_get_seq_cutoff_policy ( ocf_core_t  core,
ocf_seq_cutoff_policy policy 
)

Get core sequential cutoff policy.

Parameters
[in]coreCore handle
[in]policysequential cutoff policy
Return values
0Sequential cutoff policy has been get successfully
Non-zeroError occured

◆ ocf_mngt_core_get_seq_cutoff_threshold()

int ocf_mngt_core_get_seq_cutoff_threshold ( ocf_core_t  core,
uint32_t *  thresh 
)

Get core sequential cutoff threshold.

Parameters
[in]coreCore handle
[in]threshthreshold in bytes for sequential cutoff
Return values
0Sequential cutoff threshold has been get successfully
Non-zeroError occured

◆ ocf_mngt_core_get_user_metadata()

int ocf_mngt_core_get_user_metadata ( ocf_core_t  core,
void *  data,
size_t  size 
)

Get persistent user metadata from given core.

Parameters
[in]coreCore object
[out]dataUser data buffer
[in]sizeSize of user data buffer
Return values
0Success
Non-zeroCore getting failed

◆ ocf_mngt_core_is_dirty()

bool ocf_mngt_core_is_dirty ( ocf_core_t  core)

Check if core is dirty.

Parameters
[in]coreCore handle
Return values
trueif core is dirty, false otherwise

◆ ocf_mngt_core_pool_add()

int ocf_mngt_core_pool_add ( ocf_ctx_t  ctx,
ocf_uuid_t  uuid,
uint8_t  type 
)

Add core to pool.

Parameters
[in]ctxOCF context
[in]uuidCache volume UUID
[in]typeOCF core volume type
Return values
0Core added to pool successfully
Non-zeroError occurred and adding core to poll failed

◆ ocf_mngt_core_pool_get_count()

int ocf_mngt_core_pool_get_count ( ocf_ctx_t  ctx)

Get core pool count.

Parameters
[in]ctxOCF context
Return values
Numberof cores in core pool

◆ ocf_mngt_core_pool_lookup()

ocf_volume_t ocf_mngt_core_pool_lookup ( ocf_ctx_t  ctx,
ocf_uuid_t  uuid,
ocf_volume_type_t  type 
)

Add core to pool.

Parameters
[in]ctxOCF context
[in]uuidCache volume UUID
[in]typeOCF core volume type
Return values
Handlerto object with same UUID
NULLNot found object with that id

◆ ocf_mngt_core_pool_remove()

void ocf_mngt_core_pool_remove ( ocf_ctx_t  ctx,
ocf_volume_t  volume 
)

Remove volume from pool.

Important: This function destroys volume instance but doesn't close it, so it should be either moved or closed before calling this function.

Parameters
[in]ctxOCF context
[in]volumeCore volume

◆ ocf_mngt_core_pool_visit()

int ocf_mngt_core_pool_visit ( ocf_ctx_t  ctx,
int(*)(ocf_uuid_t, void *)  visitor,
void *  visitor_ctx 
)

Iterate over all object in pool and call visitor callback.

Parameters
[in]ctxOCF context
[in]visitorVisitor callback
[in]visior_ctxCContext for visitor callback
Return values
Handlerto object with same UUID
NULLNot found object with that id

◆ ocf_mngt_core_purge()

void ocf_mngt_core_purge ( ocf_core_t  core,
ocf_mngt_core_purge_end_t  cmpl,
void *  priv 
)

Purge data to given core.

Parameters
[in]coreCore handle
[in]cmplCompletion callback
[in]privCompletion callback context

◆ ocf_mngt_core_set_seq_cutoff_policy()

int ocf_mngt_core_set_seq_cutoff_policy ( ocf_core_t  core,
ocf_seq_cutoff_policy  policy 
)

Set core sequential cutoff policy.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]coreCore handle
[in]policysequential cutoff policy
Return values
0Sequential cutoff policy has been set successfully
Non-zeroError occured and policy hasn't been updated

◆ ocf_mngt_core_set_seq_cutoff_policy_all()

int ocf_mngt_core_set_seq_cutoff_policy_all ( ocf_cache_t  cache,
ocf_seq_cutoff_policy  policy 
)

Set sequential cutoff policy for all cores in cache.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]cacheCache handle
[in]policysequential cutoff policy
Return values
0Sequential cutoff policy has been set successfully
Non-zeroError occured and policy hasn't been updated

◆ ocf_mngt_core_set_seq_cutoff_threshold()

int ocf_mngt_core_set_seq_cutoff_threshold ( ocf_core_t  core,
uint32_t  thresh 
)

Set core sequential cutoff threshold.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]coreCore handle
[in]threshthreshold in bytes for sequential cutoff
Return values
0Sequential cutoff threshold has been set successfully
Non-zeroError occured and threshold hasn't been updated

◆ ocf_mngt_core_set_seq_cutoff_threshold_all()

int ocf_mngt_core_set_seq_cutoff_threshold_all ( ocf_cache_t  cache,
uint32_t  thresh 
)

Set sequential cutoff threshold for all cores in cache.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]cacheCache handle
[in]threshthreshold in bytes for sequential cutoff
Return values
0Sequential cutoff threshold has been set successfully
Non-zeroError occured and threshold hasn't been updated

◆ ocf_mngt_core_set_user_metadata()

int ocf_mngt_core_set_user_metadata ( ocf_core_t  core,
void *  data,
size_t  size 
)

Set persistent user metadata for given core.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]coreCore object
[in]dataUser data buffer
[in]sizeSize of user data buffer
Return values
0Success
Non-zeroCore getting failed

◆ ocf_mngt_core_set_uuid()

int ocf_mngt_core_set_uuid ( ocf_core_t  core,
const struct ocf_volume_uuid uuid 
)

Asociate new UUID value with given core.

Attention
This changes only runtime state. To make changes persistent use function ocf_mngt_cache_save().
Parameters
[in]coreCore object
[in]uuidnew core uuid
Return values
0Success
Non-zeroFail

◆ ocf_mngt_get_ram_needed()

int ocf_mngt_get_ram_needed ( ocf_cache_t  cache,
struct ocf_mngt_cache_device_config cfg,
uint64_t *  ram_needed 
)

Get amount of free RAM needed to attach cache volume.

Parameters
[in]cacheCache handle
[in]cfgCaching device configuration
[out]ram_neededAmount of RAM needed in bytes
Return values
0Success
Non-zeroError occurred