Avoid adding mngt_queue to io_queues list
Previously every created queue was added to io_queues list, which made mngt_queue being used in ocf_parallelize. Change mngt_queue creation API so that mngt_queue is not added to the list and doesn't have unnecessary functionalities initialized. Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com> Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:

committed by
Michal Mielewczyk

parent
1d903f4038
commit
8db93260ae
@@ -1,8 +1,9 @@
|
||||
#
|
||||
# Copyright(c) 2019-2021 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
from ctypes import c_void_p, cdll
|
||||
from ctypes import c_int, c_void_p, cdll
|
||||
import inspect
|
||||
import os
|
||||
|
||||
@@ -22,6 +23,9 @@ class OcfLib:
|
||||
lib.ocf_core_get_front_volume.restype = c_void_p
|
||||
lib.ocf_core_get_front_volume.argtypes = [c_void_p]
|
||||
|
||||
lib.ocf_queue_create_mngt.restype = c_int
|
||||
lib.ocf_queue_create_mngt.argtypes = [c_void_p, c_void_p, c_void_p]
|
||||
|
||||
cls.__lib__ = lib
|
||||
|
||||
return cls.__lib__
|
||||
|
@@ -277,10 +277,9 @@ class Cache:
|
||||
raise OcfError("Creating cache instance failed", status)
|
||||
|
||||
if init_mngmt_queue:
|
||||
self.mngt_queue = Queue(self, "mgmt-{}".format(self.get_name()))
|
||||
status = self.owner.lib.ocf_mngt_cache_set_mngt_queue(self, self.mngt_queue)
|
||||
if status:
|
||||
raise OcfError("Error setting management queue", status)
|
||||
self.mngt_queue = Queue(
|
||||
self, "mgmt-{}".format(self.get_name()), mngt=True
|
||||
)
|
||||
|
||||
if init_default_io_queue:
|
||||
self.io_queues = [Queue(self, "default-io-{}".format(self.get_name()))]
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright(c) 2019-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
@@ -42,15 +43,20 @@ def io_queue_run(*, queue: Queue, kick: Condition, stop: Event, sem: Semaphore):
|
||||
class Queue:
|
||||
_instances_ = weakref.WeakValueDictionary()
|
||||
|
||||
def __init__(self, cache, name):
|
||||
def __init__(self, cache, name, mngt=False):
|
||||
|
||||
self.ops = QueueOps(kick=type(self)._kick, stop=type(self)._stop)
|
||||
self.name = name
|
||||
|
||||
self.handle = c_void_p()
|
||||
status = OcfLib.getInstance().ocf_queue_create(
|
||||
cache.cache_handle, byref(self.handle), byref(self.ops)
|
||||
)
|
||||
if mngt:
|
||||
status = OcfLib.getInstance().ocf_queue_create_mngt(
|
||||
cache.cache_handle, byref(self.handle), byref(self.ops)
|
||||
)
|
||||
else:
|
||||
status = OcfLib.getInstance().ocf_queue_create(
|
||||
cache.cache_handle, byref(self.handle), byref(self.ops)
|
||||
)
|
||||
if status:
|
||||
raise OcfError("Couldn't create queue object", status)
|
||||
|
||||
|
Reference in New Issue
Block a user