Commit Graph

1056 Commits

Author SHA1 Message Date
Piotr Debski
0aed807ac4 Stack memory reduction for OCF stats
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-09-06 14:34:35 +02:00
Adam Rutkowski
0a09d05a8b Add missing ocf_metadata_read_sb error handling
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-09-06 13:24:05 +02:00
Adam Rutkowski
83b4455a0e unify cache write error stats accounting
In most (6/9) instances across engines ocf_core_stats_cache_error_update
is called upon each cache volume I/O error, possibly multiple times
per a user request in case of multi-cacheline requests. Backfill,
fast and read engine are exceptions, incrementing error stats only
once per user request.

This commit unifies ocf_core_stats_cache_error_update usage so that
in all the engines error statistic is incremented for once for every
error.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-09-05 21:13:06 +02:00
Adam Rutkowski
0cfb8077c5 allocate fixed map status alongside request struct
It is wastefull to allocate a full 1B to store 1 bit of
alock status per cacheline. Fixed allocation of 128 bits
seems more reasonable.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-08-29 20:02:18 +02:00
Adam Rutkowski
2f3e0b0fd0 more precise req->alock_status size calculations
1. On 1 bit per cacheline is required for the status
2. ... however the size must be 8B aligned

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-08-29 20:01:52 +02:00
Krzysztof Majzerowicz-Jaszcz
e12803f547 Fix for bad metadata capacity reported by dmesg
Metadata capacity reported by dmesg was actually a memory footprint.

A proper size of metadata is now reported.

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-07-06 14:30:39 +02:00
Adam Rutkowski
5a71f7c068 validate uuid->size in ocf_volume_init
Optional uuid parameter to ocf_volume_init() points to UUID object
initialized by the user. We should verify it is not excesively large
as we attempt to allocate a buffer to store a copy of the UUID.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-28 08:02:58 +02:00
Adam Rutkowski
364e36ec7e Revert "fix deinitialization of moved composite volume"
The proper way to avoid calling on_deinit() callback on an already
deinitialized volume is to deinitialize type callbacks, as it is done
in the previous commit.

This reverts commit a7f70687a9.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-28 08:02:58 +02:00
Adam Rutkowski
b6587ad622 zero volume->type in ocf_volume_deinit()
After deinitialization of volume there is no need to call back to
type ops. Currently we would erroneously call on_deinit() callback
multiple times if ocf_volume_deinit() is performed more than once,
which we expect to happen and treat as a correct use of API.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-28 08:02:58 +02:00
Robert Baldyga
f0f6ff219b Set core volume type in metadata on core insert
ocf_metadata_flush_superblock() is being called on the cache stop, after
deinitialization of the cores (and their volumes), thus accessing core
volume in superblock flushing procedure leads to use-after-free bug.

Fix this by moving volume type setting to the core insertion code.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-28 07:59:43 +02:00
Robert Baldyga
8822094f14 Fix metadata on disk size calculation when cleaner is disabled
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-21 09:33:42 +02:00
Piotr Debski
c448043b42 Conditional pipeline step for filtering invalid segments
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-06-16 09:33:09 +02:00
Adam Rutkowski
1a27b07f72 Pipeline conditional step
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-06-16 09:33:09 +02:00
Adam Rutkowski
a7f70687a9 fix deinitialization of moved composite volume
After moving from a volume, it's priv is assigned to the new owner.
Destroying the volume after moving from it must not attempt to use the
priv, especially not to attempt to deinit member volumes in case of
composite volume.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:08 +02:00
Adam Rutkowski
5a80237e74 expose composite volume type id in API
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:08 +02:00
Adam Rutkowski
02db4de75b Composite volume io calculations fix
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:08 +02:00
Adam Rutkowski
0030ebdecc Handle already opened volume in volume open
Volumes are now exposed in OCF API and we should gracefully handle
attempt to open already opened volume (instead of ENV_BUG).

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:08 +02:00
Adam Rutkowski
b053f7925a
Merge pull request #702 from robertbaldyga/v22.6-composite-volume
Introduce composite volume
2022-06-02 13:36:21 +02:00
Adam Rutkowski
5f767dd618
Merge pull request #726 from arutk/fipm
flush handling fixes and enhanced tests
2022-06-02 10:46:36 +02:00
Robert Baldyga
b847fa9a61 Introduce composite volume
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-02 09:49:39 +02:00
Robert Baldyga
8858e7344d Replace uuid/type pair with volume object in the device config
It makes it possible to attach/load cache using volume types that have
non-standard constructors.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-02 09:49:39 +02:00
Robert Baldyga
54b951fcdf Make default io allocators part of internal API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-02 09:49:39 +02:00
Robert Baldyga
c9ea68f3bf Introduce on_init/on_deinit ops in ocf_volume interface
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-02 09:49:39 +02:00
Robert Baldyga
af62d14f02 Set priv to NULL on volume deinit
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-02 09:49:39 +02:00
Robert Baldyga
70a410b2fe Improve error handling in ocf_volume_init()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-02 09:49:39 +02:00
Adam Rutkowski
df7ed6920c Fix ops(flush) engine
Flush I/O should be forwarded to core and cache device. In case of core
this is simple - just mirror the I/O from the top volume. Since
cache data is owned by OCF it makes sense to send a simple flush I/O
with 0 address and size.

