Commit Graph

998 Commits

Author SHA1 Message Date
Adam Rutkowski
f0c3e049c6
Merge pull request #117 from mmichal10/null-ptr-on-cache-id-reuse
Fix teardown after failed start cache operation.
2019-04-11 09:03:09 -04:00
Michal Mielewczyk
fbfd17ec42 Fix teardown after failed start cache operation.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-04-11 04:33:32 -04:00
Adam Rutkowski
a6e7ee528e Fix error handling in cache unplug
Errors not related to cache disk I/O failure should force
cache stop to return with error without deinitializing cache
instance.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-10 15:15:12 -04:00
Jan Musial
15fb0d04bd Fix IO queue validation
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-04-08 14:40:20 +02:00
Jan Musial
5d6277e7cf Fix flushing of volatile metadata containers
Before async metadata we used to return 0 on flushing volatile
containers, this way we didn't have to special-case them.
This change brings back this behavior.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-04-08 12:39:53 +02:00
Michał Mielewczyk
f9e5d019df
Merge pull request #103 from arutk/arutk-force-separate-mngmt-io-queue
Do not allow top volume I/O on management queue
2019-04-05 13:22:40 +02:00
Adam Rutkowski
d88a4ac57a Do not allow top volume I/O on management queue
Core volume I/O must not be queued on management queue - this would
break I/O accounting code, resulting in use-after-free type of errors
after cache detach, core remove etc.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-05 14:55:28 -04:00
Adam Rutkowski
0b68e02e9a Reset interrupted flag in core_flush
This line got lost in async flush rework

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-05 13:26:55 -04:00
Michał Wysoczański
0192f4070d
Merge pull request #96 from micrakow/volume_move_fix
Added original uuid deinitialization without freeing
2019-04-02 11:31:46 +02:00
Michal Rakowski
a6c75b9900 Added original uuid deinitialization without freeing
There is a risk that without uuid.data pointer denitialization it will
be freed during original volume deinit, zeroing uuid.data pointer
prevents that.

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-04-02 11:02:51 +02:00
Adam Rutkowski
2aba5a2843 Add volume_params argument to bottom volume open
This pointer is used to provide optional volume specific data
from the user down to bottom volume open callback. volume_params
is provided to OCF in ocf_mngt_cache_device_config.volume_params.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-04-01 19:28:14 -04:00
Adam Rutkowski
7e9ff6456d
Merge pull request #92 from mmichal10/fix-preventing-metadata-override
Return error on start when detected old metadata of not flushed cache.
2019-03-29 16:29:22 +01:00
Michal Mielewczyk
a1075f7cf6 Return error on start when detected old metadata of not flushed cache.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-03-29 11:22:49 -04:00
Adam Rutkowski
d34942e7e5
Merge pull request #91 from mmichal10/fix-cleaning-pol-ret-val
Fix inappropriate return value when setting cleaning policy
2019-03-29 15:53:21 +01:00
Michal Mielewczyk
05be94f7e5 Fix inappropriate return value when setting cleaning policy
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-03-29 10:45:45 -04:00
Adam Rutkowski
9a3713fe74 Rename default IO class to lowercase "unclassified"
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-03-29 15:15:44 -04:00
Robert Baldyga
5699422586 Introduce ocf_cache_has_pending_cleaning() function
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-26 15:09:52 +01:00
Michał Wysoczański
03c95d36f0
Merge pull request #82 from robertbaldyga/asynchronous-metadata
Handle metadata asynchronously
2019-03-26 12:54:26 +01:00
Robert Baldyga
6cd84476f6 Handle metadata asynchronously
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-26 12:49:23 +01:00
Michał Wysoczański
bf9b85150f
Merge pull request #87 from arutk/prv-async_flush
Asynchronous flush and purge - part 2
2019-03-26 12:34:24 +01:00
Adam Rutkowski
54374639b8 Asynchronous wait for dirty requests in flush
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-03-26 15:23:42 -04:00
Adam Rutkowski
7003d38b44 Encapsulate request reference counting logic in utils_refcnt
In order to synchronize management operations with I/O OCF
maintains in-flight request counters. For example such ref
counters are used during ocf_mngt_detach to drain requests
accessing cache metadata (cache requests counter) and in
ocf_mngt_flush where we wait for outstanding requests sent
in write back mode (dirty requests counter).

Typically I/O threads increment cache/dirty counter when
creating request and decrement counter on request completion.
Management thread sets atomic variable to signal the start of
management operation. I/O threads react to this by changing
I/O requests mode so that the cache/dirty reference counter
is not incremented. As a result reference counter keeps getting
decremented. Management thread waits for the counter to drop to 0
and proceeds with management operation with assumption that no
cache/dirty requests are in progress.

