Commit Graph

334 Commits

Author SHA1 Message Date
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 Musial
827273645c Use better function for calculating occupancy 2019-09-20 14:56:17 +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
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
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
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
Michal Mielewczyk
c5edc60345 Fix stats update in cleaner.
Core is not assigned to request in cleaner, so to increase it's stats it has to
be retrieved from mapping.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-16 05:59:28 -04:00
Michał Mielewczyk
0391fc17b7
Merge pull request #255 from imjfckm/pp-tests
Add promotion policies functional tests
2019-09-16 09:34:16 +02:00
Jan Musiał
58012cd14b
Merge pull request #260 from mmichal10/unify-inactive-cores-stats
Unify inactive cores stats
2019-09-16 09:03:08 +02:00
Michal Mielewczyk
f226f978f0 Unify inactive cores stats.
Inactive core stats should be caluculated and returned to adapter in unified
from, just like all stats are.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-16 02:49:42 -04:00
Michal Mielewczyk
494a1ccc79 Extract stats builder utils to separate file.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-12 05:21:17 -04:00
Jan Musial
703a757db1 Fix minor bugs in promotion policy
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-11 10:31:14 +02:00
Jan Musial
633f31716e Make NHIT API naming convention similar to cleaning
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-11 07:31:50 +02:00
Michal Rakowski
29c1c7f9e8
Merge pull request #253 from mmichal10/stats-refactor
Stats builder for ioclasses
2019-09-10 14:56:26 +02:00
Michal Mielewczyk
e6f032cae9 Fix typo.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 08:01:10 -04:00
Michal Mielewczyk
01ce586e6a Use API instead of raw variables to update block stats.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 08:01:09 -04:00
Michal Mielewczyk
51c9c516a4 Use API instead of raw variables to update req stats.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 08:01:09 -04:00
Michal Mielewczyk
b4c384eb2d Use API instead of raw variables to update error stats.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 08:01:09 -04:00
Michal Mielewczyk
0d4f4d3294 Added API for updating statistics.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 08:01:09 -04:00
Michal Mielewczyk
42d6dbbf11 Remove low-level stats getters from public API.
Since stats builder is implemented for retrieving cache, core and ioclass stats,
adapters should use it instead.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 08:01:09 -04:00
Michal Mielewczyk
89de6038c1 Split retrieving core stats and config info into two functions.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 08:01:09 -04:00
Michal Mielewczyk
f9da89263b Stats builder for ioclass statistics.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 04:32:21 -04: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
Michal Mielewczyk
2450d3da4b Move block stats counters to ioclass section.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-09 02:46:45 -04:00
Michal Mielewczyk
8304ed84b8 More precise percentage value in stats builder.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-09 02:46:45 -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
Robert Bałdyga
1f9f79f11d
Merge pull request #250 from robertbaldyga/parts-meta-new-section
Move parts metadata to separate section
2019-08-29 14:15:31 +02:00
Jan Musial
ee3fdb0506 Change nhit_hash names to avoid collision with kernel
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-08-29 13:24:54 +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
Jan Musiał
0a9f197b10
Merge pull request #238 from arutk/split_cacheline_lock_trylock
Split cacheline locking implementation into trylock and lock
2019-08-29 09:49:53 +02:00
Adam Rutkowski
6dd1af7df7 Split cacheline locking implementation into trylock and lock
This change refactors the code in order to prepare for removing
global concurrency lock, which won't be needed after per-bucket
metadata locking is in place.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-08-28 18:54:19 -04:00
Robert Bałdyga
358c529eff
Merge pull request #243 from arutk/simplify_freelist_striping_init
Initialize freelist using metadata layout implementation
2019-08-27 17:12:04 +02:00
Michal Rakowski
e3a20c0da0
Merge pull request #239 from imjfckm/pp-implementation
nhit promotion policy implementation
2019-08-27 12:42:03 +02:00
Adam Rutkowski
860c8c7a0f Initialize freelist using metadata layout implementation
Metadata layout (seq / striping) is already encapsulated
in ocf_metadata_layout_iface, no need to double this logic
in freelist initialization.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-08-26 15:48:11 -04:00
Jan Musial
62a0ccdd9f nhit promotion policy implementation
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-08-22 13:34:38 +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
Robert Bałdyga
8ed525ae7f
Merge pull request #234 from mdnfiras/sync-prim-destroyers
Adding synchronization primitives destroyers
2019-08-13 15:46:26 +02:00
Firas Medini
33c96d226e Verifying IO address and size
IO address and size must be multiple of sector size. If not, ocf_io_new() will return NULL.

