Commit Graph

451 Commits

Author SHA1 Message Date
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
Adam Rutkowski
68b68db9c0 Zero metadata if on-disk version differs from current
Kernel adapter now returns is_cache_device=1 and newly added
metadata_compatible=0 in case of metadata detected with
differing version (instead of is_cache_device = 0).

This allows zero-superblock command to recognize old
cache instance and clear it.

casadm --script --check-cache-device still returns 'Is cache'='no'
in this case, as this layer only cares about metadata in current
version to be able to detect dirty datas tatus.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-01-21 14:47:54 -06:00
Rafal Stefanowski
43f43068ad Update copyright statements (2021)
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-01-21 13:15:38 +01:00
Michal Mielewczyk
4d61ded26d Fix use after free bug
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-01-20 02:28:19 -05:00
Slawomir Jankowski
a057a0082f Handle cache stopping interruption
Ignore the interruption of the stop operation - will finish asynchronously.
Remove redundant `ocf_queue_put`.
Move creating the `finish_thread` during the cache stop
from the `_cache_mngt_cache_stop_sync` to the `cache_mngt_exit_instance`
and give it a proper handling.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-01-19 16:25:11 +01:00
Robert Baldyga
ca3e1a5984 Revert "modules: use si_mem_available() when possible"
This method produced too optimistic free memory value, which in result
led to oom killer activation. This patch restores more conservative
free memory calculation method.

This reverts commit 1e9b7a4262.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-01-14 15:16:09 +01:00
Robert Baldyga
02c3910677 Handle error in ocf_metadata_probe() complete callback properly
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-01-13 15:20:54 +01:00
Robert Baldyga
42c3f3ed8c
Merge pull request #613 from robertbaldyga/start-finalize-sync
Handle cache start finalize synchronously
2020-12-31 21:11:24 +01:00
Robert Baldyga
6bd2681134
Merge pull request #611 from robertbaldyga/shorten-cleaner-thead-name
Shorten cleaner thread name
2020-12-31 21:11:10 +01:00
Robert Baldyga
238b11846b Handle cache start finalize synchronously
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-31 19:49:03 +01:00
Robert Baldyga
ea581953e1 Shorten cleaner thread name
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-30 18:12:21 +01:00
Robert Baldyga
f87e6970a5 Fix listing caches
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-30 17:58:16 +01:00
Robert Baldyga
2753bad018
Merge pull request #568 from mmichal10/occupancy-per-ioclass
Occupancy per ioclass
2020-12-23 14:36:02 +01:00
Michal Mielewczyk
36cf52940b env: print format for 64 bits signed int
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-12-23 07:23:02 -05:00
Michal Mielewczyk
3c678e57d7 classifier: fix string comparison
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-12-23 07:23:02 -05:00
Robert Baldyga
7e40570bbd Remove #ifdef for unsupported kernel version
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
bcd6f4831c Update atomic mode support check
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
1810010093 Use default kernel export mechanism when symbol lookup is not available
Since kernel 5.7 kallsyms_on_each_symbol() is not available.
NOTE: This affects ability to perform upgrade in flight on kernels 5.7+.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
0596597f61 Replace ioctl_by_bdev() with vfs_ioctl()
Since kernel 5.8 ioctl_by_bdev() is not available.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
c596c66063 configure: Add wrappers for default make request function
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
48c3598ef5 configure: Add bdev_disk_changed() wrapper
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
d9ea8d3e32 configure: Add blk_queue_make_request() wrapper
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
ca7f809965 configure: Add __vmalloc() wrapper
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
bbd0cb57a5 configure: Update generic_acct wrapper to kernel 5.8
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-12-22 11:33:38 +01:00
Robert Baldyga
933c98b00a
Merge pull request #538 from arutk/flush
Remove potentially_dirty counter from bottom volume
2020-11-30 10:10:50 +01:00
Robert Baldyga
fc5b7f6c53 Add missing header
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-11-18 22:37:05 +01:00
Robert Baldyga
539e64e2c9
Merge pull request #566 from robertbaldyga/deb-dkms
Introduce DKMS support for DEB packages
2020-11-05 14:01:32 +01:00
Robert Baldyga
3060aaf95f Introduce DKMS support for DEB packages
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-11-04 11:47:34 +01:00
Jan Musial
b217e406be Perform volume test only for atomic device
Signed-off-by: Jan Musial <jan.musial@intel.com>
2020-11-02 11:39:37 +01:00
Adam Rutkowski
7905ca79fa Remove potentially_dirty counter from bottom volume
This counter is not accurate (missing required memory barrier
to avoid unwanted behavior due to processor optimizations)
and performance gain is not clear - generally global
atomic variables are something we would like to avoid
going forward.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-09-29 15:21:11 +02:00
Michal Mielewczyk
8b64206570 configure: add CAS_BLK_BIDI_RQ() macro
Since commit 8b3238cabd50e27 in linux kernel removed blk_bidi_rq() marco, it
has to be wrapped in CAS `configure` script

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-08-25 08:46:24 -04:00
Michal Rakowski
1cd1db2b45 Fully remove format nvme command
Since there is no kernel-kernel api available to communicate
with nvme driver it is more convenient to use some nvme-dedicated
software (e.g. nvme-cli) to manage nvme devices.
It is even not possible to format nvme device with CAS using current
implementation on newest kernels.

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-08-11 06:10:31 -04:00
Robert Baldyga
b8cfee1883
Merge pull request #435 from rafalste/update_versioning
Version unifying
2020-07-27 18:34:46 +02:00
Robert Baldyga
4fb2600721
Merge pull request #457 from robertbaldyga/better-cas-thread-names
Improve CAS thread names
2020-07-08 16:21:12 +02:00
Michal Mielewczyk
017c4261b0 cas_cache: log failed creating exported object
To avoid logging the same message each time _cache_mngt_create_exported_object()
is called, print error message within it.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-07-07 08:28:53 -04:00
Michal Mielewczyk
296cb0ef86 cas_cache: log failed activating exported object
To avoid logging the same message each time block_dev_activate_exported_object()
is called, print error message within it.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-07-07 08:28:53 -04:00
Michal Mielewczyk
8363b67993 cas_disk: handle allocation error properly
In case of error `blk_mq_init_queue()` does not return NULL, but
`ERR_PTR(error_code)` instead.

