From: Josh Durgin Date: Thu, 28 Mar 2013 17:34:37 +0000 (-0700) Subject: ObjectCacher: remove unneeded var from flush_set() X-Git-Tag: v0.56.5~12^2~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3a61d17b6729b73d0bf2df106f54dafb603af646;p=ceph.git ObjectCacher: remove unneeded var from flush_set() 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 (cherry picked from commit 553aaac8a19e2359acf6d9d2e1bb4ef0bdba7801) --- diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index 40ff1d1b5110..1d4fa7d091df 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -1513,15 +1513,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::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 @@ -1529,16 +1526,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. @@ -1558,7 +1555,6 @@ bool ObjectCacher::flush_set(ObjectSet *oset, vector& exv, Context // we'll need to wait for all objects to flush! C_GatherBuilder gather(cct); - bool safe = true; for (vector::iterator p = exv.begin(); p != exv.end(); ++p) { @@ -1572,23 +1568,21 @@ bool ObjectCacher::flush_set(ObjectSet *oset, vector& 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)