@@ -131,9 +131,15 @@ void GCManager::pdev_gc_actor::start() {
131
131
LOGERROR (" pdev gc actor for pdev_id={} is already started, no need to start again!" , m_pdev_id);
132
132
return ;
133
133
}
134
+ RELEASE_ASSERT (RESERVED_CHUNK_NUM_PER_PDEV > RESERVED_CHUNK_NUM_DEDICATED_FOR_EGC,
135
+ " reserved chunk number {} per pdev should be greater than {}" , RESERVED_CHUNK_NUM_PER_PDEV,
136
+ RESERVED_CHUNK_NUM_DEDICATED_FOR_EGC);
134
137
// thread number is the same as reserved chunk, which can make sure every gc thread can take a reserved chunk
135
138
// for gc
136
- m_gc_executor = std::make_shared< folly::IOThreadPoolExecutor >(RESERVED_CHUNK_NUM_PER_PDEV);
139
+ m_gc_executor = std::make_shared< folly::IOThreadPoolExecutor >(RESERVED_CHUNK_NUM_PER_PDEV -
140
+ RESERVED_CHUNK_NUM_DEDICATED_FOR_EGC);
141
+ m_egc_executor = std::make_shared< folly::IOThreadPoolExecutor >(RESERVED_CHUNK_NUM_DEDICATED_FOR_EGC);
142
+
137
143
LOGINFO (" pdev gc actor for pdev_id={} has started" , m_pdev_id);
138
144
}
139
145
@@ -144,8 +150,10 @@ void GCManager::pdev_gc_actor::stop() {
144
150
return ;
145
151
}
146
152
m_gc_executor->stop ();
147
- m_gc_executor->join ();
148
153
m_gc_executor.reset ();
154
+
155
+ m_egc_executor->stop ();
156
+ m_egc_executor.reset ();
149
157
LOGINFO (" pdev gc actor for pdev_id={} has stopped" , m_pdev_id);
150
158
}
151
159
@@ -157,13 +165,18 @@ folly::SemiFuture< bool > GCManager::pdev_gc_actor::add_gc_task(uint8_t priority
157
165
if (m_chunk_selector->try_mark_chunk_to_gc_state (move_from_chunk,
158
166
priority == static_cast < uint8_t >(task_priority::emergent))) {
159
167
auto [promise, future] = folly::makePromiseContract< bool >();
160
- m_gc_executor->addWithPriority (
161
- [this , priority, move_from_chunk, promise = std::move (promise)]() mutable {
168
+
169
+ if (sisl_unlikely (priority == static_cast < uint8_t >(task_priority::emergent))) {
170
+ m_egc_executor->add ([this , priority, move_from_chunk, promise = std::move (promise)]() mutable {
162
171
LOGERROR (" start gc task : move_from_chunk_id={}, priority={}" , move_from_chunk, priority);
163
172
process_gc_task (move_from_chunk, priority, std::move (promise));
164
- },
165
- priority);
166
-
173
+ });
174
+ } else {
175
+ m_gc_executor->add ([this , priority, move_from_chunk, promise = std::move (promise)]() mutable {
176
+ LOGERROR (" start gc task : move_from_chunk_id={}, priority={}" , move_from_chunk, priority);
177
+ process_gc_task (move_from_chunk, priority, std::move (promise));
178
+ });
179
+ }
167
180
return std::move (future);
168
181
}
169
182
0 commit comments