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.60~3^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=553aaac8a19e2359acf6d9d2e1bb4ef0bdba7801;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 --- diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index ddde36818c24..18a85c0b8665 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -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::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& 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) { @@ -1571,23 +1567,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)