Open CAS Framework
Open source framework of Cache Acceleration Software
ocf_core.h
Go to the documentation of this file.
1 /*
2  * Copyright(c) 2012-2020 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause-Clear
4  */
5 
11 #ifndef __OCF_CORE_H__
12 #define __OCF_CORE_H__
13 
14 #include "ocf_volume.h"
15 #include "ocf_io.h"
16 #include "ocf_mngt.h"
17 
18 struct ocf_core_info {
20  uint64_t core_size;
21 
23  uint64_t core_size_bytes;
24 
26  struct {
28  uint32_t flushed;
29 
31  uint32_t dirty;
32  };
33 
35  uint32_t dirty_for;
36 
39 
42 };
43 
55 int ocf_core_get_by_name(ocf_cache_t cache, const char *name, size_t name_len,
56  ocf_core_t *core);
57 
66 
75 
84 
92 static inline const struct ocf_volume_uuid *ocf_core_get_uuid(ocf_core_t core)
93 {
95 }
96 
105 
114 
122 const char *ocf_core_get_name(ocf_core_t core);
123 
132 
146 static inline struct ocf_io *ocf_core_new_io(ocf_core_t core, ocf_queue_t queue,
147  uint64_t addr, uint32_t bytes, uint32_t dir,
148  uint32_t io_class, uint64_t flags)
149 {
151 
152  return ocf_volume_new_io(volume, queue, addr, bytes, dir,
153  io_class, flags);
154 }
155 
161 static inline void ocf_core_submit_io(struct ocf_io *io)
162 {
164 }
165 
175 int ocf_core_submit_io_fast(struct ocf_io *io);
176 
182 static inline void ocf_core_submit_flush(struct ocf_io *io)
183 {
185 }
186 
192 static inline void ocf_core_submit_discard(struct ocf_io *io)
193 {
195 }
196 
207 typedef int (*ocf_core_visitor_t)(ocf_core_t core, void *cntx);
208 
220 int ocf_core_visit(ocf_cache_t cache, ocf_core_visitor_t visitor, void *cntx,
221  bool only_opened);
222 
232 int ocf_core_get_info(ocf_core_t core, struct ocf_core_info *info);
233 
240 void ocf_core_set_priv(ocf_core_t core, void *priv);
241 
249 void *ocf_core_get_priv(ocf_core_t core);
250 
251 #endif /* __OCF_CORE_H__ */
struct ocf_cache * ocf_cache_t
handle to object designating ocf cache device
Definition: ocf_types.h:44
ocf_seq_cutoff_policy seq_cutoff_policy
Definition: ocf_core.h:41
ocf_volume_t ocf_core_get_front_volume(ocf_core_t core)
Obtain volume of the core.
ocf_seq_cutoff_policy
Definition: ocf_def.h:180
uint64_t core_size_bytes
Definition: ocf_core.h:23
ocf_volume_t ocf_core_get_volume(ocf_core_t core)
Obtain volume associated with core.
int ocf_core_get_info(ocf_core_t core, struct ocf_core_info *info)
Get info of given core object.
OCF IO main structure.
Definition: ocf_io.h:50
const struct ocf_volume_uuid * ocf_volume_get_uuid(ocf_volume_t volume)
Get volume UUID.
uint32_t ocf_core_get_seq_cutoff_threshold(ocf_core_t core)
Get sequential cutoff threshold of given core object.
uint32_t dirty
Definition: ocf_core.h:31
uint64_t core_size
Definition: ocf_core.h:20
OCF management operations definitions.
uint64_t flags
OCF IO flags.
Definition: ocf_io.h:59
uint32_t dirty_for
Definition: ocf_core.h:35
void ocf_volume_submit_io(struct ocf_io *io)
Submit io to volume.
void * ocf_core_get_priv(ocf_core_t core)
Get core private data.
int ocf_core_submit_io_fast(struct ocf_io *io)
Fast path for submitting IO. If possible, request is processed immediately without adding to internal...
Definition: ocf_core.h:18
OCF volume UUID.
Definition: ocf_volume.h:28
int ocf_core_visit(ocf_cache_t cache, ocf_core_visitor_t visitor, void *cntx, bool only_opened)
Run visitor function for each core of given cache.
uint32_t dir
OCF IO direction.
Definition: ocf_io.h:74
OCF volume API.
ocf_cache_t ocf_core_get_cache(ocf_core_t core)
Obtain cache object from core.
uint32_t io_class
OCF IO destination class.
Definition: ocf_io.h:69
uint32_t flushed
Definition: ocf_core.h:28
struct ocf_volume * ocf_volume_t
handle to object designating ocf volume
Definition: ocf_types.h:56
struct ocf_io * ocf_volume_new_io(ocf_volume_t volume, ocf_queue_t queue, uint64_t addr, uint32_t bytes, uint32_t dir, uint32_t io_class, uint64_t flags)
Allocate new io.
struct ocf_queue * ocf_queue_t
handle to I/O queue
Definition: ocf_types.h:78
uint64_t addr
OCF IO destination address.
Definition: ocf_io.h:54
ocf_seq_cutoff_policy ocf_core_get_seq_cutoff_policy(ocf_core_t core)
Get sequential cutoff policy of given core object.
uint32_t bytes
OCF IO size in bytes.
Definition: ocf_io.h:64
int ocf_core_get_by_name(ocf_cache_t cache, const char *name, size_t name_len, ocf_core_t *core)
Get OCF core by name.
ocf_core_state_t
Definition: ocf_def.h:134
void ocf_core_set_priv(ocf_core_t core, void *priv)
Set core private data.
void ocf_volume_submit_flush(struct ocf_io *io)
Submit flush to volume.
uint32_t seq_cutoff_threshold
Definition: ocf_core.h:38
struct ocf_core * ocf_core_t
handle to object designating ocf core object
Definition: ocf_types.h:50
void ocf_volume_submit_discard(struct ocf_io *io)
Submit discard to volume.
OCF IO definitions.
ocf_core_state_t ocf_core_get_state(ocf_core_t core)
Get core state.
const char * ocf_core_get_name(ocf_core_t core)
Get name of given core object.
int(* ocf_core_visitor_t)(ocf_core_t core, void *cntx)
Core visitor function type which is called back when iterating over cores.
Definition: ocf_core.h:207