Commit Graph

285 Commits

Author SHA1 Message Date
Jan Musial
ac00bd503a Add config for BLK_MQ_F_BLOCKING flag
Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-08-18 09:04:15 +02:00
Robert Baldyga
3983cea2b5 Fix cache_priv deallocation
Since cache_priv is allocated with vmalloc() it should be deallocated
with vfree().

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-08-16 05:16:15 +02:00
Robert Baldyga
c968285d9f Remove upgrade-in-flight feature
Due to changes in Linux kernel this feature is not working anymore.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-08-11 20:33:16 +02:00
Michal Mielewczyk
a6d3c70b1d Async API for switching cleaning policy
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-27 16:15:09 +02:00
Robert Baldyga
2e4c460702 Use cache line size as discard granularity
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-15 22:47:08 +02:00
Robert Baldyga
2a35bd09be Introduce lazy helper thread abstraction to avoid hung task
Some helper threads are created at the very beginning of cache start/stop
operations, but they are used only after OCF start/stop finishes, which
may take significant amount of time. Kernel by default creates threads
that wait for the first wake up in uninterruptible state, which may trigger
hung task warning if the first wake up is called more than 120 seconds
after thread creation. To mitigate this problem we create lazy thread
abstraction that waits for a wake up in interruptible state.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-13 10:07:25 +02:00
Robert Baldyga
517d98a6ed Split big IO requests
OCF cannot allocate request map bigger than 4MiB (due to kmalloc
limitations), thus we need to split bigger IOs into series smaller
ones to reduce request map size.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-07 18:52:22 +02:00
Robert Baldyga
34dbbc056d Fix exported object deinitialization
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-24 14:24:04 +02:00
Kozlowski Mateusz
62f4c61f8e Update mpool API for vol_atomic_dev_bottom
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-06-23 14:57:21 +02:00
Adam Rutkowski
7aa883dbd3 OCF update (removed configurable eviction policy)
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-21 22:56:51 +02:00
Kozlowski Mateusz
647124895f Update OCF
Remove metadata updater
Update mpool API

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-06-21 21:57:10 +02:00
Robert Baldyga
e5e0697da4 Add support for kernel 5.11
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
2d7b94fa21 Remove block_dev_start_bio()
Now submit_bio path has no fallback to request queue, so we can simplify
io accounting.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
62eb6dc3fd Remove unused functions from top volume
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
5e17d0833f Remove unused callbacks from cas_disk ops
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
7f89e59b1a Remove CAS_FLUSH_SUPPORTED
It's defined on every single supported kernel, so there is actually no need
for this define at all.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
b82b338c53 Remove blk request handling path
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 18:59:08 +02:00
Robert Baldyga
7343cb55fa Handle all io on bio handler
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-06-15 16:52:35 +02:00
Robert Baldyga
fbc3906576 Replace removed kernel API function with new one
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-05-26 23:35:30 +02:00
Slawomir Jankowski
964877ddd6 Typo fix
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-05-13 17:02:05 +02:00
Slawomir Jankowski
9e7f163216 Cleanup exported object queue
This patch fixes adding core after core addition failure.
The queue wasn't cleaned before and following core addition cannot
re-initialize queue properly.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-05-13 17:01:41 +02:00
Robert Baldyga
a226b39c4e
Merge pull request #811 from mmichal10/fix-discard
Fix max discard size
2021-05-10 15:36:37 +02:00
Michal Mielewczyk
0387ba18d7 Fix max discard size
`blk_queue_max_discard_sectors()` accepts 32bit parameter

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-05-07 11:14:46 +02:00
Michal Mielewczyk
0e8758528b Return mempool instead of enum
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-04-22 14:17:39 +02:00
Adam Rutkowski
9c08ed4b87 Set proper multiqueue flags
Setting BLK_MQ_F_STACKING (to indicate stacked device) and
BLK_MQ_F_BLOCKING (to indicate potentially blocking operations
like acquiring mutex or GFP_NOIO allocations).

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-04-16 22:52:18 -05:00
Robert Baldyga
c46c638e2e
Merge pull request #802 from arutk/stop_error_handling
Properly handle flush error in cache stop
2021-04-15 18:11:47 +02:00
Adam Rutkowski
da0dda2dbd Properly handle flush error in cache stop
In case of initial flush error stop is aborted. In case
of failure during the second flush, appropriate error
message is presetned to the user.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-04-15 18:11:23 -05:00
Michal Mielewczyk
4e680bb50a Reorganize remove-inacitve command
Don't remove inactive core if it has dirt cache lines assigned unless `force`
flag is specified.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-04-12 13:48:28 +02:00
Michal Mielewczyk
083d6fe93e Clean-up 'remove-core' command
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-04-09 19:57:07 +02:00
Kozlowski Mateusz
a45f0c854f Fix _blockdev_set_bio_data iteration
The data->size field can be initialized to a lower value than bio->bi_vcnt,
if the bio is split. The bio_for_each_segment then iterates based on the original
indexes and the mismatch eventually causes a BUG_ON.

