Rename cacheline concurrency struct to alock

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2021-04-02 19:15:59 -05:00 committed by Kozlowski Mateusz
parent 927bc805fe
commit d22a3ad0e0
7 changed files with 208 additions and 210 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
/** /**
* @brief OCF cache concurrency module handle * @brief OCF cache concurrency module handle
*/ */
struct ocf_cache_line_concurrency; struct ocf_alock;
/** /**
* @brief Initialize OCF cache concurrency module * @brief Initialize OCF cache concurrency module
@ -25,7 +25,7 @@ struct ocf_cache_line_concurrency;
* @return 0 - Initialization successful, otherwise ERROR * @return 0 - Initialization successful, otherwise ERROR
*/ */
int ocf_cache_line_concurrency_init(struct ocf_cache_line_concurrency **self, int ocf_cache_line_concurrency_init(struct ocf_alock **self,
unsigned num_clines, struct ocf_cache *cache); unsigned num_clines, struct ocf_cache *cache);
/** /**
@ -34,7 +34,7 @@ int ocf_cache_line_concurrency_init(struct ocf_cache_line_concurrency **self,
* @param self - cacheline concurrency private data * @param self - cacheline concurrency private data
*/ */
void ocf_cache_line_concurrency_deinit( void ocf_cache_line_concurrency_deinit(
struct ocf_cache_line_concurrency **self); struct ocf_alock **self);
/** /**
* @brief Get number of waiting (suspended) OCF requests in due to cache * @brief Get number of waiting (suspended) OCF requests in due to cache
@ -44,7 +44,7 @@ void ocf_cache_line_concurrency_deinit(
* *
* @return Number of suspended OCF requests * @return Number of suspended OCF requests
*/ */
uint32_t ocf_cache_line_concurrency_suspended_no(struct ocf_cache_line_concurrency *c); uint32_t ocf_cache_line_concurrency_suspended_no(struct ocf_alock *c);
/** /**
* @brief Return memory footprint conusmed by cache concurrency module * @brief Return memory footprint conusmed by cache concurrency module
@ -71,7 +71,7 @@ typedef void (*ocf_req_async_lock_cb)(struct ocf_request *req);
* @retval OCF_LOCK_NOT_ACQUIRED - OCF request lock not acquired, request was * @retval OCF_LOCK_NOT_ACQUIRED - OCF request lock not acquired, request was
* added into waiting list. When lock will be acquired @cmpl cllback be called * added into waiting list. When lock will be acquired @cmpl cllback be called
*/ */
int ocf_req_async_lock_wr(struct ocf_cache_line_concurrency *c, int ocf_req_async_lock_wr(struct ocf_alock *c,
struct ocf_request *req, ocf_req_async_lock_cb cmpl); struct ocf_request *req, ocf_req_async_lock_cb cmpl);
/** /**
@ -87,7 +87,7 @@ int ocf_req_async_lock_wr(struct ocf_cache_line_concurrency *c,
* @retval OCF_LOCK_NOT_ACQUIRED - OCF request lock not acquired, request was * @retval OCF_LOCK_NOT_ACQUIRED - OCF request lock not acquired, request was
* added into waiting list. When lock will be acquired @cmpl callback be called * added into waiting list. When lock will be acquired @cmpl callback be called
*/ */
int ocf_req_async_lock_rd(struct ocf_cache_line_concurrency *c, int ocf_req_async_lock_rd(struct ocf_alock *c,
struct ocf_request *req, ocf_req_async_lock_cb cmpl); struct ocf_request *req, ocf_req_async_lock_cb cmpl);
/** /**
@ -96,7 +96,7 @@ int ocf_req_async_lock_rd(struct ocf_cache_line_concurrency *c,
* @param c - cacheline concurrency private data * @param c - cacheline concurrency private data
* @param req - OCF request * @param req - OCF request
*/ */
void ocf_req_unlock_wr(struct ocf_cache_line_concurrency *c, void ocf_req_unlock_wr(struct ocf_alock *c,
struct ocf_request *req); struct ocf_request *req);
/** /**
@ -105,7 +105,7 @@ void ocf_req_unlock_wr(struct ocf_cache_line_concurrency *c,
* @param c - cacheline concurrency private data * @param c - cacheline concurrency private data
* @param req - OCF request * @param req - OCF request
*/ */
void ocf_req_unlock_rd(struct ocf_cache_line_concurrency *c, void ocf_req_unlock_rd(struct ocf_alock *c,
struct ocf_request *req); struct ocf_request *req);
/** /**
@ -114,7 +114,7 @@ void ocf_req_unlock_rd(struct ocf_cache_line_concurrency *c,
* @param c - cacheline concurrency private data * @param c - cacheline concurrency private data
* @param req - OCF request * @param req - OCF request
*/ */
void ocf_req_unlock(struct ocf_cache_line_concurrency *c, void ocf_req_unlock(struct ocf_alock *c,
struct ocf_request *req); struct ocf_request *req);
/** /**
@ -131,7 +131,7 @@ void ocf_req_unlock(struct ocf_cache_line_concurrency *c,
* @retval true - cache line is used * @retval true - cache line is used
* @retval false - cache line is not used * @retval false - cache line is not used
*/ */
bool ocf_cache_line_is_used(struct ocf_cache_line_concurrency *c, bool ocf_cache_line_is_used(struct ocf_alock *c,
ocf_cache_line_t line); ocf_cache_line_t line);
/** /**
@ -144,7 +144,7 @@ bool ocf_cache_line_is_used(struct ocf_cache_line_concurrency *c,
* @retval true - there are waiters * @retval true - there are waiters
* @retval false - No waiters * @retval false - No waiters
*/ */
bool ocf_cache_line_are_waiters(struct ocf_cache_line_concurrency *c, bool ocf_cache_line_are_waiters(struct ocf_alock *c,
ocf_cache_line_t line); ocf_cache_line_t line);
bool ocf_cache_line_is_locked_exclusively(struct ocf_cache *cache, bool ocf_cache_line_is_locked_exclusively(struct ocf_cache *cache,
@ -157,7 +157,7 @@ bool ocf_cache_line_is_locked_exclusively(struct ocf_cache *cache,
* @param req - OCF request * @param req - OCF request
* @param entry - request map entry number * @param entry - request map entry number
*/ */
void ocf_req_unlock_entry(struct ocf_cache_line_concurrency *c, void ocf_req_unlock_entry(struct ocf_alock *c,
struct ocf_request *req, uint32_t entry); struct ocf_request *req, uint32_t entry);
/** /**
@ -166,7 +166,7 @@ void ocf_req_unlock_entry(struct ocf_cache_line_concurrency *c,
* @param cache - OCF cache instance * @param cache - OCF cache instance
* @param line - Cache line to be unlocked * @param line - Cache line to be unlocked
*/ */
void ocf_cache_line_unlock_rd(struct ocf_cache_line_concurrency *c, void ocf_cache_line_unlock_rd(struct ocf_alock *c,
ocf_cache_line_t line); ocf_cache_line_t line);
/** /**
@ -178,7 +178,7 @@ void ocf_cache_line_unlock_rd(struct ocf_cache_line_concurrency *c,
* @retval true - read lock successfully acquired * @retval true - read lock successfully acquired
* @retval false - failed to acquire read lock * @retval false - failed to acquire read lock
*/ */
bool ocf_cache_line_try_lock_rd(struct ocf_cache_line_concurrency *c, bool ocf_cache_line_try_lock_rd(struct ocf_alock *c,
ocf_cache_line_t line); ocf_cache_line_t line);
/** /**
@ -187,7 +187,7 @@ bool ocf_cache_line_try_lock_rd(struct ocf_cache_line_concurrency *c,
* @param c - cacheline concurrency private data * @param c - cacheline concurrency private data
* @param line - Cache line to be unlocked * @param line - Cache line to be unlocked
*/ */
void ocf_cache_line_unlock_wr(struct ocf_cache_line_concurrency *c, void ocf_cache_line_unlock_wr(struct ocf_alock *c,
ocf_cache_line_t line); ocf_cache_line_t line);
/** /**
@ -199,7 +199,7 @@ void ocf_cache_line_unlock_wr(struct ocf_cache_line_concurrency *c,
* @retval true - write lock successfully acquired * @retval true - write lock successfully acquired
* @retval false - failed to acquire write lock * @retval false - failed to acquire write lock
*/ */
bool ocf_cache_line_try_lock_wr(struct ocf_cache_line_concurrency *c, bool ocf_cache_line_try_lock_wr(struct ocf_alock *c,
ocf_cache_line_t line); ocf_cache_line_t line);
/** /**
@ -208,7 +208,7 @@ bool ocf_cache_line_try_lock_wr(struct ocf_cache_line_concurrency *c,
* @param cache - cache instance * @param cache - cache instance
* @return cacheline concurrency context * @return cacheline concurrency context
*/ */
static inline struct ocf_cache_line_concurrency * static inline struct ocf_alock *
ocf_cache_line_concurrency(ocf_cache_t cache) ocf_cache_line_concurrency(ocf_cache_t cache)
{ {
return cache->device->concurrency.cache_line; return cache->device->concurrency.cache_line;

View File

@ -494,7 +494,7 @@ static void ocf_engine_evict(struct ocf_request *req)
static int lock_clines(struct ocf_request *req) static int lock_clines(struct ocf_request *req)
{ {
struct ocf_cache_line_concurrency *c = ocf_cache_line_concurrency(req->cache); struct ocf_alock *c = ocf_cache_line_concurrency(req->cache);
enum ocf_engine_lock_type lock_type = enum ocf_engine_lock_type lock_type =
req->engine_cbs->get_lock_type(req); req->engine_cbs->get_lock_type(req);

View File

@ -24,7 +24,7 @@
static void _ocf_read_generic_hit_complete(struct ocf_request *req, int error) static void _ocf_read_generic_hit_complete(struct ocf_request *req, int error)
{ {
struct ocf_cache_line_concurrency *c = ocf_cache_line_concurrency( struct ocf_alock *c = ocf_cache_line_concurrency(
req->cache); req->cache);
if (error) if (error)

View File

@ -346,7 +346,7 @@ static inline bool _lru_evp_all_empty(struct ocf_lru_iter *iter)
static bool inline _lru_trylock_cacheline(struct ocf_lru_iter *iter, static bool inline _lru_trylock_cacheline(struct ocf_lru_iter *iter,
ocf_cache_line_t cline) ocf_cache_line_t cline)
{ {
struct ocf_cache_line_concurrency *c = struct ocf_alock *c =
ocf_cache_line_concurrency(iter->cache); ocf_cache_line_concurrency(iter->cache);
return iter->cl_lock_write ? return iter->cl_lock_write ?
@ -357,7 +357,7 @@ static bool inline _lru_trylock_cacheline(struct ocf_lru_iter *iter,
static void inline _lru_unlock_cacheline(struct ocf_lru_iter *iter, static void inline _lru_unlock_cacheline(struct ocf_lru_iter *iter,
ocf_cache_line_t cline) ocf_cache_line_t cline)
{ {
struct ocf_cache_line_concurrency *c = struct ocf_alock *c =
ocf_cache_line_concurrency(iter->cache); ocf_cache_line_concurrency(iter->cache);
if (iter->cl_lock_write) if (iter->cl_lock_write)

View File

@ -51,7 +51,7 @@ int ocf_metadata_actor(struct ocf_cache *cache,
ocf_cache_line_t i, next_i; ocf_cache_line_t i, next_i;
uint64_t start_line, end_line; uint64_t start_line, end_line;
int ret = 0; int ret = 0;
struct ocf_cache_line_concurrency *c = struct ocf_alock *c =
ocf_cache_line_concurrency(cache); ocf_cache_line_concurrency(cache);
start_line = ocf_bytes_2_lines(cache, start_byte); start_line = ocf_bytes_2_lines(cache, start_byte);

View File

@ -60,7 +60,7 @@ struct ocf_cache_device {
uint64_t metadata_offset; uint64_t metadata_offset;
struct { struct {
struct ocf_cache_line_concurrency *cache_line; struct ocf_alock *cache_line;
} concurrency; } concurrency;
struct ocf_superblock_runtime *runtime_meta; struct ocf_superblock_runtime *runtime_meta;