`IS_ERR_OR_NULL()` should be used to check if `blk_mq_init_queue()` actually
failed.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-07-07 07:43:52 -04:00
Robert Baldyga
83410b2abf Improve CAS thread names
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-07-03 15:05:00 +02:00
Michal Mielewczyk
c71b5fcbd3 Access attach command conditionaly
If cache is restored after upgrade, NULL is passed instead of
`struct kcas_start_cache`. This leads to null pointer dereference.

To prevent null pointer dereference, `struct kcas_start_cache` is tested before
each use

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-06-16 04:20:51 -04:00
Michal Mielewczyk
975ec6f32a Keep pointer to rollback thread in start_finalize
If cache is initialized successfully, `struct _cache_mngt_attach_context` might
be freed in `cache_mngt_init_instance()`. In such case pointer to rollback
thread can't be accessed and thread can't be stopped.

To prevent such scenario pointer should be kept in separate variable.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-06-16 04:20:51 -04:00
Rafal Stefanowski
afa0c1b53f Modify version check flow
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-06-10 15:08:37 +02:00
Michal Mielewczyk
b0f8a67071 Core id based io classification
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-05-21 08:44:20 -04:00
Robert Baldyga
1e25420f86
Merge pull request #404 from rafalste/copyright_update
Update copyright statements
2020-05-19 11:25:11 +02:00
Michal Mielewczyk
3b62e40a2e Purge core command
Purge invalidates all cache lines which belongs to given core. It is very
usefull feature for tests.

Calling purge is possbile with casadm `--script` swtich.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-05-12 11:32:01 -04:00
Michal Mielewczyk
d24288a9b1 Purge cache command
Purge invalidates all cache lines. It is very usefull feature for tests.

Calling purge is possbile with casadm `--script` swtich.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-05-12 11:32:01 -04:00
Rafal Stefanowski
44b4020cc1 Update copyright statements
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-05-04 16:47:38 +02:00
Robert Baldyga
382247b5e7
Merge pull request #407 from imjfckm/schedule-in-sort
Add conditional reschedules to env_sort
2020-04-30 15:35:34 +02:00
Jan Musial
d25b059e2c Add conditional reschedules to env_sort
Sorting can take a long time with big cache sizes and a lot of dirty
data. Make sure we reschedule frome time to time to avoid lockups.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2020-04-29 11:34:40 +02:00
Michal Rakowski
1e9b7a4262 modules: use si_mem_available() when possible
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2020-04-29 11:05:41 +02:00
Robert Baldyga
f127d7c825 Update version to v20.6 (WIP version)
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-04-22 16:13:00 +02:00
Robert Baldyga
162f0a477a
Merge pull request #382 from robertbaldyga/update-ocf-flush-deadlock
Update OCF and handle new error code
2020-04-06 10:05:32 +02:00
Robert Baldyga
d694228263 Update OCF and handle new error code
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2020-04-06 09:03:14 +02:00
Michal Mielewczyk
e1b8ddbc40 Pass remove core result to cli
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-04-01 22:30:43 -04:00
Robert Baldyga
603308f689
Merge pull request #374 from mmichal10/memory-find
Stop cache threads synchronously
2020-03-31 15:30:15 +02:00
Michal Mielewczyk
664c974e03 Revert "Free thread memory after it is stopped."
This reverts commit d483951ebe.
2020-03-31 08:23:57 -04:00
Michal Mielewczyk
1b3424a485 Revert "Free memory of all allocated threads."
This reverts commit 4ec277433d.
2020-03-31 06:46:27 -04:00
Michal Mielewczyk
758c5aa895 Don't hold reference to module in thread
Since stopping threads have to be done synchronusly, there is no need to keep
reference to cas_cache module in each thread.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-31 06:41:11 -04:00
Robert Baldyga
299d1211ef
Merge pull request #372 from mmichal10/memory-find
Alloc rpool with strict memory requirements
2020-03-30 13:30:52 +02:00
Adam Rutkowski
82137c9bc1 Improve _env_allocator_item fields alignment
This change assures that data array is always optimally aligned.
Additionally item boolean flags are put into the same uint32
as cpu number in order to save space for future additions.

