Commit Graph

283 Commits

Author SHA1 Message Date
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