Current implementation attempts to use cache data I/O interface
(ocf_submit_cache_reqs function) instead of submitting empty flush to
the underlying cache device. This function is designed to read/write
from mapped cachelines while there is no traversation/mapping
performed on flush I/O.

If request map allocation succeeds, this results in sending I/O to
addres 0 with size and flags inherited from the top adapter I/O.
This doesn't make any sense, and can even result in invalid I/O if the
size is greater than cache device size.

Even worse, if flush request map allocation fails (which happens
always in case of large flush requests) then the erroneous call to
ocf_submit_cache_reqs results in NULL pointer dereference.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-01 22:33:35 +02:00
Adam Rutkowski
1992bfc410
Merge pull request #710 from pdebski21/cache_line_size_mismatch
Explicit check for cacheline size mismatch during cache activation
2022-06-01 18:07:36 +02:00
Piotr Debski
0b9104e8d5 Cache metadata and superblock cache line size mismatch check
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-05-23 15:20:35 +02:00
Jan Musial
6016a6f4c7 Mark unlikely branches in pio_concurrency
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-05-18 11:56:06 +02:00
Jan Musial
60a6da7ee6 Extend alock API with entries_count method
Right now alock assumes that number of locks taken will equal number of
core lines. This is not the case in pio, where only parts of metadata
are under locks. If pio request overlaps locked and not-locked metadata
section it will have different core lines number and awaited locks
number. To remedy this discrepancy additional method which gets count of
locks that will be taken/waited on is added to alock API.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-05-16 16:21:08 +02:00
Robert Baldyga
3aa12793a1
Merge pull request #713 from robertbaldyga/use-ocf-div-round-up
Use internal implementation of DIV_ROUND_UP
2022-05-13 21:21:26 +02:00
Robert Baldyga
ad7a40feaf Use internal implementation of DIV_ROUND_UP
It's required, because environments other than Linux kernel may not define
their own DIV_ROUND_UP. Moving it to env would just generate boilerplate,
because its implementation is trivial and portable.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-05-10 09:52:17 +02:00
Robert Baldyga
d4df912f46 Add option to disable cleaner
This allows to avoid allocating cleaner metadata section and effectively
save up to 20% of metadata memory footprint.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-04-28 13:04:27 +02:00
Michal Mielewczyk
e8e4e00bb7 alru: explicit upcasting
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-04-11 15:21:37 +02:00
Michal Mielewczyk
cd4d894348 acp: skip the first bucket on recovering acp
Since the threshold for the first bucket is always zero and the condition to
exit from the loop is never met in the first iteration it is save to start
iterating from `1`

This change is meant to avoid confusing static code analyzers

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-04-11 13:14:25 +02:00
Michal Mielewczyk
edd42fed98 Avoid zero-size memcpy
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-04-08 16:10:28 +02:00
Michal Mielewczyk
92fa8f7e59 Remove redundant standby check
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-04-08 15:34:14 +02:00
Michal Mielewczyk
bc30d2665b Prevent sending io to volume if it not opened
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-04-08 15:34:14 +02:00
Michal Mielewczyk
9734980be2 Free memory when failed to open core volume
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-04-08 15:34:14 +02:00
Adam Rutkowski
8f24556cec Add missing pio deinitialization in standby stop pipeline
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-04-07 12:23:03 +02:00
Adam Rutkowski
550a479cde fix typo in cache mngmt
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-04-07 12:23:03 +02:00
Robert Baldyga
dc9c076ef3 Remove space from names of internal volumes
Those names are used for creating allocators. In Linux kernel environment
starting from version 5.12 there is a kernel warning if allocator name
contains spaces. This patch resolves this problem by replacing spaces with
underscores.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-04-06 13:23:02 +02:00
Robert Baldyga
c677f65212 Avoid double initialization of cleaning policy in standby mode
Cleaning policy is initialized on standby activate, after all the metadata
from primary cache is flushed and the actual recovery is being performed.
Thus initializing it earlier on standby attach is incorrect.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-04-04 12:08:27 +02:00
Robert Baldyga
65918344c0
Merge pull request #691 from arutk/fix_core_load_err
Fix core load cleanup loop
2022-04-01 14:57:58 +02:00
Adam Rutkowski
77380d6579 Fix core load cleanup loop
conf_meta->core_count is not modified during load/recovery in the latest
version. Thus in case of error in cores initialization, in order to
iterate over the initialized cores we must depend on core->added only,
regardles of conf_meta->core_count value. for_each_core() macro does
exactly this.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-04-01 13:53:25 +02:00
Krzysztof Majzerowicz-Jaszcz
1b3f0d44a8 Fix error code for superblock checksum mismatch
Fix error code for superblock checksum mismatch.
Superblock validation now returns a proper error on checksum check fail.

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-04-01 07:23:49 +00:00
Adam Rutkowski
09b73461b4 Always modify valid_core_map together with core_count
.. to assure that superblock config state on drive is consistent

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-03-31 13:37:42 +02:00
Robert Baldyga
9ebb0de878 Do not modify core_count on cache load / activate
Increment core_count only on core addition, and decrement it only on core
removal.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-31 10:00:24 +02:00
Robert Baldyga
25434cb8d1 Explicitly validate valid_core_bitmap consistency
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-30 23:46:06 +02:00
Robert Baldyga
9c751dd2b8 Manage valid_core_bitmap properly
Set bit only on core addition and clean it on core removal.