This change fixes ~50% performance degradation introduced by
commit d822a1d1.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-03-30 00:39:26 +02:00
Robert Baldyga
6bb4dde213
Merge pull request #369 from mmichal10/async-stop-compl
Before stop wait for start to be finished
2020-03-27 13:59:18 +01:00
Michal Mielewczyk
8c57dc51c0 Alloc rpool with strict memory requirements
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-25 19:25:26 -04:00
Michal Mielewczyk
3edaf30a73 Before stop wait for start to be finished
To prevent cache being stopped before async start finialize has finished, stop
routine have to check if worker responsible for finalizing is not running
anymore.

To create link between start finalize and stop functions, work_struct had to be
moved from attach_context to cache_priv.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-25 06:24:23 -04:00
Michal Mielewczyk
33223bacb9 Fix flush sync wrappers
Call completion function in case of allocation error

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-25 01:52:04 -04:00
Michal Mielewczyk
17d5c8599d Use wrapper function to flush cache during stop
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-25 01:52:04 -04:00
Michal Mielewczyk
dca9769298 Acquire read lock for flushing cache
Read lock allows to retrieve informations about flushing progress and printing
progress bar during changing cache mode.

Flushing dirty data during changing cache mode is done twice - first flush might
be interrupted by user and the second one, called with write lock acquired, is
uninterruptable.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-25 01:52:04 -04:00
Robert Baldyga
de296dd89f
Merge pull request #367 from mmichal10/async-stop-compl
Create finalize thread during stop
2020-03-26 14:16:29 +01:00
Robert Baldyga
af6d3e9d06
Merge pull request #368 from arutk/rpool_debug
Runtime checks for allocator rpool consistency
2020-03-25 15:09:20 +01:00
Robert Baldyga
5b37183e41
Merge pull request #344 from rafalste/add_package_generator
Add package generator script
2020-03-25 12:40:29 +01:00
Michal Mielewczyk
2fffd789c0 Create finalize thread during stop
Creating finalize thread on cache start causes soft lookups during whole
instance lifetime

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-24 07:45:33 -04:00
Adam Rutkowski
d822a1d12e Runtime checks for allocator rpool consistency
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-03-24 01:58:11 +01:00
Robert Baldyga
ef94a0df22
Merge pull request #362 from mmichal10/fix-core-removing
Fix core removing
2020-03-23 14:41:17 +01:00
Robert Baldyga
8b1254dfea
Merge pull request #355 from mmichal10/async-stop-compl
Async stop compl
2020-03-23 13:00:50 +01:00
Michal Mielewczyk
9e692435f6 Allocate stop context on during start
To make cache stop as simple as possibe and to reduce number of errors, stop
context should be allocated during cache initialize.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-23 03:28:26 -04:00
Michal Mielewczyk
f93019165f Hold reference to module for each thread
To prevent removing cas_cache module when not all thread were stopped yet, each
of them should keep reference.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-20 11:17:00 -04:00
Michal Mielewczyk
55d53867cc Complete cache stop from kthread
To enable stopping management queue from completion context, last queue_put()
have to be called from separate thread.

After cache is fully deinitialized, thread calls module_put_and_exit() to
prevent scenario when code is still executed, but there are no references to
module.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-20 11:17:00 -04:00
Michal Mielewczyk
91c8c02860 Simplify functions managing core ids
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-20 10:39:17 -04:00
Michal Mielewczyk
5ca9287b53 Refactor core removing function
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-20 10:39:17 -04:00
Rafal Stefanowski
7335b321ea Add package generator script
- add a 'pckgen' script to generate various OpenCAS packages like
release archives (tar, zip), RPMs (source and binary) as well as to
create version file with metadata
- add a SPEC file for RPM creation
- add Makefile targets to use 'pckgen' script through 'make <package>'

'pckgen' script has a bunch of features for package generation.
Read './pckgen --help' for more information on usage scenarios.

Script is also prepared to easily add new packages creation in the future.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-03-20 03:16:56 +01:00
Michal Mielewczyk
2ef9090d87 Fix metadata updater thread prefix
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-17 18:04:49 -04:00
Michal Mielewczyk
917577480f Remove running field from cas thread info
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-07 16:10:36 -05:00
Michal Mielewczyk
e39eecab49 Don't try to stop non running thread
If _cas_create_thread() thread failed, queue should be stopped by ocf. One of steps
done during queue stop is stopping kernel thread.

To avoid stopping thread which is not running, additional check was added in
_cas_stop_thread().

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-07 15:22:30 -05:00
Michal Mielewczyk
3eab28cf44 Add missing module_put() in casse of alloc error
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-03-07 08:47:24 -05:00
Jan Musial
19c334c4cf Move classifier init after cache device attach completion
Right now the classifier is instantiated before device is attached.
This way if we have any IO-classes present on cache device the
classifier will have no knowledge of them and fail to classify IO
correctly.

