From 210dbd4ff19ea66fd2f0109cc15aad53349be52f Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Tue, 12 Sep 2023 08:15:40 -0500 Subject: [PATCH] osd: cleaning stop_for_fast_shutdown() Removed unsued variables to prevent compiler warnings. Protected the shard lock. Signed-off-by: Ronen Friedman --- src/osd/OSD.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 83c49a08a48..52f937d7ff4 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -11247,19 +11247,15 @@ void OSD::ShardedOpWQ::_enqueue_front(OpSchedulerItem&& item) void OSD::ShardedOpWQ::stop_for_fast_shutdown() { - uint32_t shard_index = 0; m_fast_shutdown = true; - for (; shard_index < osd->num_shards; shard_index++) { + for (int shard_index = 0; shard_index < osd->num_shards; shard_index++) { auto& sdata = osd->shards[shard_index]; ceph_assert(sdata); - sdata->shard_lock.lock(); - int work_count = 0; - while(! sdata->scheduler->empty() ) { - auto work_item = sdata->scheduler->dequeue(); - work_count++; + std::lock_guard l(sdata->shard_lock); + while (!sdata->scheduler->empty()) { + sdata->scheduler->dequeue(); } - sdata->shard_lock.unlock(); } } -- 2.39.5