]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: skip over last queue_transaction() if the transaction is empty
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 Feb 2016 07:56:01 +0000 (15:56 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 14 Mar 2016 05:35:15 +0000 (13:35 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSD.cc

index 500ad777479d2d1e20ba092f2fe559e96f610e55..65a4686b0a92751ccb908a100ae4e9de0d49026d 100644 (file)
@@ -4484,6 +4484,9 @@ bool remove_dir(
     store->get_ideal_list_max(),
     &olist,
     &next);
+  // default cont to true, this is safe because caller(OSD::RemoveWQ::_process()) 
+  // will recheck the answer before it really goes on.
+  bool cont = true;
   for (vector<ghobject_t>::iterator i = olist.begin();
        i != olist.end();
        ++i) {
@@ -4498,7 +4501,7 @@ bool remove_dir(
     if (++num >= cct->_conf->osd_target_transaction_size) {
       C_SaferCond waiter;
       store->queue_transaction(osr, std::move(t), &waiter);
-      bool cont = dstate->pause_clearing();
+      cont = dstate->pause_clearing();
       handle.suspend_tp_timeout();
       waiter.wait();
       handle.reset_tp_timeout();
@@ -4510,14 +4513,16 @@ bool remove_dir(
       num = 0;
     }
   }
-  C_SaferCond waiter;
-  store->queue_transaction(osr, std::move(t), &waiter);
-  bool cont = dstate->pause_clearing();
-  handle.suspend_tp_timeout();
-  waiter.wait();
-  handle.reset_tp_timeout();
-  if (cont)
-    cont = dstate->resume_clearing();
+  if (num) {
+    C_SaferCond waiter;
+    store->queue_transaction(osr, std::move(t), &waiter);
+    cont = dstate->pause_clearing();
+    handle.suspend_tp_timeout();
+    waiter.wait();
+    handle.reset_tp_timeout();
+    if (cont)
+      cont = dstate->resume_clearing();
+  }
   // whether there are more objects to remove in the collection
   *finished = next.is_max();
   return cont;