Signed-off-by: Firas Medini <mdnfiras@yahoo.com>
2019-08-13 05:37:14 -07:00
Firas Medini
1f979f630b Adding synchronization primitives destroyers
Environment should provide calls for destroying primitives (i.e. env_mutex_destroy()) and OCF should call these functions in its cleanup paths.

Signed-off-by: Firas Medini <mdnfiras@yahoo.com>
2019-08-13 05:13:11 -07:00
Robert Baldyga
9730b2bd1f Remove remaining core_id occurrences from public API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-07 16:12:06 +02: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
433a25a1b2 Renamed 'added' flag in core metadata to 'valid'.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-06 07:08:12 -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
Adam Rutkowski
9649f25415
Merge pull request #229 from robertbaldyga/cleanup-metadata
Metadata interface cleanup
2019-08-05 14:11:04 +02: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
Michal Mielewczyk
80f82cab2b Deinitialize volume types in ocf internally.
Adapter can provide ops for data type deinitialization, if any additional
operations are required on deinitialization procedure.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-05 06:16:46 -04:00
Robert Baldyga
fdf6d07b85 Fix typo "collisioin" -> "collision"
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-03 20:04:23 +02:00
Robert Baldyga
4b1a3fa4b5 Simplify metadata_raw interface
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-03 20:04:23 +02:00
Robert Baldyga
a31ddd44cb Remove ocf_metadata_hash_entries_hash()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-03 20:04:23 +02:00
Robert Baldyga
ff7583c6da Simplify partition metadata interface
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-03 20:04:23 +02:00
Robert Baldyga
3108f36e42 Simplify collision matadata interface
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-03 20:04:23 +02:00
Robert Baldyga
0b0546302f Remove ocf_metadata_get_core_sector()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-03 20:04:23 +02:00
Robert Baldyga
0ca0ea1343 Remove ocf_metadata_line_size_is_valid()
This function is no longer used.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-03 20:04:23 +02:00
Robert Baldyga
92c7e12549 Remove core id from public API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-30 09:26:26 +02: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
4f0735b503 Ensure that core name is set and unique
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-29 17:37:48 +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
Kamil Łepek
05be67a72b
Merge pull request #220 from arutk/metadata_offset_hash
New hash function formula
2019-07-29 13:03:04 +02:00
Jan Musiał
fa14d6a4b5
Merge pull request #221 from arutk/metadata_rename_concurrency
Restrutcure concurrency code
2019-07-29 09:42:37 +02:00
Robert Baldyga
3355a6cd56 engine: discard: Add missing put on error path
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-27 19:06:11 +02:00
Adam Rutkowski
494861c994 Rename cache_concurrency to cache_line_concurrency
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-07-24 15:32:12 -04: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
Adam Rutkowski
3dd4263bc8 Change hash function
Modify ocf_metadata_hash_func to return consecutive (modulo @hash_table_entries)
values for consecutive @core_line_num. This way it is trivial to sort all
core lines within a single request according to their hash value. This kind
of sorting will be required to assure that future hash bucket metadata locks
are always acquired in fixed order, eliminating the risk of dead locks.