This allows to avoid conf metadata modification in load / standby load
paths, which effectively prevents issues with metadata mismatch during
consequent standby activate attempts after initial activate failure.
Previously the first attempt changed the metadata, so on comparison with
metadata on drive failed on any following attempt, leading to inability
to activate the cache.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-30 23:46:06 +02:00
Robert Baldyga
d550c8f4ef Fix minor coding style issues
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-30 22:15:50 +02:00
Robert Baldyga
ca8531a421
Merge pull request #685 from arutk/stats2
Return error from stats API functions in standby
2022-03-30 11:57:10 +02:00
Jan Musial
d1bd32add9 Fix potential unsigned overflow in calculations
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-03-30 08:24:39 +02:00
Adam Rutkowski
9a1f9d41b8 Return error from stats API functions in standby
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-03-29 22:20:04 +02:00
Robert Baldyga
af43a240d3 Return more specific error on CRC mismatch
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-28 22:42:59 +02:00
Robert Baldyga
84aa968877 Check for load error before accessing metadata content
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-28 22:08:05 +02:00
Robert Baldyga
174f7b5c2b
Merge pull request #682 from jfckm/zero-cache-volume-priv
Zero cache_volume priv on close
2022-03-28 16:02:02 +02:00
Jan Musial
43e643873a Zero cache_volume priv on close
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-03-28 14:50:25 +02:00
Adam Rutkowski
6b6300c646 Add extra data seek before data fill in mio
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-03-28 14:26:51 +02:00
Adam Rutkowski
4a839cd332 Verify standby/active cache state in OCF entry points
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-03-28 09:42:02 +02:00
Robert Baldyga
aa4622cc01 Make core remove error recoverable
First try to clean only the mapping. This operation does not require any
rollback, so even if flushing collision fails, core object is still
intact. In case of error we inform user that core was not removed by
returning new error code (-OCF_ERR_CORE_NOT_REMOVED).

After flushing collision succeeds we remove core from metadata and
flush superblock at the end. At that point the core is fully removed
from OCF and even if superblock flush error occurs there is nothing we
can do about it, so we just return the error code.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-25 21:32:55 +01:00
Robert Baldyga
643e103fe7 Don't attempt to set data for flush/discard on cache volume
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-17 21:18:31 +01:00
Robert Baldyga
4fc3f8f0d1 Remove extra whitespace
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-09 11:44:27 +01:00
Robert Baldyga
d5b2c65a39 Remove "metadata_layout" parameter of the cache
This feature is replaced with LRU list shuffling.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-07 17:48:25 +01:00
Robert Baldyga
9a956f59cd
Merge pull request #654 from Open-CAS/fix-flapping-merge
Porting fix-flapping patches from v21.6.4 by arutk
2022-03-05 01:31:23 +01:00
Adam Rutkowski
689c44c76b Remove ocf_metadata_probe_cores() implementation
This function must be fixed to work with metadata flapping. Until then
mark as not supported

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-03-04 19:13:40 +01:00
Adam Rutkowski
866bba72bf Explicitly validate superblock after load
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>

