]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ObjectCacher: remove NULL checks in flush_set()
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 22 Mar 2013 19:17:43 +0000 (12:17 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Tue, 23 Apr 2013 18:33:18 +0000 (11:33 -0700)
Callers will always pass a callback, so assert this and remove the
checks for it being NULL.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit 41568b904de6d155e5ee87c68e9c31cbb69508e5)

src/osdc/ObjectCacher.cc

index c33d7fd4f91ddc0248373d0576bf83d055616a65..40ff1d1b51106c647176e885ad42da7534ac0904 100644 (file)
@@ -1501,6 +1501,7 @@ bool ObjectCacher::flush(Object *ob, loff_t offset, loff_t length)
 bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish)
 {
   assert(lock.is_locked());
+  assert(onfinish != NULL);
   if (oset->objects.empty()) {
     ldout(cct, 10) << "flush_set on " << oset << " dne" << dendl;
     onfinish->complete(0);
@@ -1525,14 +1526,12 @@ bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish)
                << ob->last_write_tid 
                << " on " << *ob
                << dendl;
-      if (onfinish != NULL)
-        ob->waitfor_commit[ob->last_write_tid].push_back(gather.new_sub());
+      ob->waitfor_commit[ob->last_write_tid].push_back(gather.new_sub());
     }
   }
   if (gather.has_subs())
     gather.set_finisher(onfinish);
-  if (onfinish != NULL)
-    gather.activate();
+  gather.activate();
   
   if (safe) {
     ldout(cct, 10) << "flush_set " << oset << " has no dirty|tx bhs" << dendl;
@@ -1547,6 +1546,7 @@ bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish)
 bool ObjectCacher::flush_set(ObjectSet *oset, vector<ObjectExtent>& exv, Context *onfinish)
 {
   assert(lock.is_locked());
+  assert(onfinish != NULL);
   if (oset->objects.empty()) {
     ldout(cct, 10) << "flush_set on " << oset << " dne" << dendl;
     onfinish->complete(0);
@@ -1576,15 +1576,13 @@ bool ObjectCacher::flush_set(ObjectSet *oset, vector<ObjectExtent>& exv, Context
 
       ldout(cct, 10) << "flush_set " << oset << " will wait for ack tid " 
                     << ob->last_write_tid << " on " << *ob << dendl;
-      if (onfinish != NULL)
-        ob->waitfor_commit[ob->last_write_tid].push_back(gather.new_sub());
+      ob->waitfor_commit[ob->last_write_tid].push_back(gather.new_sub());
     }
   }
   if (gather.has_subs())
     gather.set_finisher(onfinish);
-  if (onfinish != NULL)
-    gather.activate();
-  
+  gather.activate();
+
   if (safe) {
     ldout(cct, 10) << "flush_set " << oset << " has no dirty|tx bhs" << dendl;
     onfinish->complete(0);