After moving the classifier init to cache finalization routine we have
all the information needed to initialize properly both in new instance
start path and in load path.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2020-02-25 14:00:07 +01:00
Adam Rutkowski
e1a7c7f7e8 env: implement vmalloc with GFP flags
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-02-14 14:30:12 +01:00
Rafal Stefanowski
0d256b675d Makefile changes for building RPM
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-02-11 14:47:32 +01:00
Adam Rutkowski
aec95d70c9 Add ENV_BUILD_BUG_ON macro to kernel environment
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-02-10 16:25:35 -05:00
Michal Mielewczyk
a0937758b7 Handle flush core interruption.
When flushing core, acquiring write lock is not necessary, so it was replaced
with read lock wherever possible.

If flushing operation is interrupted by signal, not only waiting for it to be
finished is interrupted but also OCF flush operation is stopped.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-28 15:41:31 -05:00
Michal Mielewczyk
3e033df9c6 Handle flushing cache interruption.
When flushing cache, acquiring write lock is not necessary, so it was replaced
with read lock wherever possible.

If flushing operation is interrupted by signal, not only waiting for it to be
finished is interrupted but also OCF flush operation is stopped.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-28 15:41:31 -05:00
Michal Mielewczyk
eef3667435 classifier: use secure versions of strcmp and strcpy
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-25 04:54:56 -05:00
Michal Rakowski
fe2a8706e9 prepare_cache_cfg: change bug_on to returning err instead
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2020-01-24 15:14:49 +01:00
Michal Rakowski
1b46117908 io_class string ctr: use strnlen
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2020-01-24 15:11:33 +01:00
Michal Rakowski
2ff31a6abf cas_cache: use underscore instead of space in volume type name
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2020-01-16 17:47:57 +01:00
Jan Musiał
51bb7677f1
Merge pull request #268 from mmichal10/fix_mem_leak
Free memory of all allocated threads.
2020-01-16 09:26:26 +01:00
Jan Musiał
11386ab584
Merge pull request #278 from micrakow/report_v20.1
Update reported CAS version to 20.1
2020-01-16 09:25:00 +01:00
Michal Rakowski
4e7653b736 Update reported CAS version to 20.1 2020-01-15 16:12:14 +01:00
Ostrokrzew
bbc03abdf7 Casadm update
Add extended error message in casadm.
Add shortened code mapping for new error code.

Signed-off-by: Ostrokrzew <slawomir.jankowski@intel.com>
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2020-01-15 14:30:58 +01:00
Jan Musial
b5f014f689 Fix upgrade errors
Signed-off-by: Jan Musial <jan.musial@intel.com>
2020-01-14 09:53:03 +01:00
Michal Mielewczyk
4ec277433d Free memory of all allocated threads.
This pach fixes memory leak which appeared due to commit d483951ebe.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-13 06:38:07 -05:00
Michal Mielewczyk
79631867b8 Remove semicolons after 'if' condition
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-07 09:41:16 -05:00
Michal Mielewczyk
36e34b5a69 Don't try to restore cache after stop error.
In current OCF cache stop implemetation no error should occur, so there is no
need to handle it in adapter.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
232f13a8a4 Allow to interrupt cache init, load and stop.
When device used as cache had a big size, it took a lot of time to initialize.
If user would interrupt waiting, asyc OCF init procedure would continue, but
after finish, there was nobody to perfrom kernel part of start nor error
handling.

Now error handling and kernel part of start procedure are moved to completion.
If user will interrupt waiting at any point, newly started cache instance will
be stopped.

Since cache init and load vary only with check for old metadata and initializing
exported objects, they are now merged into one function.

Async cache stop is part of this commit because it was needed for rollback path.

Load, init and stop have common context, because in case of non interrupted
attach CAS needs to wait for rollback to be completed. Common context makes
passing `struct completion` easier between load, init and stop.

This commit is part of patch that will allow to interrupt waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
0b5ed3f00b Allow flush operations to be interrupted.
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save flush result in
memory which might in use by other process. This would cause a system crash.

To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.

This commit also enables possibility to interrupt regular flush properly, by
seding SIGING to casadm.

This commit is part of patch that will allow to interrupt waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
b7f1dd69a9 Allow waiting for metadata flush to be interrupted.
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save flush result in
memory which might in use by other process. This would cause a system crash.

To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.

This commit is part of patch that will allow to interrupt waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
de823b15fc Allow cache r&w locks to be interrupted.
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save lock/unlock result in
memory which might in use by other process. This would cause a system crash.

To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.

This commit is part of patch that will allow to interrupt waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
7af5d296e1 New error code for interrupted waiting.
This commit is part of patch that will allow to interrupt waiting for OCF
operation.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
f7d88c4b3f Don't allow core add, remove nor detach interruptions
They are usually not time comsuming operations, so risk of hung task is low.
So it's easier to temporarily disable interrupts instead of properly handle
async completion.

This commit is part of patch that will handle interrupt of waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
2ac8214379 Don't allow probe interruption.
Usually metadata probe is non time consuming. To avoid dealing with
synchronization problems, noninterruptible wait is performed.

This commit is part of patch that will handle interrupt of waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 18:34:30 -05:00
Michal Mielewczyk
d483951ebe Free thread memory after it is stopped.
After marking thread as ready to stop, CAS was waiting this for thread to exit
out of main execution loop (in _cas_io_queue_thread()). In case of management
queue it lead to deadlock because both stoping queue and main execution loop was
performed in the same execution context.