Additional changes - load sb recovery CRC check

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-03-04 19:12:51 +01:00
Robert Baldyga
90ff4afcda Check superblock CRC before it is used
Superblock can be used during load of other sections, so we need to check
its CRC before other sections are loaded.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-03-04 19:12:08 +01:00
Krzysztof Majzerowicz-Jaszcz
06f2140090 Removing ocf_metadata_sb_crc_recovery
Removing ocf_metadata_sb_crc_recovery - not used

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-03-04 19:10:47 +01:00
Robert Baldyga
1cce6bf24b
Merge pull request #664 from robertbaldyga/improve-bf
Extend BF queue protection to cache device queue
2022-03-04 18:50:43 +01:00
Robert Baldyga
45cc56f40d Extend BF queue protection to cache device queue
So far the only resource protected by backfill queue blocking was internal
OCF request queue. Move unblock to backfill io completion to protect also
queue of underlying cache device.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-03-02 20:59:51 +01:00
Robert Baldyga
87d71f319e
Merge pull request #662 from jfckm/fix-invalid-message-try-add
Fix message when try-adding already opened core
2022-03-01 14:06:30 +01:00
Jan Musial
e0cd0a4882 Fix message when try-adding already opened core
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-02-18 12:54:13 +01:00
Michal Mielewczyk
116676c18d Verify cache id duing the activate
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-02-17 15:02:03 +01:00
Robert Baldyga
49abe816ce
Merge pull request #649 from pdebski21/1023
fix for issue #1023
2022-02-07 16:17:14 +01:00
Robert Baldyga
805ea14529 Remove runtime recovery in standby mode
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-02-01 03:11:50 +01:00
Robert Baldyga
76684ed8a9
Merge pull request #642 from robertbaldyga/parallelize
Parallelize metadata initialization
2022-02-07 13:53:45 +01:00
Robert Baldyga
e30fd48338
Merge pull request #656 from jfckm/extend-metadata-probe
Include cache mode and cache line size in metadata probe
2022-02-04 13:01:10 +01:00
Jan Musial
8522b0b6e6 Include cache mode and cache line size in metadata probe
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-02-04 08:15:05 +01:00
Robert Baldyga
c176daeec1
Merge pull request #640 from pdebski21/superblock_mismatch
added error code for superblock mismatch
2022-02-03 15:30:03 +01:00
Robert Baldyga
6a665ea6b1 Shuffle entries within freelists
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-31 06:59:28 +01:00
Robert Baldyga
481e5b7b9b Introduce bisect generator utility
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-31 06:59:28 +01:00
Robert Baldyga
93391c78d8 Parallelize ACP recovery
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-31 06:59:28 +01:00
Robert Baldyga
b70492ad3d Parallelize ALRU recovery
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-31 06:59:28 +01:00
Robert Baldyga
8cc71cc9cb Remove ocf_cleaning_init_cache_block() from metadata rebuild
Cleaning policy initializaton initializes metadata for all cache lines
anyway, so this step is not needed.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:30:41 +01:00
Robert Baldyga
48bed40dd7 Reconstruct freelist during metadata rebuild
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:30:39 +01:00
Robert Baldyga
f3e4f8c2db Parallelize ocf_mngt_rebuild_metadata()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:29:52 +01:00
Robert Baldyga
036aca41b3 Parallelize ocf_lru_populate()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:29:21 +01:00
Robert Baldyga
6611b25d1e Initialize LRU lists in domain of cache lines
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:29:21 +01:00
Robert Baldyga
57fd5c1f20 Introduce ocf_parallelize utility
Introduce utility that allows to parallelize management operation across
all available io queues.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:29:21 +01:00
Robert Baldyga
a947127f55 Introduce ocf_lru_add_free() function
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:29:21 +01:00
Robert Baldyga
b82d30a0ef Add missing hb lock functions implementation
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:29:21 +01:00
Robert Baldyga
25e2551964 Check core status during recovery based on core metadata
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:29:21 +01:00
Robert Baldyga
568c565497 Init properties before loading superblock
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-28 19:29:21 +01:00
Piotr Debski
9b980d3f22 fix for issue #1023
Better error for core size mismatch during activation/load

adding pyocf test for new error code

Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-01-25 05:18:16 +01:00
Robert Baldyga
f4daf05237
Merge pull request #639 from arutk/eha
Fix error handling in cache attach
2022-01-19 15:26:34 +01:00
Robert Baldyga
fb8bea67b6 Set core_seq_no only in atomic mode
This prevents using up pool of seq numbers in normal mode and blocking
addition of any new cores.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-19 11:38:12 +01:00
Adam Rutkowski
a32a787e3d Fix error handling in cache attach
Only close cores in error handling if attach parameter "open_cores" is
set to true.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-01-13 17:26:47 +01:00
Michal Mielewczyk
5d74aec921 Add missing return in raw_ram_zero() in error path
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-01-12 07:46:49 +01:00
Adam Rutkowski
294e02bc1b Fail cache recovery in case of erroneous mapping
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-01-10 11:10:02 +01:00
Piotr Debski
609a22cfda added ERROR code for superblock mismatch
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-01-08 23:06:10 +01:00
Adam Rutkowski
9693b82cf9 Only flush superblock at the end of cache attach
The purpose of this change is not to write superblock to the cache
drive untill all other sections are initilized on disk in attach()
path. Combined with superblock clearing at the erarlier stage of
attach(), this assures there are no residual mappings in the collision
section in case of power failure during attach with pre-existing
metadata.

This is implemented by removing ocf_metadata_flush_all_set_status() step
at the beginning of ocf_metadata_flush_all().
ocf_metadata_flush_all() is called, except for the attach() case described
above, in two cases:
1. at the end of cache load - potentially after cache recovery
2. during detaching cache drive in cache stop.

