Commit Graph

393 Commits

Author SHA1 Message Date
Robert Baldyga
6bb00db1ff Deinitialize core front volume on error handling path
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2025-04-02 11:34:03 +02:00
Michal Mielewczyk
62307d82b8 Don't destroy stop pipeline if detach cache failed
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-26 11:39:05 +01:00
Michal Mielewczyk
4a2597dc25 stop: Don't deinitialize cleaning policy twice
The cleaning metadata has been deinitialized in the previous pipeline
step together with other services

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-26 08:53:30 +01:00
Michal Mielewczyk
6f7c0c6c51 Add missing d2c refcnt deinit
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-25 15:39:42 +01:00
Michal Mielewczyk
5d0608de2c Don't unfreeze refcnt in atomic context
Unfreezing a refcnt might be a sleeping operation so it can't be called
from completion context. Moving D2C refcnt unfreeze to a separate step
in pipeline ensures that it will always be called from process context

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-25 09:32:39 +01:00
Michal Mielewczyk
69987bd20c detach: Don't deinitialize cleaning policy twice
The cleaning metadata has been deinitialized in the previous pipeline step
together with other services

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-17 15:28:09 +01:00
Michal Mielewczyk
1e75a9826d stop&detach: Deinit services before removing cores
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-17 15:28:09 +01:00
Michal Mielewczyk
9c2da08ffe stop pipeline: flush_metadata as a separate step
Flushing metadata has nothing to do with dinitializing services so it
should be a separate step in the stop pipeline

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-17 15:28:07 +01:00
Michal Mielewczyk
75c4c9b473 Move _ocf_mngt_cache_deinit_services() definition
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-17 15:27:17 +01:00
Michal Mielewczyk
942825146a Simplify _ocf_mngt_cache_deinit_services()
Move flushing metadata outside cache_detinit_services(), so the function
can be shared between stop() and detach() without redundant ifs.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-17 15:27:16 +01:00
Michal Mielewczyk
eca7872299 detach: Rename update_metadata() to remove_cores()
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-17 15:19:55 +01:00
Michal Mielewczyk
03338d798c detach pipeline: remove unused completion
The completion callback is called only in the cache stop scenario, after
flushing the metadata

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-17 15:19:55 +01:00
Michal Mielewczyk
5e55bf78b4 Rename cache_unplug() to deinit_services()
The function doesn't unplug anything, it just deinitializes cleaning and
promotion.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-03-17 15:19:53 +01:00
Rafal Stefanowski
794fa125e8 Check if cache is attached before setting promotion and seqcutoff params
Fixes null pointer dereference if setting those params is attempted
on detached cache.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@huawei.com>
2025-03-11 16:47:53 +01:00
Robert Baldyga
a12496320c
Merge pull request #849 from mmichal10/refcnt-per-cpu
Refcnt per cpu
2025-02-06 17:28:07 +01:00
Roel Apfelbaum
b02481cf74 A utility to continue pipeline on zero refcnt
Signed-off-by: Roel Apfelbaum <roel.apfelbaum@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-02-06 12:04:40 +01:00
Robert Baldyga
7685b70810 Protect cache lock against locking during lock deinitialization
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2025-02-06 12:04:37 +01:00
Adam Rutkowski
53ee7c1d3a Per-cpu refcounters
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Signed-off-by: Jan Musial <jan.musial@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@huawei.com>
2025-02-06 12:04:34 +01:00
Daniel Madej
95c9c8987e Zero metadata superblock on detach
Metadata from a detached cache device is not meant to be loaded.

Signed-off-by: Daniel Madej <daniel.madej@huawei.com>
2025-02-06 09:24:40 +01:00
Daniel Madej
8ce129de06 ocf_cleaner_refcnt_unfreeze bug fix
During core remove/detach ocf_cleaner_refcnt_freeze was called only
when cache was attached, but ocf_cleaner_refcnt_unfreeze was called
regardless of cache state.

Signed-off-by: Daniel Madej <daniel.madej@huawei.com>
2025-01-15 18:51:42 +01:00
Robert Baldyga
0d06b3a597 Fix race condition during cache attach
After attaching new cache device handle all the IOs in Pass-Through mode
until all the d2c requests are completed.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-11-21 21:26:00 +01:00
Michal Mielewczyk
1b2a9e03c3 Add missing cache unlock in init rollback
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-10-10 07:32:38 +02:00
Michal Mielewczyk
c82fd173c6 Remove redundant list_del(ctx->caches) during init
New caches are added to the list at the point where they are already
initialized and no errors are possible at this point, hence list_del() in error
handling is redundant.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-10-10 07:32:38 +02:00
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
Michal Mielewczyk
fae30462b1 Decrement cache.refcnt if locking cache failed
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
8b93b699c3 Eliminate queue -> cache mapping
Eliminate need to resolve cache based on the queue. This allows to share
the queue between cache instances. The queue still holds pointer to
a cache that owns the queue, but no management or io path relies on the
queue -> cache mapping.

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
460cd461d3 Allocate requests for management path separately
Management path does not benefit much from mpools, as number of requests
allocated is very small. It's less restrictive (mngt_queue does not have
single-CPU affinity) thus avoiding mpool usage in management path allows
to introduce additional restrictions on mpool, leading to I/O performance
improvement.

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
Gershon Geva
2096e34489 Pass user's params when opening a core volume
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-04 20:29:41 +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
Michal Mielewczyk
a542cfa690 Refactor cache_trylock()
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-29 09:52:05 +02:00
Michal Mielewczyk
1c7de189e2 Get rid of non-OCF error codes
Let's put an end to random crashes and vague error messages in pyocf!

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-29 08:27:51 +02:00
Robert Baldyga
5b2f26decf
Merge pull request #800 from robertbaldyga/redesign-queue-api
Redesign queue API
2024-08-02 14:43:52 +02:00
Ian Levine
ac1b6b774a Added a priority queue for the request instead of push front
Now the request can be pushed to a high priority queue (instead of ocf_queue_push_req_front)
and to a low priority queue (instead of ocf_queue_push_req_back).
Both functions were merged into one function (ocf_queue_push_req) and instead of the
allow_sync parameter there is now a flags parameter that can be an OR combination of
OCF_QUEUE_ALLOW_SYNC and OCF_QUEUE_PRIO_HIGH

Signed-off-by: Ian Levine <ian.levine@huawei.com>
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-08-02 12:53:16 +02:00
Ian Levine
038126e9ab Move and rename ocf_engine_push_req_* from engine_common to ocf_queue_push_req_* in ocf_queue
Signed-off-by: Ian Levine <ian.levine@huawei.com>
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-08-02 12:53:16 +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
dfb2e1a8d5 cleaner: Check mapping after taking cache line lock
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-12 17:38:13 +02:00