Commit Graph

253 Commits

Author SHA1 Message Date
Michal Mielewczyk
e8e7a1600c Log errors on cache init
The more (logging) the merrier

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-10-10 07:32:38 +02:00
Michal Mielewczyk
f6bdd354d0 Don't bug on cache init
Even if locking the new cache should never fail it's not an unrecoverable
state.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-10-08 11:14:20 +02:00
Michal Mielewczyk
0bb2621c50 Increment ctx.refcnt before creating a new cache
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-10-08 11:14:20 +02:00
Rafal Stefanowski
97ee3af8f7 Use management queue for parallelized management operations
When IO queues are used for parallelized management operations,
e.g. changing cleaning policy, a deadlock may occur due to global
metadata lock interfering with taking request from IO queue,
as they might be run on the same thread. As a workaround using
a management queue specifically for such operations eliminates
this problem.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@huawei.com>
2024-09-23 14:05:33 +02:00
Robert Baldyga
834786866c Replace submit with forward in mngt
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-20 13:59:46 +02:00
Robert Baldyga
dc58eeae9b Introduce d2c request
This avoids unnecessary map allocation and initialization of unused fields of
request structure. It also allows to track thier number separately from
the regular requests

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-09 12:45:51 +02:00
Robert Baldyga
3ebf6e64c1
Merge pull request #808 from mmichal10/vol_and_req_fixes
Volume improvements
2024-09-06 14:24:48 +02:00
Amir Haroush
ed62866324 Modify ocf_mngt_get_ram_needed to never fail
Signed-off-by: Amir Haroush <amir.haroush@huawei.com>
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-09-05 15:41:54 +02:00
Robert Baldyga
87b16aef6a Do not deinit user volume
The user is supposed to deinit/destroy it.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-03 16:10:56 +02:00
Robert Baldyga
3d99a2c938 Add missing ocf_volume_init() calls
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-03 16:10:56 +02:00
Robert Baldyga
8aa2d0fb63 Remove unused attach context property
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-03 16:10:56 +02:00
Robert Baldyga
b00ab08473 Introduce io_queues_lock
The queues can be created and destroyed dynamically at any point in
the cache lifetime, and this can happen from different execution contexts,
thus there is a need to protect the queue_list with a lock.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-29 10:45:36 +02:00
Robert Baldyga
8db93260ae Avoid adding mngt_queue to io_queues list
Previously every created queue was added to io_queues list, which
made mngt_queue being used in ocf_parallelize. Change mngt_queue creation
API so that mngt_queue is not added to the list and doesn't have
unnecessary functionalities initialized.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-29 10:45:26 +02:00
Michal Mielewczyk
0a9a173f33 Add missing flush_mutext destroy
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-29 10:15:08 +02:00
Michal Mielewczyk
2221a7bdf8 Add missing cache lock deinit
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-29 09:52:05 +02:00
Michal Mielewczyk
28f679cc91 Add missing cache unlock
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-29 09:52:05 +02:00
Robert Baldyga
40ff7d2dcf
Merge pull request #799 from Open-CAS/cache_detach
Implement cache detach/attach
2024-07-31 06:54:08 +02:00
Robert Baldyga
43cc487c40 lru: Move partition runtime structures outside of metadata
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-12 13:23:29 +02:00
Michal Mielewczyk
83ec255458 Disable changing cache params for detached cache
Majority of management operations should be blocked for detached cache,
although adding and removing cores should be possible.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:19:37 +02:00
Michal Mielewczyk
de07458ff2 Common context for cache stop and cache detach
Stop and cache detach were already sharing contexts implicitly, which allowed
to reuse some functions in both pipelines. However, changing the context structs
could lead to not obvious bugs.

To prevent such errors both methods now share context structure explicitly

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:18:33 +02:00
Michal Mielewczyk
09335cd6f2 Update cache's state after detach
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:18:28 +02:00
Michal Mielewczyk
695d77e3b5 Apply cache state API
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:18:23 +02:00
Michal Mielewczyk
2f0b86f5ca Extend cache state API
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:18:17 +02:00
Michal Mielewczyk
047e07c062 Rename cache "initializing" state to "detached"
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:18:04 +02:00
Michal Mielewczyk
d3c11a983b Update cache state when stopping uninited instance
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:16:31 +02:00
Michal Mielewczyk
3f41a35f30 Patch detached cache API
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:14:33 +02:00
Michal Mielewczyk
41224c61c0 Track max number of cores for atomic volume
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 16:13:15 +02:00
Michal Mielewczyk
2a97de8792 Detach finish: destroy stop pipeline before cmpl
'stop_pipeline' filed may be reused during cache lifetime (e.g. when cache is
detached and attached again - the pipeline would be freed and then
re-allocated). Calling completion after detach before freeing the pipeline may
lead to race condition.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-07-10 11:35:42 +02:00
Robert Baldyga
d7fe7c05f1 Add missing ocf_cache_mode_t to ocf_req_cache_mode_t conversions
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-05 16:59:05 +02:00
Robert Baldyga
168ecd0075 Add missing "static" to the local function
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-05-11 00:59:39 +02:00
Amir Haroush
22a697d09e Fix segfault when copy unaligned struct as aligned
Because context has one field which is aligned to 64B
(struct ocf_volume cache_volume) the compiler use vmovdqa (aligned)
instead of vmovdqu (unaligned) in reality the address is not 64 aligned,
it ends with 0x8, so we get this segfault.

Signed-off-by: Amir Haroush <amir.haroush@huawei.com>
Signed-off-by: Shai Fultheim <shai.fultheim@huawei.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2023-03-28 09:32:33 +02:00
Michal Mielewczyk
7b8093aa34 Refactor cleaning policies initialization
Don't populate cleaning policies during initialization procedure so the user
has to call the latter explicitly.

Until now cleaning policies could be populated in two ways:
- implicitly during cleaning policy initialization,
- explicitly be calling populate.
The difference was that the former was single threaded.

This patch removes the functionally redundant and less efficient code.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-09-26 14:14:40 +02:00
Michal Mielewczyk
c0e99e1f79 cleaning: rename recovery to populate
The function not only recovers cleaning policy metadata but is also utilized
to initialize data structures so more generic name is actually more accurate

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-09-26 14:14:40 +02:00
Michal Mielewczyk
b50bd1b506 Initialize metadata structures in pipelines
Initializing metadata in an asynchronous manner will allow to use
parallelization utilities in the future commits

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-09-26 14:06:40 +02:00
Michal Mielewczyk
da67112b17 load: init_structures as a separate step
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-09-26 14:06:40 +02:00
Michal Mielewczyk
f8e8d74539 attach: setup promotion policy before cleaning
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-09-26 14:06:40 +02:00
Michal Mielewczyk
ca70ea3fff Deinit cleaning policy if attaching cache failed
Normally cleaning policy would be deinitialized during stopping cache which is
one of steps of error handling e.g in case of failed cache activation. But since
`cache_stop()` may be called only for an attached cache instance, cleaning
policy needs to deinitialized explicitly.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-09-26 14:06:40 +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
b053f7925a
Merge pull request #702 from robertbaldyga/v22.6-composite-volume
Introduce composite volume
2022-06-02 13:36:21 +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
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
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
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
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
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
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
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
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