To make sure there are no regressions in the first case, an explicit
_ocf_mngt_attach_shutdown_status() is added to load pipeline before
ocf_metadata_flush_all(). The second case is always ran after cache
drive is attached, so dirty status bit must have already be written to
the disk.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-01-05 13:06:59 +01:00
Adam Rutkowski
196437f9bc Zero superblock before writing metadata
This is the first step towards atomic initialization of metadata
on cache disk.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-01-05 13:06:59 +01:00
Robert Baldyga
c6644116ae
Merge pull request #614 from robertbaldyga/redesign-standby
Redesign failover standby API
2022-01-04 14:07:05 +01:00
Robert Baldyga
4aa3d8f9df Remove "unsafe" path from standby load
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-01-03 20:10:40 +01:00
Jan Musial
ae18ce274e Fix cache size requirements and some logging
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-01-03 14:30:07 +01:00
Robert Baldyga
b40fa0c2bf Fix closing volume on standby stop
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-29 20:54:45 +01:00
Robert Baldyga
86a2896bcf Rename "bind" to "standby"
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-29 20:32:03 +01:00
Robert Baldyga
b25cd91b86 Remove unused ocf_metadata_load_unsafe()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-29 20:31:43 +01:00
Robert Baldyga
716b5751d6 Redesign failover standby API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-29 20:31:40 +01:00
Robert Baldyga
4cabc60d40 Avoid loading runtime metadata sections during recovery
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-29 14:04:19 +01:00
Robert Baldyga
4625763df5 Return error on CRC mismatch during recovery
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-29 14:04:19 +01:00
Robert Baldyga
e73cbad2c7
Merge pull request #631 from mmichal10/dont-stop-cleaner
Don't stop cleaner in activate rollback
2021-12-27 16:51:32 +01:00
Robert Baldyga
0ac66ce4aa Fix cache stop after standby detach
Don't attempt to close cache volume if cache is in standby detached state.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-23 22:39:37 +01:00
Michal Mielewczyk
a8bdba0cb2 Don't stop cleaner in activate rollback
Activate is not responsible for starting cleaner so rollback shouldn't stop it
eiter.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-12-23 14:46:28 +01:00
Bob Chen
b6de614ada fix volume_close completion order
Signed-off-by: Bob Chen <beef9999@qq.com>
2021-12-22 15:18:34 +08:00
Robert Baldyga
a2916313ee
Revert "fix volume_close completion order" 2021-12-21 20:33:34 +01:00
chenbo
aa6e674034 fix volume_close completion order 2021-12-20 20:10:07 +08:00
Robert Baldyga
0751b2c0c0 Fix metadata flapping
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-15 22:21:57 +01:00
Robert Baldyga
cac5869406
Merge pull request #603 from robertbaldyga/metadata-flapping
Introduce flapping of metadata config sections
2021-12-15 17:11:15 +01:00
Robert Baldyga
df9a9f2722 Read superblock sections from cache volume during activate
Because of metadata flapping it is much more complicated to capture those
sections in flight in standby mode, so we read them directly from the cache
volume during the activate.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-15 15:30:34 +01:00
Robert Baldyga
99c8c05f3f Introduce flapping of metadata config sections
This feature provides double buffering of config sections to prevent
situation when power failure during metadata flush leads to partially
updated metadata. Flapping mechanism makes it always possible to perform
graceful rollback to previous config metadata content in such situation.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-15 15:30:34 +01:00
Neil Sun
7f82ef3048 Fix incorrect page count calculation with large PAGE_SIZE
e.g., PAGE_SIZE 65536, cache line 8k.

fix https://github.com/Open-CAS/open-cas-linux/issues/1015

Signed-off-by: Sun Feng <loyou85@gmail.com>
2021-12-14 20:07:59 +08:00
Robert Baldyga
60218759d2
Merge pull request #597 from rafalste/fix_core_zero_size_error
Fix core-zero-size error
2021-12-08 22:04:27 +01:00
Robert Baldyga
21c4673251
Merge pull request #600 from mmichal10/cleaning-cmpl
Call completion if failed to perform cleaning
2021-12-08 22:00:58 +01:00
Michal Mielewczyk
d6f2998890 Call completion if failed to perform cleaning
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-12-08 14:50:50 +01:00
Michal Mielewczyk
911a5cddf0 Deinit all registered volume types
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-12-08 14:16:49 +01:00
Michal Mielewczyk
655f732748 Don't access freed memory
Instead of accessing memory of a freed IO, redo size calculations

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-12-08 14:16:49 +01:00
Michal Mielewczyk
244712b020 Prevent race condition in fast path
Request submitted in fast path may be freed before the sequential cutoff stats
are updated. Increment request reference counter to prevent it.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-12-08 09:00:04 +01:00
Rafal Stefanowski
b57bad4652 Fix core-zero-size error
Move error print to where it belongs, preventing this message to
pop up when same error code is reported elsewhere for other reason.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-12-06 12:30:29 +01:00
Adam Rutkowski
b1494f4642 Remove option to failover without detach
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-11-30 15:18:08 +01:00
Adam Rutkowski
b455a393dd extra assertion in metadata passive update
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-11-30 12:04:57 +01:00
Adam Rutkowski
d0b00817f3 fix cacheline reset in passive metadata update
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-11-30 19:34:52 +01:00
Krzysztof Majzerowicz-Jaszcz
133ea307c8 Fix for issues #988 and #997
This patch fixes the issue 988 (and 997) causing a kernel stack
overflow.

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2021-11-24 08:15:07 +01:00
Michal Mielewczyk
4ab22ee2dc Maintain runtime struct during failover standby
To allow the fastest switching from the passive-standby to active mode, the
runtime metadata must be kept 100% synced with the metadata on the drive and in
the RAM thus recovery is required after each collision section update.

To avoid long-lasting recovering of all the cachelines each time the collision
section is being updated, the passive update procedure recovers only those
which have its MD entries on the updated pages.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:58:09 +01:00
Michal Mielewczyk
a6989d1881 Pio concurrency 2021-11-19 11:58:09 +01:00
Michal Mielewczyk
52824adaaf Additional cleaning policy info outside of the SB
Starting cache in a standby mode requires access to a valid cleaning policy
type. If the policy is stored only in the superblock, it may be overridden by
one of the metadata passive updates.

