CLS_LOG(10, "inc ref oid=%s\n",
op.source.oid.name.c_str());
- if (!objr.get(op.source)) {
- // we could perhaps return -EEXIST here, but instead we will
- // behave in an idempotent fashion, since we know that it is possible
- // for references to be leaked. If A has a ref, tries to drop it and
- // fails (leaks), and then later tries to take it again, we should
- // simply succeed if we know we already have it. This will serve to
- // silently correct the mistake.
- return 0;
- }
+ objr.get(op.source);
ret = chunk_set_refcount(hctx, objr);
if (ret < 0) {
// existing chunk; inc ref
CLS_LOG(10, "oid=%s\n", op.source.oid.name.c_str());
- if (!objr.get(op.source)) {
- // we could perhaps return -EEXIST here, but instead we will
- // behave in an idempotent fashion, since we know that it is possible
- // for references to be leaked. If A has a ref, tries to drop it and
- // fails (leaks), and then later tries to take it again, we should
- // simply succeed if we know we already have it. This will serve to
- // silently correct the mistake.
- return 0;
- }
+ objr.get(op.source);
ret = chunk_set_refcount(hctx, objr);
if (ret < 0) {
virtual uint8_t get_type() const = 0;
virtual bool empty() const = 0;
virtual uint64_t count() const = 0;
- virtual bool get(const hobject_t& o) = 0;
+ virtual void get(const hobject_t& o) = 0;
virtual bool put(const hobject_t& o) = 0;
virtual void dump(Formatter *f) const = 0;
virtual std::string describe_encoding() const {
return r->count();
}
- bool get(const hobject_t& o) {
- return r->get(o);
+ void get(const hobject_t& o) {
+ r->get(o);
}
bool put(const hobject_t& o) {
bool ret = r->put(o);
uint64_t count() const override {
return by_object.size();
}
- bool get(const hobject_t& o) override {
+ void get(const hobject_t& o) override {
by_object.insert(o);
- return true;
}
bool put(const hobject_t& o) override {
auto p = by_object.find(o);
uint64_t count() const override {
return total;
}
- bool get(const hobject_t& o) override {
+ void get(const hobject_t& o) override {
by_hash[make_pair(o.pool, o.get_hash() & mask())]++;
++total;
- return true;
}
bool put(const hobject_t& o) override {
auto p = by_hash.find(make_pair(o.pool, o.get_hash() & mask()));
uint64_t count() const override {
return total;
}
- bool get(const hobject_t& o) override {
+ void get(const hobject_t& o) override {
++by_pool[o.pool];
++total;
- return true;
}
bool put(const hobject_t& o) override {
auto p = by_pool.find(o.pool);
uint64_t count() const override {
return total;
}
- bool get(const hobject_t& o) override {
+ void get(const hobject_t& o) override {
++total;
- return true;
}
bool put(const hobject_t& o) override {
if (!total) {
for (size_t i = 1; i <= max; ++i) {
hobject_t h(sobject_t(object_t("foo"s + stringify(i)), i));
h.pool = i > pool_cutoff ? i : (i & pool_mask);
- bool ret = r.get(h);
- ASSERT_TRUE(ret);
+ r.get(h);
if (count_bits(i) <= 2) {
bufferlist bl;
r.dynamic_encode(bl, 512);