Commit Graph

760 Commits

Author SHA1 Message Date
Adam Rutkowski
6de280283a Fix hash_table_entries param type in ocf_metadata_concurrency_attached_init
Number of hash buckets is 32 bit integer.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-25 14:26:17 -04:00
Adam Rutkowski
937b010ef6 Synchronize access to cleaner shared structures
Cleaning policy callbacks are typically  called with hash buckets or
cache lines locked. However cleaning policies maintain structures
which are shared across multiple cache lines (e.g. ALRU list).
Additional synchronization is required for theese structures to
maintain integrity.

ACP already implements hash bucket locks. This patch is adding
ALRU list mutex.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-25 14:26:17 -04:00
Adam Rutkowski
5e28474322 Adding partition locks
Adding locks to assure partition list consistency. Partition
lists is typically modified under cacheline or hash bucket lock.
This is not sufficient synchronization as adding/removing cacheline
from partition list affects neighbouring cachelines state as well.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-25 14:26:17 -04:00
Adam Rutkowski
41d3542952 Lock collision page in metadata flush
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-25 14:26:15 -04:00
Michal Mielewczyk
f461f3c62e Extend probe informations with cache name.
Since ocf requires loading cache with the same name as it was stopped, it should
also allow to read name from metadata.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-25 07:59:50 -04:00
Michal Mielewczyk
39c5819a51 Set cache name before adding it to context list.
This change allows to check if specified cache name name is unique. To prevent
adding cache instance with the same name, context lock is acquired until name
isn't set.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-25 07:59:50 -04:00
Michal Mielewczyk
c04ea4898f Check if loaded cache name is valid.
When loading cache, it's name should be the same as the loaded one.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-25 05:06:37 -04:00
Michal Rakowski
23aba6a9f3 nhit PP: Added info about setting nhit params
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-25 11:04:51 +02:00
Michal Mielewczyk
d332c9d97f New ocf error code in test framework.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-25 03:54:33 -04:00
Adam Rutkowski
be3b402162 Synchronization of collision table
Adding synchronization around metadata collision segment pages.
This part of metadata is modified when cacheline is mapped/unmapped
and when dirty status changes.

Synchronization on page level is required on top of cacheline
and hash bucket locks to assure metadata flush always reads
consistent state when copying entire collision table memory
page.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-25 00:26:29 -04:00
Adam Rutkowski
5684b53d9b Adding collision table locks
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-24 22:59:35 -04:00
Adam Rutkowski
727a6d2e4b Fix error handling in IO ocf_mngt_cache_io_classes_configure
Modifying _ocf_mngt_io_class_configure and _ocf_mngt_io_class_remove
to never return -OCF_ERR_IO_CLASS_NOT_EXIST error code. This
return code was ignored by the caller anyway. In _ocf_mngt_io_class_remove
-OCF_ERR_IO_CLASS_NOT_EXIST indicated the IO class is already
removed, which is not an error. In _ocf_mngt_io_class_configure
-OCF_ERR_IO_CLASS_NOT_EXIST indicated empty IO class name, which
is actualy invalid input. This change made it possible to remove
erroneous error handling for -OCF_ERR_IO_CLASS_NOT_EXIST case in
ocf_mngt_cache_io_classes_configure.