To prevent losing the information it should be stored in cache's runtime
metadata.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
0e529479d6 Init cleaner during passive start
Initializing cleaning policy is very time consuming. To reduce the time required
for activating cache instance the initialization sholud be done during passitve
start

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
390e80794d Refactor cleaning policy initialization
Extract cleaning policy initialization to a separate function

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
6d4e6af5b6 Recovery on passive start
Adjust recovery procedure to allow rebuilding metadata from partialy valid
metadata

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
11dacd6a84 Set dirty shutdown status on standby init
Since part of the recovery is done during `standby init`, the correct shutdown
status has to be set

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
8f58add152 Lru populate unsafe
The unsafe mode is useful if the metadata of added cores is incomplete.

Such scenario is possible when starting cache to standby mode from partially
vaild metadata.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
4deaa1e133 Reset all the status bits during recovery
Make sure all the invalid cachelines have reset status bits. This allows to
recognize invalid cachelines easily during populate.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
fc7c901c8b Skip collision init on cache start passive
Recovery during passive start is based on the assuption that metadata collision
section stored on disk might be partially valid. Reseting this data would make
rebuilding metadata impossible.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
048bbedd71 Fix metadata_clear_valid_if_clean()
The function should return the cacheline's valid status

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
bb0ff67fe9 Metadata clear_dirty_if_invalid() utility
Fix cacheline's metadata if it is dirty and invalid

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
800190153b Extend lru list API
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
5ca1404f06 Fix spelling in the error message
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
ccd0abfea5 Add cache line recovery utils to OCF internal API
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Michal Mielewczyk
a7bdaa751d Add error messages on superblock mismatch
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Rafal Stefanowski
0b39711b8b Add promote-on-threshold sequential cutoff switch
Decide whether to promote sequential cutoff stream
to global structures when threshold is reached

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-11-09 12:54:15 +01:00
Robert Baldyga
55eda53cde
Merge pull request #582 from jfckm/fix-detach-volume
Deinit cache volume on detach
2021-11-09 13:16:08 +01:00
Jan Musial
55eae1447d Deinit cache volume on detach
Signed-off-by: Jan Musial <jan.musial@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-11-08 18:25:30 +01:00
Robert Baldyga
5cbbfdd5ca
Merge pull request #587 from Open-CAS/gcc_11_fix
Fix for OCL issue #968 -  GCC 11 compilation error
2021-11-08 13:34:52 +01:00
Krzysztof Majzerowicz-Jaszcz
99c54be592 Fix for OCL issue #968 - GCC 11 compilation error
GCC 11 static check finds an array size mismatch and prevents OCF from
compiling correctly. This fixes OpenCAS Linux issue #968

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2021-11-08 11:39:17 +01:00
Adam Rutkowski
8f080295bb
Merge pull request #585 from rafalste/license_change
Aplying BSD 3-Clause license to OCF source
2021-10-29 13:16:00 +02:00
Rafal Stefanowski
f22da1cde7 Fix license
Change license to BSD-3-Clause

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-10-28 13:08:50 +02:00
Rafal Stefanowski
3cc0d07197 License change to be approved by contributors
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-10-27 12:48:20 +02:00
Adam Rutkowski
12c8b4e333
Merge pull request #574 from Open-CAS/passive_api
Disable selected management operations in failover standby mode
2021-10-25 10:11:26 +02:00
Krzysztof Majzerowicz-Jaszcz
71262d5097 Cache standby mode API changes
Error for an invalid cache operation while in passive mode added

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>

Error name correction

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>

API changes for passive cache mode

Moved the passive cache error return source to the api for flush and
set_param

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>

