]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
seastore: use deltas to deliver allocated info
authormyoungwon oh <ohmyoungwon@gmail.com>
Fri, 21 May 2021 05:00:02 +0000 (14:00 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 15 Jun 2021 02:09:06 +0000 (11:09 +0900)
alloc_extent() will allocates continous blocks (e.g., block 1 ~ 4).
To deliver such informations to journal efficiently,
this commit adds a member variable regarding only modified range in the deltas

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/seastore_types.h
src/crimson/os/seastore/transaction.h

index 751d362cfc47b785c5be565bc1bd3a5306f5634b..9b895900437ee8876ffb66a9416000ef97548a43 100644 (file)
@@ -314,12 +314,12 @@ std::optional<record_t> Cache::try_construct_record(Transaction &t)
   }
 
   for (auto b : t.allocated_blocks) {
-    record.extents.push_back(
-      extent_t{
-      extent_types_t::RBM_ALLOC_INFO,
-       b.addr,
-       std::move(b.bl)
-      });
+    bufferlist bl;
+    encode(b.alloc_blk_ids, bl);
+    delta_info_t delta;
+    delta.type = extent_types_t::RBM_ALLOC_INFO;
+    delta.bl = bl;
+    record.deltas.push_back(delta);
   }
 
   return std::make_optional<record_t>(std::move(record));
index 0a4ea3607b7b1ad3e69ad8a5d29c82d491ce96d4..46383168cc38cee1cb58ccac4548bf0c76c19cf7 100644 (file)
@@ -11,6 +11,7 @@
 #include "include/buffer.h"
 #include "include/cmp.h"
 #include "include/uuid.h"
+#include "include/interval_set.h"
 
 namespace crimson::os::seastore {
 
@@ -676,11 +677,14 @@ constexpr blk_id_t NULL_BLK_ID =
 
 // use absolute address
 using blk_paddr_t = uint64_t;
-struct rbm_extent_t {
+struct rbm_alloc_delta_t {
+  enum class op_types_t : uint8_t {
+    SET = 1,
+    CLEAR = 2
+  };
   extent_types_t type;
-  std::vector<blk_id_t> blk_ids;
-  blk_paddr_t addr;
-  ceph::bufferlist bl;
+  interval_set<blk_id_t> alloc_blk_ids;
+  op_types_t op;
 };
 
 }
index 40e4c379c0e23bbaa0c86e100df773216ddcc7b5..941e61bb127817c839a271d8acc3ee09c794f022 100644 (file)
@@ -116,8 +116,8 @@ public:
     return weak;
   }
 
-  void add_rbm_allocated_blocks(rbm_extent_t &extent) {
-    allocated_blocks.push_back(extent);
+  void add_rbm_allocated_blocks(rbm_alloc_delta_t &d) {
+    allocated_blocks.push_back(d);
   }
   void clear_rbm_allocated_blocks() {
     if (!allocated_blocks.empty()) {
@@ -159,7 +159,7 @@ private:
 
   retired_extent_gate_t::token_t retired_gate_token;
 
-  std::vector<rbm_extent_t> allocated_blocks;
+  std::vector<rbm_alloc_delta_t> allocated_blocks;
 
 public:
   Transaction(