This patch introduces a handy utility for requests reference
counting logic. ocf_refcnt_inc / dec are used to increment/
decrement counter. ocf_refcnt_freeze() makes subsequent
ocf_refcnt_inc() calls to return false, indicating that counter
cannot be incremented at this moment. ocf_refcnt_register_zero_cb
can be used to asynchronously wait for counter to drop to 0.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-03-26 15:22:31 -04:00
Michał Wysoczański
08a5b9d2a4
Merge pull request #86 from Donaim/delay-put-cache
Put cache after doing pipeline_destroy
2019-03-26 11:38:01 +01:00
Vitaliy Mysak
2f2f004867 Put cache after doing pipeline_destroy
Cache is used during pipeline_destroy which means that
doing put_cache before destroying pipeline may result in
accessing memory that was freed.

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2019-03-26 19:30:34 +00:00
Adam Rutkowski
1a234744ef Fix flush cache error handling
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-03-25 22:26:53 -04:00
Vitaliy Mysak
51396bf0e6 atomic_dec_return -> env_atomic_dec_return
Fix usage of undefined function

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2019-03-26 02:55:45 +00:00
Robert Bałdyga
a084c1cb1c
Merge pull request #80 from arutk/prv-async_flush
Asynchronous flush and purge operations - part 1
2019-03-22 23:24:10 +01:00
Adam Rutkowski
0d0fd0be75 Asynchronous implementation of flush and purge - part 1
For flush/purge entry points to be fully asynchronous we still
need to rework flush mutex and waiting for outstanding dirty
requests.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2019-03-22 17:04:33 -04:00
Robert Baldyga
ae1f600b57 Add missing env_rwsem_up_write() in ocf_cleaner_run()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-22 15:51:40 +01:00
Robert Baldyga
9c72aed559 Add missing context size to pipeline properties
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-22 10:27:42 +01:00
Michał Wysoczański
2a2f14ec42
Merge pull request #77 from robertbaldyga/async-save-core-add-remove
Implement asynchronous save, add core and remove core
2019-03-22 10:01:39 +01:00
Robert Bałdyga
70df1d80a1
Merge pull request #79 from Donaim/cleaner-set-queue
Set io_queue for cleaner IOs
2019-03-21 10:08:39 +01:00
Vitaliy Mysak
b9cae8b164 Set io_queue for cleaner IOs
Send cleaner IOs with appropriate queue set
This solves the issue of bottom adapter getting NULL in io->io_queue

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2019-03-21 10:03:56 +01:00
Robert Baldyga
72b6f35f52 Implement asynchronous save, add core and remove core
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-21 09:03:59 +01:00
Robert Baldyga
23b0a32aec Parametrize pipeline steps
This allows to reuse same step functions giving them different parameters
on each step.

Additionally move pipeline to utils, to make it accessible to other
subsystems of OCF (e.g. metadata).

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-20 17:06:56 +01:00
Robert Baldyga
91e0345b78 Implement asynchronous attach, load, detach and stop
NOTE: This is still not the real asynchronism. Metadata interfaces
are still not fully asynchronous.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-03-18 15:06:57 +01:00
Robert Baldyga
c5df82f2cb Make management API asynchronous
NOTE: This patch only changes API that pretends to be asynchronous.
Most of management operations are still performed synchronously.
The real asynchronism will be introduced in the next patches.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-12 10:33:26 +01:00
Michal Mielewczyk
d06f376627 Alru cleaning policy improvement
Instead of calling flush separatly for each IO class, it is called after
collecting number of dirty cache lines defined by user or after iterating
through all IO classes.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-03-11 04:08:16 -04:00
Michal Mielewczyk
b611c0e67a Calling completions function in nop cleaning policy.
Unlocking cache and putting queue are perormed in cleaning completion, so all
cleaning policies has to call completion.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-03-11 04:08:16 -04:00
Michal Rakowski
e5227cef89 Implement pyocf adapter with sample OCF test
PyOCF is a tool written with testing OCF functionality in mind.
It is a Python3 (3.6 version required) package which wraps OCF
by providing Python objects in place of OCF objects (volumes, queues,
etc). Thin layer of translation between OCF objects and PyOCF objects
enables using customized behaviors for OCF primitives by subclassing
PyOCF classes.

This initial version implements only WT and WI modes and single,
synchronously operating Queue.

TO DO:

  - Queues/Cleaner/MetadataUpdater implemented as Python threads
  - Loading of caches from PyOCF Volumes (fix bugs in OCF)
  - Make sure it works multi-threaded for more sophisticated tests

