Add getter function for cache->device->concurrency.cache_line
The purpose of this change is to facilitate unit testing. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -1130,7 +1130,8 @@ bool ocf_cache_line_are_waiters(struct ocf_cache_line_concurrency *c,
|
||||
bool ocf_cache_line_is_locked_exclusively(struct ocf_cache *cache,
|
||||
ocf_cache_line_t line)
|
||||
{
|
||||
struct ocf_cache_line_concurrency *c = cache->device->concurrency.cache_line;
|
||||
struct ocf_cache_line_concurrency *c =
|
||||
ocf_cache_line_concurrency(cache);
|
||||
env_atomic *access = &c->access[line];
|
||||
int val = env_atomic_read(access);
|
||||
|
||||
|
@@ -202,4 +202,16 @@ void ocf_cache_line_unlock_wr(struct ocf_cache_line_concurrency *c,
|
||||
bool ocf_cache_line_try_lock_wr(struct ocf_cache_line_concurrency *c,
|
||||
ocf_cache_line_t line);
|
||||
|
||||
/**
|
||||
* @brief Get cacheline concurrency context
|
||||
*
|
||||
* @param cache - cache instance
|
||||
* @return cacheline concurrency context
|
||||
*/
|
||||
static inline struct ocf_cache_line_concurrency *
|
||||
ocf_cache_line_concurrency(ocf_cache_t cache)
|
||||
{
|
||||
return cache->device->concurrency.cache_line;
|
||||
}
|
||||
|
||||
#endif /* OCF_CONCURRENCY_H_ */
|
||||
|
Reference in New Issue
Block a user