]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: cleaning stop_for_fast_shutdown() 53426/head
authorRonen Friedman <rfriedma@redhat.com>
Tue, 12 Sep 2023 13:15:40 +0000 (08:15 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Tue, 12 Sep 2023 15:55:48 +0000 (10:55 -0500)
Removed unsued variables to prevent compiler warnings.
Protected the shard lock.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/OSD.cc

index 83c49a08a48db37e0367800aa7c654ddf23886be..52f937d7ff4d5d886f5e682f7bcb8c06a2c8f2a3 100644 (file)
@@ -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();
   }
 }