Since freeing memory is the only operation after stopping thread, it can be
moved just after the main thread loop. After this little reordering,
synchronising between _cas_stop_thread() and _cas_io_queue_thread() in no longer
needed, and no deadlock will occur.

This change is needed to put management qeueue from completion context. Without
this cachnge, there will be no possiblitiy to stop cache from completion context
and to make rollback.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 09:22:13 -05:00
Michal Mielewczyk
3eda503095 Additional null check when starting cache instance
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 09:22:13 -05:00
Michal Mielewczyk
49c87c9527 Fix legacy error messages.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2020-01-02 09:22:13 -05:00
Daniel Madej
b1bd3578db
Merge pull request #223 from mariuszbarczak/introducing-new-io-class-caching-rule-file-name-prefix
Introducing a new IO class caching rule - file name prefix
2019-12-30 10:57:47 +01:00
Mariusz Barczak
7facb1e926 Introducing a new IO class caching rule - file name prefix
Signed-off-by: Mariusz Barczak <mariusz.barczak@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-12-27 14:08:32 +01:00
Michal Rakowski
33ad073dfd atomic: use proper step_size in sub io allocation
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-12-23 11:11:08 +01:00
Jan Musial
4c9465b3bf Fix removing clean inactive core
When removing core that's inactive, allow it without "--force" option if
that core is clean.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-12-11 13:50:22 +01:00
Robert Baldyga
baa621e882
Merge pull request #167 from arutk/fix_block_dev_get_elevator_name_prototype
Make __block_dev_get_elevator_name return const string
2019-11-05 12:35:21 +01:00
Adam Rutkowski
ff207f9b2e Make __block_dev_get_elevator_name return const string
Returning non-const char* doesn't have any benefits since
the only caller casts the output pointer to const char *.

This change fixes compilation on 5.3 kernel.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-28 16:33:38 -04:00
Adam Rutkowski
9b8fdde201 Relax allocations requirements
CAS does not need atomic alocations virtually anywhere. GFP_NOIO
should be sufficient in IO path. When allocation buffers during
module initialization use GFP_KERNEL.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-23 16:04:27 -04:00
Adam Rutkowski
f9f00df576 Use vmalloc instead of kmalloc in mem pools
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-23 16:04:18 -04:00
Adam Rutkowski
e91e58ef66 Revert "env: implement vmalloc with GFP flags"
This reverts commit c5165838e5.
2019-10-18 19:18:31 -04:00
Michał Mielewczyk
1d25ace1cb
Merge pull request #154 from arutk/module_lock
Acquire module_lock before symbol lookup
2019-10-18 16:36:53 +02:00
Adam Rutkowski
f9b8c2d355 Acquire module_lock before symbol lookup
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-18 17:24:21 -04:00
Michał Mielewczyk
bf89577602
Merge pull request #157 from arutk/remove_allocation_from_logger
Replace runtime allocation in logger with static percpu buffer
2019-10-18 16:34:49 +02:00
Adam Rutkowski
dc61d28247 Replace runtime allocation in logger with static percpu buffer
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-18 17:44:13 -04:00
Michał Mielewczyk
affe543e3d
Merge pull request #155 from arutk/fix_vfree
Fix cas_vfree
2019-10-18 16:26:00 +02:00
Adam Rutkowski
f7cc3d414c Fix cas_vfree
1. cas_vfree implementation is now properly selected based on kernel version
2. cas_vfree semantics now accepts NULL pionter as a valid input

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-18 17:29:05 -04:00
Adam Rutkowski
c5165838e5 env: implement vmalloc with GFP flags
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-10-18 17:35:29 -04:00
Michal Mielewczyk
fe7da3220d Mark removed core id as free.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-10-01 10:00:08 -04:00
Michal Mielewczyk
296db39ea0 Adapt to new OCF PP param set/get API.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-10-01 06:54:32 -04:00
Michal Rakowski
4cbf555793 OCF update
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-10-01 10:32:03 +02:00
Robert Baldyga
a2d78103f2 wait interruptible in code called from ioctl handler
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-26 17:11:20 +02:00
Michal Rakowski
3898c9e52d Add blk-mq.h include to linux_kernel_version.h
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-26 16:16:27 +02:00
Adam Rutkowski
186bfbc704 Fix cache reference management in get/set seq cutoff threshold
ocf_core_get_cache does not increment cache reference count, so
it shouldn't be paired with cache_put

