2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
10 * File contains structures and methods for handling IO Class
11 * differentiation features
14 #ifndef __OCF_IO_CLASS_H__
15 #define __OCF_IO_CLASS_H__
18 * @brief OCF IO class information
20 struct ocf_io_class_info
{
21 char name
[OCF_IO_CLASS_NAME_MAX
];
22 /*!< The name of the IO class */
24 ocf_cache_mode_t cache_mode
;
25 /*!< Cache mode of the IO class */
28 /*!< IO class priority */
31 /*!< Current size of the IO class - number of cache lines which
32 * were assigned into this IO class
36 /*!< Minimum number of cache lines that were guaranteed
37 * for specified IO class. If current size reach minimum size
38 * that no more eviction takes place
42 /*!< Maximum number of cache lines that might be assigned into
43 * this IO class. If current size reach maximum size no more
44 * allocation for this IO class takes place
47 uint8_t eviction_policy_type
;
48 /*!< The type of eviction policy for given IO class */
50 ocf_cleaning_t cleaning_policy_type
;
51 /*!< The type of cleaning policy for given IO class */
55 * @brief retrieve io class info
57 * function meant to retrieve information pertaining to particular IO class,
58 * specifically to fill ocf_io_class_info structure based on input parameters.
60 * @param[in] cache cache handle, to which specified request pertains.
61 * @param[in] io_class id of an io class which shall be retreived.
62 * @param[out] info io class info structures to be filled as a
63 * result of this function call.
65 * @return function returns 0 upon successful completion; appropriate error
66 * code is returned otherwise
68 int ocf_cache_io_class_get_info(ocf_cache_t cache
, uint32_t io_class
,
69 struct ocf_io_class_info
*info
);
72 * @brief helper function for ocf_io_class_visit
74 * This function is called back from ocf_io_class_visit for each valid
75 * configured io class; henceforth all parameters are input parameters,
76 * no exceptions. It is usable to enumerate all the io classes.
78 * @param[in] cache cache id of cache for which data is being retrieved
79 * @param[in] io_class_id id of an io class for which callback herein
81 * @param[in] cntx a context pointer passed herein from within
82 * ocf_io_class_visit down to this callback.
84 * @return 0 upon success; Nonzero upon failure (when nonzero is returned,
85 * this callback won't be invoked for any more io classes)
87 typedef int (*ocf_io_class_visitor_t
)(ocf_cache_t cache
,
88 uint32_t io_class_id
, void *cntx
);
91 * @brief enumerate all of the available IO classes.
93 * This function allows enumeration and retrieval of all io class id's that
94 * are valid for given cache id via visiting all those with callback function
95 * that is supplied by caller.
97 * @param[in] cache cache id to which given call pertains
98 * @param[in] visitor a callback function that will be issued for each and every
99 * IO class that is configured and valid within given cache instance
100 * @param[in] cntx a context variable - structure that shall be passed to a
101 * callback function for every call
103 * @return 0 upon successful completion of the function; otherwise nonzero result
106 int ocf_io_class_visit(ocf_cache_t cache
, ocf_io_class_visitor_t visitor
,
109 #endif /* __OCF_IO_CLASS_H__ */