Add cache locking functions in trylock variant
- Add cache trylock and read trylock functions. - Introduce new error code -OCF_ERR_NO_LOCK. - Change trylock functions in env to return this code in case of lock contention. [ENV CHANGES REQUIRED] Following functions should return 0 on success or -OCF_ERR_NO_LOCK in case of lock contention: - env_mutex_trylock() - env_rwsem_up_read_trylock() - env_rwsem_up_write_trylock() Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
@@ -133,7 +133,7 @@ void ocf_cleaner_run(ocf_cleaner_t cleaner, ocf_queue_t queue)
|
||||
}
|
||||
|
||||
/* Sleep in case there is management operation in progress. */
|
||||
if (env_rwsem_down_write_trylock(&cache->lock) == 0) {
|
||||
if (env_rwsem_down_write_trylock(&cache->lock)) {
|
||||
cleaner->end(cleaner, SLEEP_TIME_MS);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user