Co-authored-by: Jan Musial <jan.musial@intel.com>
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
Signed-off-by: Jan Musial <jan.musial@intel.com>
2019-03-07 12:48:40 +01:00
Michal Rakowski
794b008127
Merge pull request #66 from robertbaldyga/metadata-probe-asynchronous
Make metadata probe asynchronous
2019-03-04 12:26:34 +01:00
Robert Baldyga
9b9b965b55 Add cache locking functions in trylock variant
- Add cache trylock and read trylock functions.
- Introduce new error code -OCF_ERR_NO_LOCK.
- Change trylock functions in env to return this code in case of
  lock contention.

[ENV CHANGES REQUIRED]
Following functions should return 0 on success or -OCF_ERR_NO_LOCK
in case of lock contention:
- env_mutex_trylock()
- env_rwsem_up_read_trylock()
- env_rwsem_up_write_trylock()

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-01 17:31:32 +01:00
Robert Baldyga
9c0390a6ce Make metadata probe asynchronous
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-03-01 15:46:16 +01:00
Robert Baldyga
c1028b2b89 Add ocf_cache_set_flush_queue() function
This is needed to enable flushing with dynamic queues.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-02-28 10:51:51 +01:00
Jan Musiał
d5ac3035d7
Merge pull request #64 from robertbaldyga/add-has-pending-reqs-func
Add ocf_cache_has_pending_requests() function
2019-02-27 12:22:16 +01:00
Michal Mielewczyk
e53944d472 Dynamic I/O queue management
- Queue allocation is now separated from starting cache.
- Queue can be created and destroyed in runtime.
- All queue ops accept queue handle instead of queue id.
- Cache stores queues as list instead of array.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-02-26 17:36:19 +01:00
Robert Baldyga
03bd6d6c49 Add ocf_cache_has_pending_requests() function
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-02-26 17:23:07 +01:00
Michal Mielewczyk
1771228a46 Removed starting cache from load
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-02-20 17:36:37 -05:00
Robert Baldyga
44ed250d41 Add API function ocf_cache_wait_for_io_finish()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-02-20 11:16:06 +01:00
Robert Bałdyga
435cc6209a
Merge pull request #60 from robertbaldyga/make-cleaner-async
Make cleaner asynchronous
2019-02-19 16:18:21 +01:00
Robert Baldyga
404b976109 Make cleaner asynchronous
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-02-19 16:10:24 +01:00
Robert Bałdyga
163392af0b
Merge pull request #55 from MinneyJohn/metadata_improve
Improvement of metadata flush setting
2019-02-19 15:49:02 +01:00
xqzhou
bbb0e1bbb0 Improvement of metadata flush setting
Signed-off-by: xqzhou <xue.qiang.zhou@intel.com>
2019-02-19 05:14:06 -07:00
Michal Mielewczyk
f8037cb349 Added function to hanlde single request from queue. 2019-02-13 12:02:59 -05:00
Robert Baldyga
97300b1137 Rename "data object" to "volume"
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-02-08 14:13:05 +01:00
Michal Mielewczyk
2dfd6248c9 Configure all io classes at once.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-01-28 08:51:26 -05:00
Michal Mielewczyk
5c81824a8d Added mechanism for preventing dirty requests.
Instead of switching write policy to pass-through, barrier is rised
by incrementing counter in ocf_cache_t structure.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-01-24 05:16:16 -05:00
Robert Baldyga
3b4a666942 Enable passing priv to logger during context initialization
This may be used in logger implementations that need file
name or descriptor to initialize properly.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-24 10:54:50 +01:00
Robert Baldyga
6860cdbd2c Reorganize context ops
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-22 13:14:35 +01:00
Robert Baldyga
03c2f142b3 Cache lock cleanup and API improvements
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-21 13:46:28 +01:00
Robert Baldyga
0abb4dbbca Minor coding style fixes
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-18 14:52:13 +01:00
Robert Bałdyga
21eb60ef1e
Merge pull request #43 from mmichal10/task-code-refactoring
Code refactoring
2019-01-16 13:56:07 +01:00
Michal Mielewczyk
916f46c893 Code refactoring
Removed few dead assignments and added variables initialization.
2019-01-16 06:46:00 -05:00
Robert Baldyga
7352f3092d Fix leak in core pool
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-16 11:53:54 +01:00
Robert Baldyga
d9cfab67b8 Fix compilation errors after tracing introduction
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-14 17:28:51 +01:00
Robert Bałdyga
dd6b074258
Merge pull request #3 from tomaszrybicki/add-tracing-support
Added tracing functionality
2019-01-14 16:37:34 +01:00
Michał Mielewczyk
f11db9c31a
Merge pull request #38 from robertbaldyga/remove-name_size
Remove name_size field from cache and core config
2019-01-14 16:04:16 +01:00
Robert Baldyga
07191c322e Express maximum io size in bytes instead of sectors
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-14 15:10:09 +01:00
Robert Baldyga
322f1aeffd Remove name_size field from cache and core config
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-14 15:09:09 +01:00
Tomasz Rybicki
1156531590 Added tracing functionality
Signed-off-by: Tomasz Rybicki <tomasz.rybicki@intel.com>
2019-01-14 14:17:48 +01:00
Michał Mielewczyk
e6dc62e09a
Merge pull request #33 from micrakow/master
Added sample env files and makefile to be used by functional tests
2019-01-08 13:32:17 +01:00
Michal Rakowski
c30f667bda Fix usage of atomic_ to env_atomic
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-01-07 17:25:47 +01:00
Vitaliy Mysak
506f0aa975 Add more missing io_set_queue
Propagate id of ocf_queue for discard io

