From ee7bf281005cce671e467ca9b9eff0ba7eb9899e Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Fri, 22 Mar 2013 12:17:43 -0700 Subject: [PATCH] ObjectCacher: remove NULL checks in flush_set() Callers will always pass a callback, so assert this and remove the checks for it being NULL. Signed-off-by: Josh Durgin (cherry picked from commit 41568b904de6d155e5ee87c68e9c31cbb69508e5) --- src/osdc/ObjectCacher.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index c33d7fd4f91dd..40ff1d1b51106 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -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& 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& 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); -- 2.39.5