pyocf: add FLUSH flag
Flush I/O must be recognized by the bottom adapter by inspecting
adapter specific flags
@@ -22,6 +22,7 @@ from ctypes import (
)
from hashlib import md5
import weakref
+from enum import IntEnum
from .io import Io, IoOps, IoDir
from .queue import Queue
@@ -32,6 +33,10 @@ from .data import Data
from .queue import Queue
+class IoFlags(IntEnum):
+ FLUSH = 1
+
+
class VolumeCaps(Structure):
_fields_ = [("_atomic_writes", c_uint32, 1)]
@@ -350,6 +355,11 @@ class RamVolume(Volume):
discard.contents._end(discard, -OcfErrorCode.OCF_ERR_NOT_SUPP)
def do_submit_io(self, io):
+ flags = int(io.contents._flags)
+ if flags & IoFlags.FLUSH:
+ self.do_submit_flush(io)
+ return
+
try:
io_priv = cast(OcfLib.getInstance().ocf_io_get_priv(io), POINTER(VolumeIoPriv))
offset = io_priv.contents._offset
