mirror of
https://github.com/ceph/ceph
synced 2025-02-24 19:47:44 +00:00
os/bluestore: Move Int64ArrayMergeOperator from BlueStore.cc to
bluestore_common.h Int64ArrayMergeOperator will be used by ZonedFreelistManager as well. Signed-off-by: Abutalib Aghayev <agayev@cs.cmu.edu>
This commit is contained in:
parent
ef71436bab
commit
efe1cd410a
@ -23,8 +23,8 @@
|
||||
|
||||
#include "include/cpp-btree/btree_set.h"
|
||||
|
||||
#include "bluestore_common.h"
|
||||
#include "BlueStore.h"
|
||||
#include "bluestore_common.h"
|
||||
#include "os/kv.h"
|
||||
#include "include/compat.h"
|
||||
#include "include/intarith.h"
|
||||
@ -582,35 +582,6 @@ void _dump_transaction(CephContext *cct, ObjectStore::Transaction *t)
|
||||
*_dout << dendl;
|
||||
}
|
||||
|
||||
// merge operators
|
||||
|
||||
struct Int64ArrayMergeOperator : public KeyValueDB::MergeOperator {
|
||||
void merge_nonexistent(
|
||||
const char *rdata, size_t rlen, std::string *new_value) override {
|
||||
*new_value = std::string(rdata, rlen);
|
||||
}
|
||||
void merge(
|
||||
const char *ldata, size_t llen,
|
||||
const char *rdata, size_t rlen,
|
||||
std::string *new_value) override {
|
||||
ceph_assert(llen == rlen);
|
||||
ceph_assert((rlen % 8) == 0);
|
||||
new_value->resize(rlen);
|
||||
const ceph_le64* lv = (const ceph_le64*)ldata;
|
||||
const ceph_le64* rv = (const ceph_le64*)rdata;
|
||||
ceph_le64* nv = &(ceph_le64&)new_value->at(0);
|
||||
for (size_t i = 0; i < rlen >> 3; ++i) {
|
||||
nv[i] = lv[i] + rv[i];
|
||||
}
|
||||
}
|
||||
// We use each operator name and each prefix to construct the
|
||||
// overall RocksDB operator name for consistency check at open time.
|
||||
const char *name() const override {
|
||||
return "int64_array";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Buffer
|
||||
|
||||
ostream& operator<<(ostream& out, const BlueStore::Buffer& b)
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "include/intarith.h"
|
||||
#include "include/ceph_assert.h"
|
||||
#include "kv/KeyValueDB.h"
|
||||
|
||||
template <class Bitset, class Func>
|
||||
void apply_for_bitset_range(uint64_t off,
|
||||
@ -33,4 +34,32 @@ void apply_for_bitset_range(uint64_t off,
|
||||
}
|
||||
}
|
||||
|
||||
// merge operators
|
||||
|
||||
struct Int64ArrayMergeOperator : public KeyValueDB::MergeOperator {
|
||||
void merge_nonexistent(
|
||||
const char *rdata, size_t rlen, std::string *new_value) override {
|
||||
*new_value = std::string(rdata, rlen);
|
||||
}
|
||||
void merge(
|
||||
const char *ldata, size_t llen,
|
||||
const char *rdata, size_t rlen,
|
||||
std::string *new_value) override {
|
||||
ceph_assert(llen == rlen);
|
||||
ceph_assert((rlen % 8) == 0);
|
||||
new_value->resize(rlen);
|
||||
const ceph_le64* lv = (const ceph_le64*)ldata;
|
||||
const ceph_le64* rv = (const ceph_le64*)rdata;
|
||||
ceph_le64* nv = &(ceph_le64&)new_value->at(0);
|
||||
for (size_t i = 0; i < rlen >> 3; ++i) {
|
||||
nv[i] = lv[i] + rv[i];
|
||||
}
|
||||
}
|
||||
// We use each operator name and each prefix to construct the
|
||||
// overall RocksDB operator name for consistency check at open time.
|
||||
const char *name() const override {
|
||||
return "int64_array";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user