Commit Graph

65 Commits

Author SHA1 Message Date
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
Robert Baldyga
a1af1809d8 Fix error accounting in forward_io
Resetting cache_error/core_error in ocf_req_forward_* functions may lead
to overwriting already reported error if the forward is being done in the
loop.

To avoid this potential problem, introduce set of forward init functions
intended to be called before the entire forward operation, which resets
the error code and sets a forward callback.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-10-14 16:54:51 +02:00
Michal Mielewczyk
e42df078c3 Add missing 'static' identifier
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-27 11:25:21 +02:00
Robert Baldyga
3fbb75756e Consolidate ocf_request_io and ocf_request - io properties
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
322ae2687d Replace submit with forward in cleaner
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
Amir Haroush
7930ef9c21 cleaner: skip metadata flush in volatile mode
Signed-off-by: Amir Haroush <amir.haroush@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-09-10 12:32:25 +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
Michal Mielewczyk
d883a40dbc cleaner: refactor completion function
The completion function should be the same either when it is called from
the queue context or from currnet context

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-27 15:20:02 +02:00
Michal Mielewczyk
736665af47 cleaner: Fix master request refcnt
Commit db6b009ef introduced changes in managing the master request life cycle,
but apparently not all paths have been updated. This change removes a redundant
ocf_req_get() before sending the requets into a queue

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-27 07:44:09 +02:00
Michal Mielewczyk
312b32ad61 cleaner: Fix tracking in-flight cache requests
When flushing a request, the number of cache reads is unknown until all cache
lines are locked and the IOs are actually submitted.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
2024-08-19 22:10:45 +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
218e9c5723 Revert "cleaner: Remove complete_queue"
This functionality is used by cleaning policies via cmpl_queue
to reschedule the completion, so that we avoid unlocking mutex in
the cleaner completion from interrupt context of IO completion.

This reverts commit 1e5eda68a7.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-26 10:35:23 +02:00
Robert Baldyga
1e5eda68a7 cleaner: Remove complete_queue
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-12 17:38:17 +02:00
Robert Baldyga
db6b009ef5 cleaner: Simplify master request life cycle management
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-12 17:38:17 +02:00
Robert Baldyga
3300dbd4e7 cleaner: Rework request allocation
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-12 17:38:17 +02:00
Robert Baldyga
3248c85828 cleaner: Skip cleaner iteration if the map is empty
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-12 17:38:17 +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
Robert Baldyga
0a13bea889 cleaner: Skip filling the tail of the request map
Simply update req->core_line_count instead.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-12 13:23:35 +02:00
Robert Baldyga
2b94a3ab31 cleaner: Move sort functionality to flush_data abstraction
The flush_data is used by ocf_cleaner_do_flush_data_async(), which means
that callers of ocf_cleaner_fire() are now expected to guarantee that
entries are returned by getter in a sorted order. Currently the only case
when ocf_cleaner_fire() is called directly is for request cleaning, and
the request map is sorted by definition.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-07-12 13:23:35 +02:00
Robert Baldyga
5710ca8b4a Fix compilation
Signed-off-by: Robert Baldyga <robert.baldyga@open-cas.com>
2024-04-01 18:27:25 +00:00
Robert Baldyga
2398412622 cleaner: Unlock cache mngt lock from queue context
Cache mngt lock cannot be unlocked from io completion context (which is
potentially atomic context) as it may involve sleeping operations.
Modify cleaner utility to support rescheduling to queue context before
calling the completion. Update cleaning policies to use that option.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
2024-03-21 15:25:18 +01:00
Robert Baldyga
228c5fc891 Get rid of req->io_if
Remove one callback indirection level. I/O never changes it's direction
so there is no point in storing both read and write callbacks for each
request.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-09-07 23:07:04 +02: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
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
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
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
49b9b36d13 cleaner: Don't check for valid if cache line is not dirty
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-04-01 13:28:19 +02:00
Adam Rutkowski
81fc7ab5c5 Parallel eviction
Eviction changes allowing to evict (remap) cachelines while
holding hash bucket write lock instead of global metadata
write lock.

As eviction (replacement) is now tightly coupled with request,
each request uses eviction size equal to number of its
unmapped cachelines.

Evicting without global metadata write lock is possible
thanks to the fact that remaping is always performed
while exclusively holding cacheline (read or write) lock.
So for a cacheline on LRU list we acquire cacheline lock,
safely resolve hash and consequently write-lock hash bucket.
Since cacheline lock is acquired under hash bucket (everywhere
except for new eviction implementation), we are certain that
noone acquires cacheline lock behind our back. Concurrent
eviction threads are eliminated by holding eviction list
lock for the duration of critial locking operations.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-03-05 11:20:47 +01:00
Adam Rutkowski
1411314678 Add getter function for cache->device->concurrency.cache_line
The purpose of this change is to facilitate unit testing.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-03-05 11:20:47 +01:00
Adam Rutkowski
056217d103 Rename cleaner attribute cache_line_lock to lock_cacheline
.. to make it clean that true means cleaner must lock
cachelines rather than the lock is already being held.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-03-05 11:20:46 +01:00
Adam Rutkowski
c40e36456b Add missing hash bucket lock in cleaner
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-03-05 11:20:46 +01:00
Adam Rutkowski
69c0f20b6e Remove global metadata lock from cleaner metadata update step
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-03-05 11:20:46 +01:00
Adam Rutkowski
cf5f82b253 Use cline concurrency ctx instead of cache
Cacheline concurrency functions have their interface changed
so that the cacheline concurrency private context is
explicitly on the parameter list, rather than being taken
from cache->device->concurrency.cache_line.

Cache pointer is no longer provided as a parameter to these
functions. Cacheline concurrency context now has a pointer
to cache structure (for logging purposes only).

The purpose of this change is to facilitate unit testing.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-02-24 17:29:39 -06:00
Rafal Stefanowski
6ed4cf8a24 Update copyright statements (2021)
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-01-21 13:17:34 +01:00
Adam Rutkowski
012438c279 Add missing collision page lock in cleaner
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-01-20 19:28:41 -06:00
Adam Rutkowski
44efe3e49e Refactor LRU code to use part rather than part_id
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-12-17 14:35:27 +01:00
Rafal Stefanowski
38e7e19290 Update copyright statements
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-04-28 13:37:54 +02:00
Robert Baldyga
e06832426d cleaner: Retrieve core object properly
Cleaner doesn't set core object in req as it works in domain of cache
lines, which may belong to various cores. It this case should retrieve
core object not from the req, but from the map instead.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-12-19 14:44:04 +01:00
Adam Rutkowski
d2bd807e49 Remove calls to OCF_METADATA_(UN)LOCK_WR(RD)
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-20 17:21:00 -04:00
Adam Rutkowski
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
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
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
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
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
Kamil Łepek
05be67a72b
Merge pull request #220 from arutk/metadata_offset_hash
New hash function formula
2019-07-29 13:03:04 +02: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
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