Merge pull request #64 from robertbaldyga/add-has-pending-reqs-func
Add ocf_cache_has_pending_requests() function
This commit is contained in:
commit
d5ac3035d7
@ -167,6 +167,13 @@ bool ocf_cache_is_running(ocf_cache_t cache);
|
|||||||
*/
|
*/
|
||||||
void ocf_cache_wait_for_io_finish(ocf_cache_t cache);
|
void ocf_cache_wait_for_io_finish(ocf_cache_t cache);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if cache has any unfunished requests
|
||||||
|
*
|
||||||
|
* @param[in] cache Cache object
|
||||||
|
*/
|
||||||
|
bool ocf_cache_has_pending_requests(ocf_cache_t cache);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get cache mode of given cache object
|
* @brief Get cache mode of given cache object
|
||||||
*
|
*
|
||||||
|
@ -56,6 +56,8 @@ void ocf_cache_wait_for_io_finish(ocf_cache_t cache)
|
|||||||
{
|
{
|
||||||
uint32_t req_active = 0;
|
uint32_t req_active = 0;
|
||||||
|
|
||||||
|
OCF_CHECK_NULL(cache);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
req_active = ocf_req_get_allocated(cache);
|
req_active = ocf_req_get_allocated(cache);
|
||||||
if (req_active)
|
if (req_active)
|
||||||
@ -63,6 +65,12 @@ void ocf_cache_wait_for_io_finish(ocf_cache_t cache)
|
|||||||
} while (req_active);
|
} while (req_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ocf_cache_has_pending_requests(ocf_cache_t cache)
|
||||||
|
{
|
||||||
|
OCF_CHECK_NULL(cache);
|
||||||
|
return ocf_req_get_allocated(cache) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
ocf_cache_mode_t ocf_cache_get_mode(ocf_cache_t cache)
|
ocf_cache_mode_t ocf_cache_get_mode(ocf_cache_t cache)
|
||||||
{
|
{
|
||||||
OCF_CHECK_NULL(cache);
|
OCF_CHECK_NULL(cache);
|
||||||
|
Loading…
Reference in New Issue
Block a user