This resolves the issue of
  bottom adapter always getting an ocf_io with io_queue = 0,
  no matter from which queue function to bottom adapter was called

This is a follow up on e69894e398

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2019-01-06 20:57:52 +00:00
Robert Baldyga
4cf4d6d7c7 Simplify data object API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-04 17:34:39 +01:00
Robert Baldyga
67f17b9dc2 Add more missing io_put() calls
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-04 13:11:30 +01:00
Michal Rakowski
e139f79d6b
Merge pull request #25 from robertbaldyga/core-data-object
Core data object
2019-01-04 09:19:46 +01:00
Robert Baldyga
4be6761a18 Core data object
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-04 08:33:34 +01:00
Robert Baldyga
721bc647bd Add env_cond_resched() in the loop that may execute for a long time
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-01-02 14:49:30 +01:00
Robert Baldyga
8d127e6351 Move eviction stuff to eviction/ directory
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-31 14:51:51 +01:00
Robert Baldyga
aeef20524f Fix _ffz() function
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-21 09:16:09 +01:00
Robert Baldyga
71f1682215 Add missing io puts
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-20 14:35:26 +01:00
Robert Baldyga
d73e0512b1 Fix OCF compilation - use new macro name
This looks like during change from DIV_ROUND_UP to OCF_DIV_ROUND_UP
this one occurrence has been missed.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-18 09:17:39 +01:00
Vitaliy Mysak
e69894e398 Set io_queue for some requests
Propagate id of ocf_queue where it is possible

This resolves the issue of
  bottom adapter always getting an ocf_io with io_queue = 0,
  no matter from which queue function to bottom adapter was called

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2018-12-14 22:52:39 +00:00
Mariusz Barczak
15ed5b4450 OCF provides own macros for MIN, MAX, and DIV_ROUND_UP
Signed-off-by: Mariusz Barczak <mariusz.barczak@intel.com>
2018-12-13 10:59:23 -05:00
Michal Rakowski
abb8dc5067
Merge pull request #14 from robertbaldyga/complete-naming-cleanup
Unify completion functions naming
2018-12-13 09:34:03 +01:00
Robert Baldyga
951b628fe5 Unify completion functions naming
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-13 07:49:27 +01:00
Robert Baldyga
6d81924891 Remove assembler code
Replace assembler code with C equivalent and slightly simplify
logic searching for first free core.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-13 07:33:16 +01:00
Michal Rakowski
a643614fd6
Merge pull request #12 from robertbaldyga/req-naming-cleanup
Req naming cleanup
2018-12-12 15:20:34 +01:00
Robert Baldyga
69947bb44b Unify core naming convention (core_obj -> core)
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-12 14:49:17 +01:00
Jan Musiał
e1f7cd3875
Merge pull request #10 from wolszews/modify-logging
Change cache/core printing style
2018-12-12 13:44:38 +01:00
Robert Baldyga
db92083432 Unify req naming convention (rq -> req)
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-12 13:36:34 +01:00
Robert Baldyga
218b6b2391 utils: Simplify discard max size calculation
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-12 11:20:41 +01:00
Robert Baldyga
d862778e2b Remove legacy io completion API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-12 11:20:41 +01:00
Wojciech Olszewski
7973dbbf41 Change cache/core printing style 2018-12-07 17:55:08 +01:00
Michał Mielewczyk
c0079e4d77
Merge pull request #8 from wolszews/remove-log-prefix
Remove OCF prefix
2018-12-07 15:40:47 +01:00
Robert Baldyga
402df33ff5 Introduce more uniform hash function
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-12-07 14:37:35 +01:00
wolszews
0cb11b0d3c Remove OCF prefix 2018-12-06 16:04:30 +01:00
Robert Baldyga
a8e1ce8cc5 Initial commit
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2018-11-29 15:14:21 +01:00