]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: pull requeued requests off one at a time
authorSage Weil <sage@inktank.com>
Mon, 18 Feb 2013 04:49:52 +0000 (20:49 -0800)
committerSage Weil <sage@inktank.com>
Tue, 19 Feb 2013 18:41:09 +0000 (10:41 -0800)
Pull items off the finished queue on at a time.  In certain cases, an
event may result in new items betting added to the finished queue that
will be put at the *front* instead of the back.  See latest incarnation
of #2947.

Note that this is a significant changed in behavior in that we can
theoretically starve if an event keeps resulting in new events getting
generated.  Beware!

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc

index a1546bc606d9a53f6410aa1ef15ff7cb133e3732..d5f2b2299a434f311707cb1d2fab935bd84279f7 100644 (file)
@@ -3545,22 +3545,17 @@ void OSD::do_waiters()
 {
   assert(osd_lock.is_locked());
   
+  dout(10) << "do_waiters -- start" << dendl;
   finished_lock.Lock();
-  if (finished.empty()) {
+  while (!finished.empty()) {
+    OpRequestRef next = finished.front();
+    finished.pop_front();
     finished_lock.Unlock();
-  } else {
-    list<OpRequestRef> waiting;
-    waiting.splice(waiting.begin(), finished);
-
-    finished_lock.Unlock();
-    
-    dout(10) << "do_waiters -- start" << dendl;
-    for (list<OpRequestRef>::iterator it = waiting.begin();
-         it != waiting.end();
-         it++)
-      dispatch_op(*it);
-    dout(10) << "do_waiters -- finish" << dendl;
+    dispatch_op(next);
+    finished_lock.Lock();
   }
+  finished_lock.Unlock();
+  dout(10) << "do_waiters -- finish" << dendl;
 }
 
 void OSD::dispatch_op(OpRequestRef op)