]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Move Int64ArrayMergeOperator from BlueStore.cc to
authorAbutalib Aghayev <agayev@cs.cmu.edu>
Tue, 30 Jun 2020 16:54:40 +0000 (12:54 -0400)
committerAbutalib Aghayev <agayev@cs.cmu.edu>
Tue, 30 Jun 2020 16:54:40 +0000 (12:54 -0400)
bluestore_common.h

Int64ArrayMergeOperator will be used by ZonedFreelistManager as well.

Signed-off-by: Abutalib Aghayev <agayev@cs.cmu.edu>
src/os/bluestore/BlueStore.cc
src/os/bluestore/bluestore_common.h

index e65c584583d86b755ac70b2a3c272c1127614d61..3cf0ba95e6d9d3a51044ca2c2946d9ae96937d05 100644 (file)
@@ -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)
index 858cfd88fc5eeeb9eeb508a6d5ed059351c5b0da..f61a5dcfdc30287d0c1b4a19e5f024decee92bd0 100755 (executable)
@@ -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