osdc/ObjectCacher: take Object ref when there are buffers

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2012-10-23 05:55:50 -07:00
parent a34a8b8bae
commit 57e18a74fe

View File

@ -251,12 +251,16 @@ class ObjectCacher {
// bh
// add to my map
void add_bh(BufferHead *bh) {
if (data.empty())
get();
assert(data.count(bh->start()) == 0);
data[bh->start()] = bh;
}
void remove_bh(BufferHead *bh) {
assert(data.count(bh->start()));
data.erase(bh->start());
if (data.empty())
put();
}
bool is_empty() { return data.empty(); }