Commit Graph

93 Commits

Author SHA1 Message Date
Robert Bałdyga
75569ecaba
Merge pull request #284 from mmichal10/prevent-cache-name-duplicate
Prevent cache name duplicate
2019-09-25 15:36:08 +02:00
Michał Wysoczański
aafe870e44
Merge pull request #280 from arutk/metadata_sync_2
Additional metadata synchronization
2019-09-25 14:11:59 +02: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
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
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
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
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
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
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
Michal Rakowski
83e23c5593 Fixed some bugs found by the coverity tool
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-16 15:49:37 +02:00
Adam Rutkowski
13cf871a13 Per-execution-context freelists
Global free cacheline list is divided into a set of freelists, one
per execution context. When attempting to map addres to cache, first
the freelist for current execution context is considered (fast path).
If current execution context freelist is empty (fast path failure),
mapping function attempts to get freelist from other execution context
list (slow path).

The purpose of this change is improve concurrency in freelist access.
It is part of fine granularity metadata lock implementation.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-09 16:19:52 -04:00
Robert Bałdyga
5fd239d2bb
Merge pull request #245 from imjfckm/switching-pp
Switching mechanism for promotion policies
2019-08-30 11:35:16 +02:00
Jan Musial
a1d3cf0c4d Switching mechanism for promotion policies
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-08-29 13:24:26 +02:00
Robert Baldyga
d10c618065 Move parts metadata to separate section
Fix problem introduced by increasing partition name size to 1024 bytes,
which effectively made superblock bigger than one page. Due to this
flushing superblock required more than one io, which in case of dirty
shutdown between these ios resulted in CRC missmatch and made cache
recovery impossible.

Moving parts metadata to separate sections makes superblock fitting
in one page, effectively solving described problem.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-29 10:23:13 +02:00
Michal Mielewczyk
2c27e9a433 Store name for newly initialized cache in array instead of passing pointer.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-20 01:43:11 -04:00
Michal Rakowski
d499ef1c05
Merge pull request #227 from mmichal10/mark-core-added-false
Don't try to remove invalid cores

If valid cache metadata was read, but environment has changed (i.e. number of cache lines has changed) ocf (in error handling path) was trying to close cores which were not opened. It happened due to cores were marked in cache metadata as added, but any cache inserting operation didn't take place.

In this patch 'added' flag in cache metadata was replaced with more meaningful 'valid' - it is set if given core is stored in cache metadata. Moreover, new 'added' flag was added to core run-time metadata and it is set if given core is added to cache.
2019-08-07 13:37:59 +02:00
Michal Mielewczyk
cdc0a575a1 Added 'added' flag in core runtime data.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-06 07:36:39 -04:00
Michal Mielewczyk
5dd09e823b Initialize promotion policy before cleaning policy.
If cleaning policy didn't have init() function,
   '_ocf_mngt_init_instance_load_complete' returned early and promotion policy
   wasn't initialized at all.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-06 06:37:14 -04:00
Michal Mielewczyk
340ca76159 Move check for valid cache size in load.
Loaded cache size should be compared with acutal cache size after loading
superblock.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-05 07:58:38 -04:00
Robert Baldyga
1100cb0b4f Remove cache id from public API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-30 09:26:26 +02:00
Robert Baldyga
259df7ace9 Store core name in metadata
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-30 09:26:26 +02:00
Robert Baldyga
eb4272afa9 Store cache name in metadata
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-30 09:26:17 +02:00
Robert Baldyga
901b39031f Ensure that cache name is set and unique
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-29 17:37:43 +02:00
Robert Baldyga
331b99397f Change ctx lock to rmutex
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-29 15:08:44 +02:00
Adam Rutkowski
e5bed8825c Move metadata concurrency to a separate file
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-07-24 15:32:09 -04:00
Jan Musiał
1fd1a6fe17
Merge pull request #209 from arutk/stop_no_queue
Allow to stop cache without management queue
2019-07-23 13:51:21 +02:00
Jan Musial
917cbd859a Add promotion policy API and use it in I/O path
Promotion policy is supposed to perform ALRU noise filtering by
eliminating one-hit wonders being added to cache and polluting it.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-07-19 13:52:00 +02:00
Adam Rutkowski
4f04b2762f Simplified stop path for cache detached case
When cache is detached we cannot assume there is a management
queue created. This change introduces simplified cache stop
path, performing all the necessary deinit without using
IO queues.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-07-08 18:26:35 -04:00
Michal Mielewczyk
636834dae3 Check for existing metadata when attaching cache.
Instead of overriding existing metadata silently, return appropriate error.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-07-08 09:23:32 -04:00
Adam Rutkowski
b97bb6f53b Add function to check for lazy write cache mode (WO or WB)
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-06-12 12:07:02 -04:00
Adam Rutkowski
82e8c55f4a Write-only cache mode
Write-only cache mode is similar to writeback, however read
operations do not promote data to cache. Reads are mostly serviced
by the core device, only dirty sectors are fetched from the cache.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-06-12 12:07:02 -04:00
Michal Mielewczyk
328d27846a Prevent overriding null terminator in cache name 2019-06-11 12:12:07 +02:00
Michal Rakowski
b1cf6c4642 Changed always returning 0 to void foo
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-06-11 09:53:40 +02:00
Michal Rakowski
30ac3abd74 Small get_ram_needed fix, proper volume is initialized now. 2019-06-11 09:53:40 +02:00
Michal Mielewczyk
be64173066 Fix order of operations in cache stop completion
Prevent metadata updater being freed by pyocf before it's deinitialized by ocf.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-06 09:03:26 -04:00
Michal Mielewczyk
e6bedb692c Unified management functions prefix.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-05 09:31:59 -04:00
Michal Rakowski
9f4536c6e3 Error codes in IO path changed to OCF-specific
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-06-05 09:10:54 +02:00
Robert Baldyga
711de86bff Associate core metadata with core object
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-28 14:49:59 +02:00
Robert Baldyga
8a82be339f Introduce asynchronous cache lock
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-28 11:20:48 +02:00
Robert Baldyga
bdcd4df0ef Remove utils_device.h
Move core mngt related code to ocf_mngt_core.c

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-27 17:00:39 +02:00
Robert Baldyga
7de56940a4 Move ocf_request from utils
ocf_request has always been first class citizen in OCF,
so lets place it along with another essential objects.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-27 15:51:27 +02:00
Jan Musiał
93a06686a7
Merge pull request #165 from robertbaldyga/ctx-get-put
Give ocf_ctx get/put semantics
2019-05-24 14:29:04 +02:00
Robert Baldyga
c903d13ad2 Give ocf_ctx get/put semantics
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-23 15:50:10 +02:00
Robert Baldyga
efa96ef7bd Add ocf_cache_line_size_none
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-23 13:29:49 +02:00
Robert Baldyga
2cf2a59584 Add open_cores parameter to ocf_mngt_cache_device_config
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-21 18:18:33 +02:00
Robert Baldyga
e8bf299176 Remove unnecessary attach step
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-21 09:17:39 +02:00
Michal Mielewczyk
7165bc16c3 Add kick function for cleaner
ocf_kick_cleaner() allows to perfom cleaning immediately.

Nop cleaning policy now returns new 'OCF_CLEANER_DISABLE' macro which indicates
that cleaing shouldn't be performed. To enable it back, ocf_kick_cleaner()
should be called.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-05-10 08:09:56 -04:00