]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/os/filestore/HashIndex.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / os / filestore / HashIndex.h
index db76abbb4d41272bb4eee10c1243b74d2f92d4b7..7e34d155996004b4d33bae646a151fe36fb13618 100644 (file)
@@ -44,7 +44,7 @@ extern string reverse_hexdigit_bits_string(string l);
  * would be located in (root)/2/D/0/
  *
  * Subdirectories are created when the number of objects in a
- * directory exceed 16 * (abs(merge_threshhold)) * split_multiplier +
+ * directory exceed 16 * (abs(merge_threshhold) * split_multiplier +
  * split_rand_factor). The number of objects in a directory is encoded
  * as subdir_info_s in an xattr on the directory.
  */
@@ -84,21 +84,23 @@ private:
 
     void encode(bufferlist &bl) const
     {
+      using ceph::encode;
       __u8 v = 1;
-      ::encode(v, bl);
-      ::encode(objs, bl);
-      ::encode(subdirs, bl);
-      ::encode(hash_level, bl);
+      encode(v, bl);
+      encode(objs, bl);
+      encode(subdirs, bl);
+      encode(hash_level, bl);
     }
 
-    void decode(bufferlist::iterator &bl)
+    void decode(bufferlist::const_iterator &bl)
     {
+      using ceph::decode;
       __u8 v;
-      ::decode(v, bl);
-      assert(v == 1);
-      ::decode(objs, bl);
-      ::decode(subdirs, bl);
-      ::decode(hash_level, bl);
+      decode(v, bl);
+      ceph_assert(v == 1);
+      decode(objs, bl);
+      decode(subdirs, bl);
+      decode(hash_level, bl);
     }
   };
 
@@ -107,15 +109,17 @@ private:
     settings_s() : split_rand_factor(0) {}
     void encode(bufferlist &bl) const
     {
+      using ceph::encode;
       __u8 v = 1;
-      ::encode(v, bl);
-      ::encode(split_rand_factor, bl);
+      encode(v, bl);
+      encode(split_rand_factor, bl);
     }
-    void decode(bufferlist::iterator &bl)
+    void decode(bufferlist::const_iterator &bl)
     {
+      using ceph::decode;
       __u8 v;
-      ::decode(v, bl);
-      ::decode(split_rand_factor, bl);
+      decode(v, bl);
+      decode(split_rand_factor, bl);
     }
   } settings;
 
@@ -130,7 +134,7 @@ private:
     InProgressOp(int op, const vector<string> &path)
       : op(op), path(path) {}
 
-    explicit InProgressOp(bufferlist::iterator &bl) {
+    explicit InProgressOp(bufferlist::const_iterator &bl) {
       decode(bl);
     }
 
@@ -139,18 +143,20 @@ private:
     bool is_merge() const { return op == MERGE; }
 
     void encode(bufferlist &bl) const {
+      using ceph::encode;
       __u8 v = 1;
-      ::encode(v, bl);
-      ::encode(op, bl);
-      ::encode(path, bl);
+      encode(v, bl);
+      encode(op, bl);
+      encode(path, bl);
     }
 
-    void decode(bufferlist::iterator &bl) {
+    void decode(bufferlist::const_iterator &bl) {
+      using ceph::decode;
       __u8 v;
-      ::decode(v, bl);
-      assert(v == 1);
-      ::decode(op, bl);
-      ::decode(path, bl);
+      decode(v, bl);
+      ceph_assert(v == 1);
+      decode(op, bl);
+      decode(path, bl);
     }
   };
 
@@ -161,8 +167,8 @@ public:
     CephContext* cct,
     coll_t collection,     ///< [in] Collection
     const char *base_path, ///< [in] Path to the index root.
-    int merge_at,          ///< [in] Merge threshhold.
-    int split_multiple,           ///< [in] Split threshhold.
+    int merge_at,          ///< [in] Merge threshold.
+    int split_multiple,           ///< [in] Split threshold.
     uint32_t index_version,///< [in] Index version
     double retry_probability=0) ///< [in] retry probability
     : LFNIndex(cct, collection, base_path, index_version, retry_probability),
@@ -188,6 +194,17 @@ public:
     CollectionIndex* dest
     ) override;
 
+  /// @see CollectionIndex
+  int _merge(
+    uint32_t bits,
+    CollectionIndex* dest
+    ) override;
+
+  int _merge_dirs(
+    HashIndex& from,
+    HashIndex& to,
+    const vector<string>& path);
+
   /// @see CollectionIndex
   int apply_layout_settings(int target_level) override;
 
@@ -380,7 +397,7 @@ private:
 
   /// Convert a number to hex string (upper case).
   static string to_hex(int n) {
-    assert(n >= 0 && n < 16);
+    ceph_assert(n >= 0 && n < 16);
     char c = (n <= 9 ? ('0' + n) : ('A' + n - 10));
     string str;
     str.append(1, c);
@@ -389,7 +406,7 @@ private:
 
   struct CmpPairBitwise {
     bool operator()(const pair<string, ghobject_t>& l,
-                   const pair<string, ghobject_t>& r)
+                   const pair<string, ghobject_t>& r) const
     {
       if (l.first < r.first)
        return true;
@@ -402,7 +419,7 @@ private:
   };
 
   struct CmpHexdigitStringBitwise {
-    bool operator()(const string& l, const string& r) {
+    bool operator()(const string& l, const string& r) const {
       return reverse_hexdigit_bits_string(l) < reverse_hexdigit_bits_string(r);
     }
   };