summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2013-04-01 14:51:46 -0700
committerJosh Durgin <josh.durgin@inktank.com>2013-04-10 11:47:20 -0700
commitf5b81d8d167d1aa7f82a5776bbb1f319063ab809 (patch)
tree0ddade1986d594f6343e3eda2cd1e84f6fa00c6a
parent4b656730ffff21132f358c2b9a63504dfbf0998d (diff)
downloadceph-f5b81d8d167d1aa7f82a5776bbb1f319063ab809.tar.gz
ObjectCacher: deduplicate final part of flush_set()
Both versions of flush_set() did the same thing. Move it into a helper called from both. Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r--src/osdc/ObjectCacher.cc37
-rw-r--r--src/osdc/ObjectCacher.h1
2 files changed, 19 insertions, 19 deletions
diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc
index 18a85c0b866..92f0d502746 100644
--- a/src/osdc/ObjectCacher.cc
+++ b/src/osdc/ObjectCacher.cc
@@ -1495,6 +1495,20 @@ bool ObjectCacher::flush(Object *ob, loff_t offset, loff_t length)
return clean;
}
+bool ObjectCacher::_flush_set_finish(C_GatherBuilder *gather, Context *onfinish)
+{
+ assert(lock.is_locked());
+ if (gather->has_subs()) {
+ gather->set_finisher(onfinish);
+ gather->activate();
+ return false;
+ }
+
+ ldout(cct, 10) << "flush_set has no dirty|tx bhs" << dendl;
+ onfinish->complete(0);
+ return true;
+}
+
// flush. non-blocking, takes callback.
// returns true if already flushed
bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish)
@@ -1526,15 +1540,7 @@ bool ObjectCacher::flush_set(ObjectSet *oset, Context *onfinish)
}
}
- 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 _flush_set_finish(&gather, onfinish);
}
// flush. non-blocking, takes callback.
@@ -1549,7 +1555,8 @@ bool ObjectCacher::flush_set(ObjectSet *oset, vector<ObjectExtent>& exv, Context
return true;
}
- ldout(cct, 10) << "flush_set " << oset << " on " << exv.size() << " ObjectExtents" << dendl;
+ ldout(cct, 10) << "flush_set " << oset << " on " << exv.size()
+ << " ObjectExtents" << dendl;
// we'll need to wait for all objects to flush!
C_GatherBuilder gather(cct);
@@ -1573,15 +1580,7 @@ bool ObjectCacher::flush_set(ObjectSet *oset, vector<ObjectExtent>& exv, Context
}
}
- 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 _flush_set_finish(&gather, onfinish);
}
void ObjectCacher::purge_set(ObjectSet *oset)
diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h
index 681b02406fa..a17046f9126 100644
--- a/src/osdc/ObjectCacher.h
+++ b/src/osdc/ObjectCacher.h
@@ -573,6 +573,7 @@ private:
int _wait_for_write(OSDWrite *wr, uint64_t len, ObjectSet *oset, Mutex& lock,
Context *onfreespace);
void maybe_wait_for_writeback(uint64_t len);
+ bool _flush_set_finish(C_GatherBuilder *gather, Context *onfinish);
public:
bool set_is_cached(ObjectSet *oset);