Add kick function for cleaner

ocf_kick_cleaner() allows to perfom cleaning immediately.

Nop cleaning policy now returns new 'OCF_CLEANER_DISABLE' macro which indicates
that cleaing shouldn't be performed. To enable it back, ocf_kick_cleaner()
should be called.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2019-03-14 04:49:52 -04:00
parent 94ef5a5249
commit 7165bc16c3
10 changed files with 51 additions and 15 deletions

View File

@@ -9,9 +9,10 @@ from .shared import SharedOcfObject
class CleanerOps(Structure):
INIT = CFUNCTYPE(c_int, c_void_p)
KICK = CFUNCTYPE(None, c_void_p)
STOP = CFUNCTYPE(None, c_void_p)
_fields_ = [("init", INIT), ("stop", STOP)]
_fields_ = [("init", INIT), ("kick", KICK), ("stop", STOP)]
class Cleaner(SharedOcfObject):
@@ -24,13 +25,18 @@ class Cleaner(SharedOcfObject):
@classmethod
def get_ops(cls):
return CleanerOps(init=cls._init, stop=cls._stop)
return CleanerOps(init=cls._init, kick=cls._kick, stop=cls._stop)
@staticmethod
@CleanerOps.INIT
def _init(cleaner):
return 0
@staticmethod
@CleanerOps.KICK
def _kick(cleaner):
pass
@staticmethod
@CleanerOps.STOP
def _stop(cleaner):