Further API changes for passive cache mode

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>

 Passive api - review changes

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2021-10-22 15:10:53 +02:00
Adam Rutkowski
f9fb80b887 Fix conditional valid bit reset
Status bits outside provided mask shall be unchanged.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-10-12 22:56:45 +02:00
Adam Rutkowski
e2c6a25ee9 [REVERTME] Disable option to perform activate without detach
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-10-08 14:52:32 +02:00
Adam Rutkowski
5ad4d937f6 Failover detach
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-10-08 14:52:24 +02:00
Adam Rutkowski
48bc6c2f6b Always use async queue kick in management pipeline
Management pipelines tend to consist of multiple asynchronous steps.
Allowing synchronous queue kick results in massive call stacks (e.g.
almost 500 functions deep in case of cache stop). Since async kick
is required anyway, it seems reasonable to switch to async kick
in pipeline implementation.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-09-17 12:39:09 +02:00
Jan Musial
010f30eeaf Validate activate parameters
Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-09-14 08:56:41 +02:00
Jan Musial
b9c84e331c Fix attach with no cache_line_size specified
Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-09-13 12:52:33 +02:00
Robert Baldyga
076b5995ed Fix metadata_clear_valid_if_clean()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-10 08:12:11 +02:00
Robert Baldyga
7587bec07c
Merge pull request #567 from robertbaldyga/optimize-out-recovery-sector-loop
Optimize out looping over cache line sectors in recovery
2021-09-08 13:57:32 +02:00
Michal Mielewczyk
612f68b3c1 Fix metadata io detection in passive mode
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-09-08 13:33:04 +02:00
Robert Baldyga
1a3843ba12 Little coding style fix
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-07 22:54:10 +02:00
Robert Baldyga
1892f58aba Optimize out looping over cache line sectors in recovery
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-07 22:54:10 +02:00
Robert Baldyga
65d3e7a41a Introduce ocf_metadata_clear_valid_if_clean()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-07 22:54:10 +02:00
Robert Baldyga
d7c1404f82 Simplify metadata bit function declarations
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-07 22:54:10 +02:00
Robert Baldyga
12a82d7fb1 Get rid of struct ocf_cache_line_settings
Remove struct that contains redundant data.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-07 14:53:46 +02:00
Robert Baldyga
7b38ad205c Add cache activation from passive state
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 20:44:40 +02:00
Robert Baldyga
cc22c57cb7 Set proper cache pointer in front volumes
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
f96451a698 Introduce ocf_cache_is_passive()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
c662649f31 Increment metadata refcount on cache front volume io
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
d5bd3fbd78 Free zeroed metadata pages on update in raw_dynamic
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
e23342cb0e Update metadata in passive mode
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
9b3a0c968e Introduce ocf_metadata_passive_update()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
1fd9a448d4 Introduce passive cache state
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
ee42d9aaaf Duplicate cache name in struct ocf_cache
Cache name is needed for logging in passive mode, when config metadata
is still not accessible.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
85e8b414c4 Add ocf_metadata_load_unsafe()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
ad52a7e2e1 Introduce cache front volume
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
fa8e7564f0 Move ocf_io_get_internal() to private header
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
e31e7283d9 Rework volume type management
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
a2bef43975 Add missing lock in ocf_ctx_get_volume_type_id()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
a00ec916e2 Make post metadata load init a separate step in pipeline
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
c6c6618ad8 Move recovery code from metadata to cache mngt
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
a2db4d14e8 Move core initialization code from metadata to mngt
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
24728330fc Make _ocf_mngt_load_add_cores a separate step in pipeline
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
20228561c9 Move metadata deinit to separate pipeline step
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
1f6b83f87d Decouple cache attached state from metadata refcount state
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
9ab4c51dfa Expose superblock operations as part of internal metadata API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
ab034ab53d Fix uuid comparison in core pool
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
82abcd11e7 Fix documentation of ocf_metadata_raw_rd_access()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-02 22:38:37 +02:00
Robert Baldyga
387cf1b9a5 Fix debug tracing in metadata
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-02 22:38:37 +02:00
Robert Baldyga
c1e9c1fa96 Remove trace API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-08-09 10:00:01 +02:00
Michal Mielewczyk
b83da68f85 Cleaner context ref counter
To prevent deinitializing cleaner context (i.e. during switching policy) during
processing requests, access to cleaner should be protected with reference
counter

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-27 15:44:33 +02:00
Michal Mielewczyk
f33a6e5ce0 Make switching cleaning policy asynchronous
Making the operation asynchronous will allow to use refcnt utility as an
synchronization mechanism between processing cachelines and deinitializing
cleaning policy.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-27 15:44:18 +02:00
Michal Mielewczyk
26194fc536 Use cleaning ops wrapper functions
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-27 15:44:18 +02:00
Michal Mielewczyk
00aa56dd28 Wrapper functions for cleaning ops
The change should unify access to cleaning policy resources and facilitate
synchronization when switching cleaning policies

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-27 15:44:18 +02:00
Michal Mielewczyk
6dc29ee85e Refactor includes
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-27 15:44:18 +02:00
Michal Mielewczyk
c6fe2fc3f9 Deinit sequential cutoff on core removal
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-26 16:20:17 +02:00
Kozlowski Mateusz
bd7a89c819 Single map alloc location
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-07-21 08:27:27 +02:00
Kozlowski Mateusz
af1f3d73c2 Add back fastpath
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-07-21 08:27:25 +02:00
Kozlowski Mateusz
ec4bea4fc0 Add missing ocf_io_put to error path in ocf_core_volume_submit_io
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-07-21 08:26:31 +02:00
Robert Baldyga
a2b300d465 Avoid stack overflow when pending read misses list is blocked
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-14 13:04:03 +02:00
Robert Baldyga
740bf06c4b
Merge pull request #538 from robertbaldyga/fix-next-inval-getter
Fix helper function getting next invalid cache line
2021-07-14 10:17:39 +02:00
Robert Baldyga
be1ac09c17 Fix helper function getting next invalid cache line
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-13 18:56:52 +02:00
Kozlowski Mateusz
8c3ed42fa2 Fix remap line count for user partitions
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-07-12 16:49:14 +02:00
Robert Baldyga
f538bbd3ae Fix argument order in ocf_metadata_set_partition_id() call
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-09 21:31:06 +02:00
Robert Baldyga
d79c4b7dc9
Merge pull request #535 from mmkayPL/struct-alignment
Align structures to cacheline
2021-07-08 13:26:57 +02:00
Kozlowski Mateusz
f494448f97 Align structures to cacheline
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-07-08 12:46:39 +02:00
Michal Mielewczyk
a394dd06a8 Unlock cachelines after failed remap
All remapped cachelines are write locked. If the operation fails cachelines has
to be unlocked during rollback

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-06 15:09:50 +02:00
Adam Rutkowski
96dfd87572 restore conditional reschedule during freelist population
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-07-02 11:37:49 +02:00
Robert Baldyga
aa3677da10
Merge pull request #530 from arutk/remove_eviction
Remove remaining stale references to "eviction" and "evp"
2021-06-30 09:47:35 +02:00
Robert Baldyga
43a142ccdd
Merge pull request #531 from arutk/fix_remove_dirty
fix removing dirty core
2021-06-29 09:36:45 +02:00
Adam Rutkowski
a1ec40ce10 Fix ocf_lru_repart for freelist partition
ocf_lru_get_list() now returs clean list for freelist partition to
provide common interface regardless of partition type.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-28 17:39:31 +02:00
Adam Rutkowski
a7581b892c Rename evp_iter to lru_iter in concurrency
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-26 19:09:10 +02:00
Adam Rutkowski
d029b2a2be Remove unused pending_eviction_clines counter
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-26 19:09:10 +02:00
Adam Rutkowski
a9ab5fbafd Fix comments in ocf_engine_common.h
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-26 19:09:09 +02:00
Adam Rutkowski
1a5d20156e Renamve eviction_idx to lru_idx
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-26 19:09:08 +02:00
Adam Rutkowski
fc06ef92a0 Remove obsolete wrapper for lru_rm_cline
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-26 19:09:04 +02:00
Robert Baldyga
059b845df8 Unlock request after invalidating cache lines
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-25 17:50:38 +02:00
Michal Mielewczyk
f0564dcf75 Avoid unnecessary metadata flushes in WT
Flushing metadata in WT is required only if at least of the request's cacheline
changed its state to clean.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-06-23 09:51:16 +02:00
Michal Mielewczyk
c9294d1f06 Reorder metadata updating pattern in WT mode
There's a possibility that WT write is performed to dirty cache line (i.e. after
switching WB->WT without flush) and status bits change from dirty to clean. If
power failure occurs it might happen that recovery would ignore recent data from
cache and would assume that data is clean while backend storage data is out of
date.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-06-22 15:35:50 +02:00
Michal Mielewczyk
0192ce23dd Reorder metadata updating patter in WB mode
In WB mode metadata should be updated only if the actuall data had been saved
on disk. Otherwise metadata might be flushed too early and consequently data
corruption might occur.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-06-22 09:04:56 +02:00
Robert Baldyga
847f5f1174
Merge pull request #520 from arutk/lru_refactor
LRU refactoring
2021-06-21 22:49:08 +02:00
Adam Rutkowski
1e1955b833 lru refactor
rearanging lru implementation for easier journaling

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-21 22:32:57 +02:00
Adam Rutkowski
edf20c133e Move metadata I/O lock to IO queue context
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-21 21:39:35 +02:00
Adam Rutkowski
a70608476d fastpath for metadata update
Removing extra request cycle through IO queue in case of successfull
metadata I/O lock.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-21 20:02:56 +02:00
Kozlowski Mateusz
50ec65fcfd Fix metadata_io_page_lock_acquired typo
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-06-21 19:46:35 +02:00
Kozlowski Mateusz
1031139446 OCF: Fix error path for metadata updater
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-06-21 19:46:34 +02:00
Adam Rutkowski
bae59e0620 Fix include paths in ocf_lru.c and ocf_space.c
This fixes compilation with CAS Linux

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-21 17:12:10 +02:00
Adam Rutkowski
36107fd528 Initialize partitions during cache start
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
dca93964e3 remove stale declaration of space_management_free()
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
07cbba32f6 remove stale references to eviction
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
33e2beac24 Rename "evp_lru*" functions to "ocf_lru*"
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
b1143374a8 Move eviction files to new locations
src/eviction/lru.c -> src/ocf_lru.c
src/eviction/lru.h -> src/ocf_lru.h
src/eviction/lru_structs.h -> src/ocf_lru_structs.h
src/eviction/eviction.c -> src/ocf_space.c
src/eviction/eviction.h -> src/ocf_space.h

.. as well as corresponding UT files.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>

... in UT as well

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
7c0f940876 Replace eviction with lru in metadata structs
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
88e04a4204 Remove eviction policy abstraction
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
31737ee0e7 Move all eviction locks to lru.c
this is preparation for removal of evp abstraction

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
77bccba036 do not track hotness on free lru list
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
fac35d34a2 Rename "evict" to "remap" across the entire repo
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
4f217b91a5 Remove partition list
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
87f834c793 Move common user and freelist partition data to a new struct
New structure ocf_part is added to contain all the data common for both
user partitions and freelist partition: part_runtime and part_id.
ocf_user_part now contains ocf_part structure as well as pointer to
cleaning partition runtime metadata (moved out from part_runtime) and
user partition config (no change here).

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:07:10 +02:00
Robert Baldyga
c0b76f9e01
Merge pull request #517 from arutk/hit_shortcut
Check for hit after upgrading hash bucket lock
2021-06-17 12:16:18 +02:00
Robert Baldyga
73c3e97f43
Merge pull request #509 from Open-CAS/rm-metadata-updater
Remove metadata updater
2021-06-17 09:34:18 +02:00