summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRishabh Dave <ridave@redhat.com>2024-08-27 10:14:31 +0200
committerRishabh Dave <ridave@redhat.com>2024-10-19 13:44:24 +0200
commit8f7c5f08e6fa458b9bccb394d3687249ac3f481c (patch)
treedf6768dbf3066b9adf34e9255a29fb05290df7db
parentMerge pull request #58478 from rhcs-dashboard/carbon-forms-fs (diff)
downloadceph-8f7c5f08e6fa458b9bccb394d3687249ac3f481c.tar.xz
ceph-8f7c5f08e6fa458b9bccb394d3687249ac3f481c.zip
mgr/vol: add comments to explain queuing data structures
Add some comment to explains the purpose and details of data structures that are used for queuing of async jobs since right now it's not obvious from initialization. Signed-off-by: Rishabh Dave <ridave@redhat.com>
-rw-r--r--src/pybind/mgr/volumes/fs/async_job.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pybind/mgr/volumes/fs/async_job.py b/src/pybind/mgr/volumes/fs/async_job.py
index 6834e3e240b..132d990862b 100644
--- a/src/pybind/mgr/volumes/fs/async_job.py
+++ b/src/pybind/mgr/volumes/fs/async_job.py
@@ -118,10 +118,16 @@ class AsyncJobs(threading.Thread):
def __init__(self, volume_client, name_pfx, nr_concurrent_jobs):
threading.Thread.__init__(self, name="{0}.tick".format(name_pfx))
self.vc = volume_client
- # queue of volumes for starting async jobs
+ # self.q is a deque of names of a volumes for which async jobs needs
+ # to be started.
self.q = deque() # type: deque
- # volume => job tracking
+
+ # self.jobs is a dictionary where volume name is the key and value is
+ # a tuple containing two members: the async job and an instance of
+ # threading.Thread that performs that job.
+ # in short, self.jobs = {volname: (async_job, thread instance)}.
self.jobs = {}
+
# lock, cv for kickstarting jobs
self.lock = threading.Lock()
self.cv = threading.Condition(self.lock)