This change fixes IO class configuration.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-24 21:51:43 -04:00
Michal Mielewczyk
2abccadb9e New error code for invaild loaded cache name.
When loading cache metadata, it should be started with exactly the same name as
it was running previously. Otherwise load should fail and return newly added
error code.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-24 07:40:21 -04:00
Michał Wysoczański
07aa29fc56
Merge pull request #283 from rafalste/fix_nhit_param_value
Accept max values of nhit PP as valid.
2019-09-24 10:46:38 +02:00
Michał Wysoczański
c9d69a6f70
Merge pull request #282 from robertbaldyga/async-lock-spinlock
ocf_async_lock: Replace mutex with spinlocks
2019-09-24 10:35:05 +02:00
Rafal Stefanowski
9cb5c60c80 Accept max values of nhit PP as valid.
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2019-09-23 15:58:57 +02:00
Robert Baldyga
b8f5f135fe ocf_async_lock: Replace mutex with spinlocks
The ocf_async_lock may be used in atomic context, thus we need
to replace synchronization primitives to non-sleeping variants.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-23 15:54:25 +02:00
Michal Rakowski
43bd843bc8
Merge pull request #281 from robertbaldyga/create-volume-ram-check
Create new volume instead of using non-allocated one
2019-09-23 15:01:53 +02:00
Robert Baldyga
dd0a39eea7 Create new volume instead of using non-allocated one
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-23 14:01:17 +02:00
Adam Rutkowski
938795e081 Unit tests for hash bucket locks ordering
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
30f22d4f47 Optimize cacheline locking in ocf_engine_prepare_clines
Hash bucket read/write lock is sufficient to safely attempt
cacheline trylock/lock. This change removes cacheline lock
global RW semaprhore and moves cacheline trylock/lock under
hash bucket read/write lock respectively.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
5248093e1f Move common mapping and locking logic to dedicated function
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
d2bd807e49 Remove calls to OCF_METADATA_(UN)LOCK_WR(RD)
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
2333d837fb Add single hash bucket lock interface
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
3a70d68d38 Switch from global metadata locks to hash-bucket locks in engines
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
b39bcf86d4 Separate engine map/evict (refactoring)
This temporarily increases amount of boiler-plate code, but
this is going to be mitigated in the following commits.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
d91012f4b4 Introduce hash bucket locks
There is one RW lock per hash bucket. Write lock is required
to map cacheline, read lock is sufficient for traversing.
Hash bucket locks are always acquired under global metadata
read lock. This assures mutual exclusion with eviction and
management paths, where global metadata write lock is held.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
42f65c3fbb Change ocf_metadata_(un)lock -> OCF_METADATA_(UN)LOCK
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
f34cacf150 Move resume callback to async lock function params (refactoring)
This is a step towards common async lock interface in OCF.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Jan Musiał
ed1ae71992
Merge pull request #258 from arutk/metadata_lock_per_bucket
Improve metadata lock granularity
2019-09-20 15:33:37 +02:00
Michal Rakowski
3ced3fb9db
Merge pull request #278 from imjfckm/fix-pp-tests
Fix pp tests
2019-09-20 15:13:41 +02:00
Jan Musial
21a3945a3c Fix PP tests
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-20 14:56:32 +02:00
Jan Musial
827273645c Use better function for calculating occupancy 2019-09-20 14:56:17 +02:00
Michał Mielewczyk
9d41c94827
Merge pull request #264 from KamilLepek/new_sec
Negative tests for promotion policy
2019-09-19 12:45:09 +02:00
Adam Rutkowski
f988141289
Merge pull request #275 from imjfckm/fix-secure-erase-tests
Fix secure erase tests
2019-09-19 11:12:14 +02:00
Kamil Łepek
61a266eed1
Merge pull request #274 from robertbaldyga/set-metadata-version-19.09
Set proper metadata version for coming 19.09 release
2019-09-19 10:53:22 +02:00
Jan Musial
6b1d1754db Fix secure erase tests
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-19 10:10:20 +02:00
Robert Baldyga
1ec0040767 Set proper metadata version for coming 19.09 release
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-18 18:42:21 +02:00
Kamil Lepek
71d8c8d698 Negative tests for promotion policy
Signed-off-by: Kamil Lepek <kamil.lepek94@gmail.com>
2019-09-18 17:59:40 +02:00
Kamil Łepek
7131178e71
Merge pull request #272 from imjfckm/fix-pp-validation
Add PP type validation
2019-09-18 17:30:23 +02:00
Jan Musial
0c1ccddf8a Add PP type validation
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-18 15:12:23 +02:00
Michał Mielewczyk
af48ee56e3
Merge pull request #270 from imjfckm/pp-change-param-api
Pp change param api
2019-09-18 13:41:41 +02:00
Adam Rutkowski
31b6952d6c
Merge pull request #268 from KamilLepek/name_fix
Fix for security tests need of name param when creating multiple cores
2019-09-18 12:01:59 +02:00
Jan Musial
0e85ebe4a3 Get PP params in line with rest of OCF
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-18 11:15:41 +02:00
Kamil Lepek
daae1b915d Fix for security tests need of name param when creating multiple cores
Signed-off-by: Kamil Lepek <kamil.lepek94@gmail.com>
2019-09-18 11:12:58 +02:00
Michal Rakowski
ecb3b25a33
Merge pull request #267 from imjfckm/pp-validation-at-start
Add validation of PP for cache start config
2019-09-18 10:53:26 +02:00
Jan Musial
e9bd139349 Add validation of PP for cache start config
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-18 09:53:13 +02:00
Jan Musiał
f1d8a18a30
Merge pull request #263 from imjfckm/pp-get-param-fix
Add missing stuff from get_param in PP
2019-09-17 15:22:51 +02:00
Jan Musial
e8fc2c24f1 Add missing stuff from get_param in PP
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-17 15:05:29 +02:00
Michał Mielewczyk
f86287ef06
Merge pull request #261 from micrakow/coverity_19_9
Fixed some bugs found by the coverity tool
2019-09-17 09:25:18 +02:00