Fixes #714

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-04-08 12:28:35 +02:00
Adam Rutkowski
048f25379b Check dirty status in case of metadata mismatch
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-04-06 15:37:44 -05:00
Kozlowski Mateusz
ab0a7e0a44 Add detection of ktime_get_real_ts64 vs getnstimeofday
Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-03-26 13:46:09 +01:00
Slawomir Jankowski
eef4e49904 Use time since epoch instead of jiffies
If time is counted in jiffies, machine reboot brokes `dirty for`
statistic for caches loaded at boot. The counter overflows and
`dirty for` shows some huge values.
Cast ticks to unsigned long.
Add necessary header.
Move `env_msleep` to `TIME` subgroup of header.
Move `env_time_after` below time converting functions.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-26 13:46:09 +01:00
Kozlowski Mateusz
74ca3daa37 Classifier alignment
Move lock to a different cacheline to avoid trashing

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-03-22 08:26:55 +01:00
Kozlowski Mateusz
da9a6204d3 General structure packing
Pack often used structures, so that less memory/cachelines are used

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-03-22 08:26:55 +01:00
Kozlowski Mateusz
c751974ae0 Allocator structures cacheline alignment
Align atomic fields to a different cacheline, so no false sharing between
CPUs occur.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
2021-03-22 08:26:55 +01:00
Robert Baldyga
880cfadde9 Makefile: improve uninstall error handling
Introduce helper functions to handle uninstall errors gracefully.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-03-19 15:37:55 +01:00
Michal Mielewczyk
f1c34340e0 Change REMOVE_INACTIVE ioctl type
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-03-12 09:21:49 +01:00
Michal Mielewczyk
12db6b4443 Remove redundant cache being stopped check
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-03-12 09:20:19 +01:00
Slawomir Jankowski
461a4f2d96 Introduce "remove inactive core" to cas_cache module
Create module-side handling of inactive core removal.
Extract core functionality of core removal that applies to inactive core
and copy it to `cache_mngt_remove_inactive_core` function.
Return proper error if core is active.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-10 14:39:07 +01:00
Slawomir Jankowski
696a2e175c Add KCAS_IOCTL_REMOVE_INACTIVE request to cas_cache module
Add IOCTL code and struct for above request.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-10 14:39:07 +01:00
Slawomir Jankowski
760b60628c Add KCAS_ERR_CORE_IN_ACTIVE_STATE error code.
New error code will allow to properly handle issues caused by wrong
usage of `remove inactive core` command.
It will also allow to print meaningful error messages.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-10 14:39:07 +01:00
Slawomir Jankowski
2bf6e42dea Print separate messages for different "remove core" return codes
Change extended error message for `KCAS_ERR_REMOVED_DIRTY`.
Print informative messages when `remove core` command fails.
Make separate error messages for detaching.
Update help printouts.
Update documentation comments.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-10 14:26:09 +01:00
Slawomir Jankowski
f955ce890c Remove inactive core handling from "remove core"
FLush only active core during core removal.
During core removal with `casadm -R` there's a flush triggered.
This flush shall be skipped for inactive cores.
Change return code when `casadm -R` is called with `force` flag.
There was no info about dirty data when core was removed without flush.
Do not destroy exported object while core is inactive.
Perform detach only on active cores.
Skip removing inactive core with command for active cores.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-03-10 14:26:09 +01:00
Michal Mielewczyk
35602acb8f Prohibit locking cache while its is being stopped
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-03-09 10:46:47 +01:00
Robert Baldyga
e6710e0016 cas_cache: Add promotion count parameter
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-03-07 20:36:57 +01:00
Robert Baldyga
9bc827a4f2
Merge pull request #721 from mmichal10/update-ocf
Update ocf
2021-03-07 20:34:55 +01:00
Michal Mielewczyk
099eeca864 Ioclass min_size removed from public ocf api
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-03-05 16:09:37 +01:00
Jan Musial
f1a19363e5 Include mpool in env and use new allocator API
Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-03-05 14:02:08 +01:00
Jan Musial
bcc55f4f3c Extend allocator API
Create function for directly changing the size of rpool backing created
allocator.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-03-03 11:17:22 +01:00