Fixes #117

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-26 14:10:17 -04:00
Michal Mielewczyk
8b0d10952f Don't generate core name when adding core to corepool.
When core frome corepool is added to cache, it's old name is loaded and cores
in corepool cannot be referenced by name anyway so new name is not needed.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-25 15:36:02 -04:00
Adam Rutkowski
360a73ae5b
Merge pull request #125 from robertbaldyga/core-param-error-handling
Fix core set param error handling
2019-09-25 20:28:06 +02:00
Robert Baldyga
d5207cb391 Update OCF -> POSIX error mapping
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-25 17:22:34 +02:00
Robert Baldyga
a7390aa6fc Return error on invalid core id
Instead of silently allowing for any core_id in order to set
core parameter for all cores in cache, check explicitly for
special value (OCF_CORE_ID_INVALID) which means that no core
has been selected.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-25 17:22:01 +02:00
Michal Mielewczyk
e96b37ecc2 Confirm cache name before load.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-25 09:44:07 -04:00
Robert Bałdyga
8f45549cc7
Merge pull request #107 from robertbaldyga/cleanup-cas-version
Cleanup cas version
2019-09-19 13:45:17 +02:00
Michal Rakowski
b3dd5ead36
Merge pull request #106 from imjfckm/fix-puts
Remove unneccessary cache_puts
2019-09-19 12:55:34 +02:00
Robert Baldyga
b9177f65c8 Update Open CAS version to 19.09
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-19 12:44:42 +02:00
Robert Baldyga
19bc5da2cf Cleanup CAS_VERSION
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-09-19 12:43:34 +02:00
Jan Musial
9598fa76f1 Expose PP settings in IOCTL iface
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-19 08:38:35 +02:00
Jan Musial
bb1e554dac Dump and restore PP config in upgrade path
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-19 08:31:17 +02:00
Jan Musial
0810df2a0e Add OCL wrappers for promotion policy management 2019-09-18 13:58:55 +02:00
Jan Musial
429302adfc Remove unneccessary cache_puts
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-18 13:02:25 +02:00
Michal Mielewczyk
7d4972a40e Remove irrelevant comment about changing cache modes.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-18 05:00:30 -04:00
Michal Mielewczyk
a48db4aadf Fix printing cache properties in upgrade.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-18 05:00:30 -04:00
Michal Mielewczyk
8e64392298 Validate log level provided to logger.
Check if provided log level isn't greater than number of available log levels
Prevoius check was comparing log level to size of array with avaiable log levels
(in bytes).

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-18 05:00:30 -04:00
Michal Mielewczyk
5f81173844 Leave space for terminating \0 in cache name initialization.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-18 05:00:29 -04:00
Michal Mielewczyk
0e8bffdbb8 Remove info about old ioctls from documenation.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-17 07:34:43 -04:00
Michal Mielewczyk
39a3d04c93 Handle separate functons for retrieving core stats and info.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-16 09:24:14 -04:00
Michal Mielewczyk
1abb1e7c72 Adapt ioclasses stats command to ocf stats builder.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-16 09:24:14 -04:00
Michal Mielewczyk
4726bedb50 New ioctl for retriveing ocf stats.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-16 06:30:13 -04:00
Michal Mielewczyk
bda0eb41a9 Rename KCAS_IOCTL_PARTITION_STATS with KCAS_IOCTL_PARTITION_INFO.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-11 07:10:13 -04:00
Robert Bałdyga
78e8d35c2f
Merge pull request #99 from micrakow/blk_mq_map_queue
cas_disk: Add mandatory blk_mq_ops filed required by some kernels
2019-09-11 12:46:53 +02:00
Jan Musiał
6033ca9f95
Merge pull request #100 from arutk/env_exec_ctx_trylock
Enabling per-CPU freelists
2019-09-11 11:03:32 +02:00
Michal Mielewczyk
76acefd831 After loading cache mark used core ids.
Since OCF doesn't use core and cache ids anymore adapter has to track occupied
ids on its own. After loading cache, ids of all loaded cores should be marked as
occupied, otherwise adding new core without explicit specifying core id will
fail.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-11 02:08:28 -04:00
Adam Rutkowski
c9339d1b2f Add spin_trylock to environment
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-10 19:28:42 -04:00
Adam Rutkowski
7a0f8187cd Add get/put execution context to environment
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-09-10 19:28:42 -04:00
Michal Rakowski
f015dea539 cas_disk: Add mandatory blk_mq_ops filed required by some kernels
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-10 16:28:28 +02:00
Michal Mielewczyk
225ed2833f Added function to retrieve core id from core name.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-10 10:05:31 -04:00
Michal Rakowski
a904a5bf66 Return values of expected type by the block layer
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-09 14:00:44 +02:00
Michal Mielewczyk
7ecd537170 Fix setting core params.
If core id wasn't specified, function was returning error insted of setting
given param for all cores.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-09-04 07:48:04 -04:00
Jan Musial
dd8639316a Fix wrong fcn signature in OCF env
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-09-02 13:41:30 +02:00
Adam Rutkowski
580e24d889
Merge pull request #85 from micrakow/uname
modules: Fixed getting running kernel ver
2019-08-28 15:40:28 +02:00
Michal Rakowski
eab04f02fb modules: Fixed getting running kernel ver
Kernel's 'make kernelversion' does not print some extra version tags
(like 4.19-xxx) so there was a problem with installing CAS on some
kernels. Moved it back to using just 'uname -r'.

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-08-26 15:52:32 +02:00
Michal Rakowski
95af3c6f9f Move to blk-mq block interface.
Currently Open-CAS uses single queue block interface,
which is removed in kernel in version 5.0.
From this moment on Open-CAS supports only blk-mq,
and single queue is not supported any longer.

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-08-26 12:23:21 +02:00
Michal Rakowski
583deef8f6 configure: adapt to kernel 5.1
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-08-26 11:52:39 +02:00
Michal Mielewczyk
9e05950845 Reset particular core stats only if core was specified by user.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-20 07:20:02 -04:00
Michal Mielewczyk
341222e3d7 Treat '16384' as valid cache id.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-20 03:42:05 -04:00
Michal Mielewczyk
56cbc6595b Pass name for newly initialized cache in array instead of pointer.
Unitl now pointer to local variable was passed to OCF and it's content could be
overwriten after leaving function responsible for preparing cache config.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-20 03:42:05 -04:00
Michal Mielewczyk
641902fb90 Implement synchronization primitives destroyers.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-19 02:34:54 -04:00
Michal Mielewczyk
202da8140c Additional data type ops: deinit.
While unloading cas_cache module, volume types were deinitialized, although core
pool still wasn't empty. Now this deinitialization can be done after removing
cores from core pool, and before context is freed.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-16 08:52:43 -04:00
Robert Baldyga
f038223979 Use name based OCF management API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-08-16 14:08:34 +02:00
Michal Mielewczyk
83a3cb693f cas_cache: IO classification based on request size.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-09 09:02:54 -04:00
Michal Mielewczyk
a93cf22b60 cas_cache: IO classification based on offset in file.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-09 09:02:54 -04:00
Michal Mielewczyk
441508a6de cas_cache: IO classification based on process name.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-09 09:02:54 -04:00
Michal Mielewczyk
c2eef6fe64 cas_cache: IO classification based on PID.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-09 08:35:24 -04:00
Michal Mielewczyk
7c4114b7bd cas_cache: IO classification based on LBA.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-09 08:35:24 -04:00
Michal Mielewczyk
02f11db364 cas_cache: IO classification based on file extension.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-09 08:35:24 -04:00
Michal Mielewczyk
e36c8c53c6 cas_cache: Generic classifier for string conditions.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-08-09 08:35:23 -04:00
Robert Baldyga
231ae815c5 Adapt to new ocf_io API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-27 18:53:02 +02:00
Michal Rakowski
eee7a0e220 Fix exported object cleanup in case of cache stop failure
In case of error during cache stop exported object is not being restored after destroying.
This may result in bug in case of calling stop once more.
This commit fixes this issue - exported objects are restored.

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-07-17 15:09:39 +02:00
Michal Rakowski
ee6cba515a Added create/activate/free all exported objects methods
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-07-17 09:43:43 +02:00
Michal Rakowski
47a150644c Doxygen fixup
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-07-17 09:43:43 +02:00
Michal Mielewczyk
c1b5ccbc75 Initialize structures with 0.
If 'open_cores' flag is not explicite set, cores migth not be added on cache
load.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-07-04 03:06:24 -04:00
Jan Musial
506ff687f7 Fix get_core_info trying to access already freed UUID
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-28 13:15:20 +02:00
Michal Rakowski
3ca9a14bb2 Use lookup_bdev generated macro instead of direct call
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-06-28 09:36:11 +02:00
Adam Rutkowski
f0b59c58d9
Merge pull request #53 from mmichal10/validate-core-config
Validate core config
2019-06-27 05:54:49 -04:00
Michał Mielewczyk
7db7bf8320
Merge pull request #49 from imjfckm/fix-leaking-queue-on-failed-load
Fix leaking mngt_queue on load failure
2019-06-27 11:22:24 +02:00
Jan Musial
2964b56615 Fix leaking mngt_queue on load failure
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-27 10:54:37 +02:00
Adam Rutkowski
09e8d0992d Handle ocf_volume_open ret code in cas_blk_open_volume_by_bdev
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-06-27 11:12:43 -04:00
Michal Mielewczyk
db534a70b6 Check if given core device exists.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-26 12:37:53 -04:00
Michal Rakowski
9cf20a9e75 Update reported CAS Version to 19.06 2019-06-26 15:10:40 +02:00
Michal Rakowski
a119a6ac2a Added check for dirty cache/core during cache stop/core removal 2019-06-26 09:32:26 +02:00
Jan Musial
240e6dbc9e Fix too short thread name size in CAS
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-06-25 15:44:05 +02:00
Adam Rutkowski
59520a001c Fix setting KERNEL_VERSION in modules makefile
Shell command evaluation should be performed using 'shell'
function. This fixes 'make install'.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-06-21 17:27:21 -04:00
Michał Mielewczyk
f786f8419a
Merge pull request #39 from arutk/config_custom_kernel
Respect KERNEL_DIR environment variable
2019-06-21 13:23:19 +02:00
Kamil Lepek
9f87a283a3 Force modules distclean
Signed-off-by: Kamil Lepek <kamil.lepek94@gmail.com>
2019-06-19 15:52:55 +02:00
Adam Rutkowski
4db30027a9 Respect KERNEL_DIR environment variable
KERNEL_DIR environment variable can be used to configure
and make CAS with custom kernel source path.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-06-14 19:35:53 -04:00
Adam Rutkowski
6257887e3e
Merge pull request #36 from mmichal10/fix-old-metadata-detection
Fix old metadata detection.
2019-06-13 08:17:14 -04:00
Michal Mielewczyk
0cb219d178 Fix old metadata detection.
Due the changes in ocf error codes adapter misinterpreted information about no
preexisting metadata.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-13 07:55:12 -04:00
Michal Mielewczyk
66a2d3ddd4 Fixed classifier debug message 2019-06-12 06:34:46 -04:00
Michal Mielewczyk
0208375202 Unified management functions prefix
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-06 09:46:40 -04:00
Michal Rakowski
f9c0c929c1 Translate OCF-error-codes in IO path
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-06-05 15:34:04 +02:00
Robert Baldyga
23e330a21f Adapt to new cache lock API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-06-04 15:24:55 +02:00
Robert Baldyga
8d59e41e20 Add utils_mpool
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-06-04 14:40:22 +02:00
Michal Mielewczyk
1e5355eba1 Extending 'configure' script
Functions and macros dependent on different kernel versions are now generated
before compilation basing on current kernel capabilities instead of hardcoding
them for specific kernels.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-05-30 06:29:07 -04:00
Robert Baldyga
00dae3bd2f Use new functions for creating and destroying ocf_ctx
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-24 18:24:51 +02:00
Robert Baldyga
077956f9a9 Pass cache_id to cache_mng_add_core_to_cache()
struct ocf_mngt_core_config no longer contains this information,
so we need to pass it as separate argument.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-24 18:14:17 +02:00
Michał Mielewczyk
068aaddd4a
Merge pull request #24 from arutk/inode_alias_iter_fix
classifier: fix dentry alias list iteration
2019-05-24 15:51:30 +02:00
Adam Rutkowski
1774179493 classifier: fix dentry alias list iteration
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-05-22 13:09:22 -04:00
Michal Rakowski
5eb40cc08b Reported CAS version cleanup
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-05-21 16:49:06 +02:00
Michal Rakowski
869cb9c6ed Enabling CentOS 7.6
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-05-21 12:48:30 +02:00
Michal Rakowski
61e2af80bc Added configure script
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-05-21 12:48:30 +02:00
Michal Mielewczyk
095ccc51fe Added possibility to disable cleaner thread.
In case of cleaner thread retrived 'OCF_CLEANER_DISABLE' no cleaning is
performed until kick is called.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-05-10 09:47:53 -04:00
Michal Mielewczyk
64a79086a8 Removed core pool initializing from adapter.
As core pool is initialized by OCF, it is no longer required to do it in adapter

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-05-10 09:32:01 -04:00
Michal Rakowski
be4dcd0bc0
Merge pull request #17 from robertbaldyga/handle-non-interruptible-flush
Handle non interruptible flush
2019-05-10 15:12:17 +02:00
Michal Rakowski
637ca6e2f4 More descriptive err msg for NVMe format
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-05-10 13:31:10 +02:00
Robert Baldyga
529cd4aabc Remove unneeded argument
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-08 12:48:21 +02:00
Robert Baldyga
0411f2d42f Handle non-interruptible flush
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-05-08 12:48:21 +02:00
Michal Rakowski
7eb2324189 Added Write Lifetime Hint support in classifier
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-04-25 14:56:01 +02:00
Michal Mielewczyk
f62c53862d Add asserts in case of detached cache.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-04-19 03:59:43 -04:00
Adam Rutkowski
79eb92cd9a Implement secure alloc/free using vmalloc/vfree
In kernel there is no point in mlocking and zeroring memory
before freeing.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-18 18:04:57 -04:00
Michal Mielewczyk
de128e8747 Rename logger ops from pritnf to print.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-04-18 03:23:03 -04:00
Michał Mielewczyk
e2c901de6d
Merge pull request #8 from arutk/fix-stop-error-handling
Abort cache deinit in case of ocf stop fatal error
2019-04-12 13:40:36 +02:00
Adam Rutkowski
cfaf0d279f Abort cache deinit in case of ocf stop fatal error
We should only proceed with deinitialization in case of cache
write error, not just any error.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-10 14:36:07 -04:00
Michal Mielewczyk
4655b397a0 Return appropiriate error code when adding core failed.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-04-10 05:09:07 -04:00
Michal Mielewczyk
54027e92ae Allow reset stats for all cores within cache instance at once.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-04-09 07:07:37 -04:00
Michal Rakowski
cb8734eb3f Compilation on ubuntu fixed (exceeded stack frame size)
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-04-03 11:51:43 +02:00
Michał Wysoczański
f5588bbada
Merge pull request #3 from arutk/atomic_dev_fixes
Atomic volume fixes
2019-04-03 08:52:25 +02:00
Adam Rutkowski
9670adf751 Move querying for atomic device params before cache start
This needs to be done in caller application context. As part of asynchronous
management API rework, volume_open callback was moved to kernel worker thread
context. To work around this, atomic parameters are now read before cache
attach/load/probe and provided to bottom volume via volume params.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-02 14:47:39 -04:00
Adam Rutkowski
21abb82081 Return max io size for atomic volume in bytes
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-02 14:37:56 -04:00
Adam Rutkowski
444feb840c Remove intermediate files from repo
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-03-29 14:52:25 -04:00
Michal Wysoczanski
33776fb850 Move README from modules to top level directory 2019-03-29 09:32:50 +01:00