]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ObjectCacher: remove unneeded var from flush_set()
authorJosh Durgin <josh.durgin@inktank.com>
Thu, 28 Mar 2013 17:34:37 +0000 (10:34 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Thu, 28 Mar 2013 17:46:59 +0000 (10:46 -0700)
The gather will only have subs if there is something to flush. Remove
the safe variable, which indicates the same thing, and convert the
conditionals that used it to an else branch. Movinig gather.activate()
inside the has_subs() check has no effect since activate() does
nothing when there are no subs.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/osdc/ObjectCacher.cc

index ddde36818c245f32ef72d0dc1d43ff8d0a396376..18a85c0b866560de2a9b9e87a5f825db2128c078 100644 (file)
@@ -1512,15 +1512,12 @@ bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish)
   // we'll need to wait for all objects to flush!
   C_GatherBuilder gather(cct);
 
-  bool safe = true;
   for (xlist<Object*>::iterator i = oset->objects.begin();
        !i.end(); ++i) {
     Object *ob = *i;
 
     if (!flush(ob, 0, 0)) {
       // we'll need to gather...
-      safe = false;
-
       ldout(cct, 10) << "flush_set " << oset << " will wait for ack tid " 
                << ob->last_write_tid 
                << " on " << *ob
@@ -1528,16 +1525,16 @@ bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish)
       ob->waitfor_commit[ob->last_write_tid].push_back(gather.new_sub());
     }
   }
-  if (gather.has_subs())
+
+  if (gather.has_subs()) {
     gather.set_finisher(onfinish);
-  gather.activate();
-  
-  if (safe) {
+    gather.activate();
+    return false;
+  } else {
     ldout(cct, 10) << "flush_set " << oset << " has no dirty|tx bhs" << dendl;
     onfinish->complete(0);
     return true;
   }
-  return false;
 }
 
 // flush.  non-blocking, takes callback.
@@ -1557,7 +1554,6 @@ bool ObjectCacher::flush_set(ObjectSet *oset, vector<ObjectExtent>& exv, Context
   // we'll need to wait for all objects to flush!
   C_GatherBuilder gather(cct);
 
-  bool safe = true;
   for (vector<ObjectExtent>::iterator p = exv.begin();
        p != exv.end();
        ++p) {
@@ -1571,23 +1567,21 @@ bool ObjectCacher::flush_set(ObjectSet *oset, vector<ObjectExtent>& exv, Context
 
     if (!flush(ob, ex.offset, ex.length)) {
       // we'll need to gather...
-      safe = false;
-
       ldout(cct, 10) << "flush_set " << oset << " will wait for ack tid " 
                     << ob->last_write_tid << " on " << *ob << dendl;
       ob->waitfor_commit[ob->last_write_tid].push_back(gather.new_sub());
     }
   }
-  if (gather.has_subs())
-    gather.set_finisher(onfinish);
-  gather.activate();
 
-  if (safe) {
+  if (gather.has_subs()) {
+    gather.set_finisher(onfinish);
+    gather.activate();
+    return false;
+  } else {
     ldout(cct, 10) << "flush_set " << oset << " has no dirty|tx bhs" << dendl;
     onfinish->complete(0);
     return true;
   }
-  return false;
 }
 
 void ObjectCacher::purge_set(ObjectSet *oset)