Open CAS Framework
Open source framework of Cache Acceleration Software
|
OCF metadata helper function. More...
Go to the source code of this file.
Data Structures | |
struct | ocf_atomic_metadata |
Atomic metadata for extended sector. More... | |
struct | ocf_metadata_probe_status |
Metadata probe status. More... | |
Macros | |
#define | OCF_ATOMIC_METADATA_SIZE sizeof(struct ocf_atomic_metadata) |
Typedefs | |
typedef void(* | ocf_metadata_probe_end_t) (void *priv, int error, struct ocf_metadata_probe_status *status) |
Metadata probe completion callback. More... | |
typedef void(* | ocf_metadata_probe_cores_end_t) (void *priv, int error, unsigned int num_cores) |
Metadata probe for cores completion callback. More... | |
Functions | |
struct ocf_atomic_metadata | __attribute__ ((packed)) |
int | ocf_metadata_get_atomic_entry (ocf_cache_t cache, uint64_t addr, struct ocf_atomic_metadata *entry) |
Get metadata entry (cache mapping) for specified sector of cache device. More... | |
void | ocf_metadata_probe (ocf_ctx_t ctx, ocf_volume_t volume, ocf_metadata_probe_end_t cmpl, void *priv) |
Probe cache device. More... | |
void | ocf_metadata_probe_cores (ocf_ctx_t ctx, ocf_volume_t volume, struct ocf_volume_uuid *uuids, uint32_t uuid_count, ocf_metadata_probe_cores_end_t cmpl, void *priv) |
Probe cache device for associated cores. More... | |
int | ocf_metadata_check_invalid_before (ocf_cache_t cache, uint64_t addr) |
Check if sectors in cache line before given address are invalid. More... | |
int | ocf_metadata_check_invalid_after (ocf_cache_t cache, uint64_t addr, uint32_t bytes) |
Check if sectors in cache line after given end address are invalid. More... | |
Variables | |
uint64_t | core_line |
uint32_t | core_seq_no |
uint32_t | valid |
uint32_t | dirty |
struct ocf_metadata_probe_status | __attribute__ |
OCF metadata helper function.
Those functions can be used by volume implementation.
typedef void(* ocf_metadata_probe_cores_end_t) (void *priv, int error, unsigned int num_cores) |
Metadata probe for cores completion callback.
[in] | priv | Completion context |
[in] | error | Error code (zero on success) |
[in] | num_cores | Number of cores in cache metadata |
typedef void(* ocf_metadata_probe_end_t) (void *priv, int error, struct ocf_metadata_probe_status *status) |
Metadata probe completion callback.
[in] | priv | Completion context |
[in] | error | Error code (zero on success) |
[in] | status | Structure describing metadata probe status |
int ocf_metadata_check_invalid_after | ( | ocf_cache_t | cache, |
uint64_t | addr, | ||
uint32_t | bytes | ||
) |
Check if sectors in cache line after given end address are invalid.
It might be used by volume which supports atomic writes - (write of data and metadata in one buffer)
[in] | cache | OCF cache instance |
[in] | addr | Sector address in bytes |
[in] | bytes | IO size in bytes |
0 | Not all sectors after given end address are invalid |
Non-zero | Number of sectors after given end address |
int ocf_metadata_check_invalid_before | ( | ocf_cache_t | cache, |
uint64_t | addr | ||
) |
Check if sectors in cache line before given address are invalid.
It might be used by volume which supports atomic writes - (write of data and metadata in one buffer)
[in] | cache | OCF cache instance |
[in] | addr | Sector address in bytes |
0 | Not all sectors before given address are invalid |
Non-zero | Number of sectors before given address |
int ocf_metadata_get_atomic_entry | ( | ocf_cache_t | cache, |
uint64_t | addr, | ||
struct ocf_atomic_metadata * | entry | ||
) |
Get metadata entry (cache mapping) for specified sector of cache device.
Metadata has sector granularity. It might be used by volume which supports atomic writes - (write of data and metadata in one buffer)
[in] | cache | OCF cache instance |
[in] | addr | Sector address in bytes |
[out] | entry | Metadata entry |
0 | Metadata retrieved successfully |
Non-zero | Error |
void ocf_metadata_probe | ( | ocf_ctx_t | ctx, |
ocf_volume_t | volume, | ||
ocf_metadata_probe_end_t | cmpl, | ||
void * | priv | ||
) |
Probe cache device.
[in] | ctx | handle to object designating ocf context |
[in] | volume | Cache volume |
[in] | cmpl | Completion callback |
[in] | priv | Completion context |
void ocf_metadata_probe_cores | ( | ocf_ctx_t | ctx, |
ocf_volume_t | volume, | ||
struct ocf_volume_uuid * | uuids, | ||
uint32_t | uuid_count, | ||
ocf_metadata_probe_cores_end_t | cmpl, | ||
void * | priv | ||
) |
Probe cache device for associated cores.
[in] | ctx | handle to object designating ocf context |
[in] | volume | Cache volume |
[in,out] | uuids | Array of uuids |
[in] | uuid_count | Size of array |
[in] | cmpl | Completion callback |
[in] | priv | Completion context |
uint64_t core_line |
Core line of core (in cache line size unit) which are cached
uint32_t core_seq_no |
Core sequence number to which this line belongs to
uint32_t dirty |
Set bit indicates that sector is dirty
uint32_t valid |
Set bit indicates that given sector is valid (is cached)