This change is part of fine granularity metadata lock implementation.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-07-24 15:02:34 -04:00
Adam Rutkowski
7184f7787c Cleanup map_info struct
1. Rename hash_key -> hash
2. Better comments for hash and coll_idx

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-07-24 13:12:05 -04:00
Michal Rakowski
aa02f56b05
Merge pull request #218 from robertbaldyga/rm-includes-metadata-superblock
Remove unneeded includes in metadata_superblock.h
2019-07-23 13:56:39 +02: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
Robert Baldyga
ab2f8b199a Remove unneeded includes in metadata_superblock.h
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-23 13:00:05 +02:00
Jan Musiał
232f0cd8d7
Merge pull request #216 from robertbaldyga/io-and-req-in-single-allocation
Allocate io and req in single allocation
2019-07-23 11:40:30 +02:00
Jan Musiał
08abf69224
Merge pull request #217 from Open-CAS/remove-redundant-field
Remove redundant field from struct ocf_cache_device
2019-07-23 09:55:03 +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
Robert Baldyga
6822ab6140 Remove redundant field from struct ocf_cache_device
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-19 12:59:14 +02:00
Robert Baldyga
e64bb50a4b Allocate io and request in single allocation
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-17 10:31:23 +02:00
Robert Baldyga
61414f889e Introduce OCF IO allocator
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-17 10:31:23 +02:00
Robert Baldyga
e254c9b587 Merge new_io and configure into one function
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-17 10:31:23 +02:00
Robert Baldyga
4d2d31ff76 Introduce ocf_io_internal
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-17 09:54:51 +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
Jan Musial
aab3c4fbaa Fix typo in metadata_hash_entries fcn
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-07-04 14:01:27 +02:00
Jan Musial
ede2bcdf48 Fix volumes deinit routine
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-28 13:03:14 +02:00
Jan Musiał
e7e0ad957d
Merge pull request #201 from mmichal10/fix-load-error-handling
Fix error handling in case of failed load
2019-06-26 12:24:02 +02:00
Jan Musial
2c629be4c2 Fix leaking front and core volumes
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-26 10:00:49 +02:00
Michal Mielewczyk
52f6d6280b Fix error handling in case of failed load
Store default metadata values and restore them in case of failed load.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-25 09:31:05 -04:00
Jan Musial
4a20ce9c25 Fix leaking cache references
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-25 11:43:28 +02:00
Michal Rakowski
b1a6c467a0 Introduce core_is_dirty mngt method
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-06-25 09:12:44 +02:00
Michal Rakowski
a818ffabfd Move ocf_mngt_cache_is_dirty to public mngt interface 2019-06-24 15:23:06 +02:00
Michal Rakowski
2925147395 Remove reduntant dirty check
When flush completion is called there could be some clines marked as dirty since those could be in-use during flushing.
2019-06-24 14:24:34 +02:00
Jan Musial
aec01f216c Revert "Disallow ocf_cache_mode_max in io_class config"
This reverts commit 5ad5c521df.

This change broke setting IO-classes with allocation. We use max as a
special value to indicate that the partition should use cache global
caching mode.
2019-06-14 14:08:28 +02:00
Michał Mielewczyk
f9f75e7265
Merge branch 'master' into wo_improvements 2019-06-13 11:32:06 +02:00
Adam Rutkowski
6bb1d21489 Do not repartition cachelines in WO read
WO cache mode should not repartition cachelines nor affect cacheline
status in any way when servicing read. Reading data from the cache
is just an internal optimization. Also WO cache mode is designed to
be used with partitioning based on write life-time hints and read
requests do not carry write lifetime hint by definition.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-06-13 13:14:30 -04:00
Michal Mielewczyk
e8b24d811b Check if all required ops are provided by adapter.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-13 04:46:03 -04:00
Adam Rutkowski
9dc1381b77 Refactor ocf_submit_cache_reqs map indexing
Refactoring ocf_submit_cache_reqs to make it clear that
req->map is accessed at index derived from offset argument,
not necesarily starting at 0.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-06-12 18:56:40 -04:00