From 835ddb7303bc2b726360b6c2717c03ca2f309f9e Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Fri, 21 May 2021 14:00:02 +0900 Subject: [PATCH] seastore: use deltas to deliver allocated info 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 --- src/crimson/os/seastore/cache.cc | 12 ++++++------ src/crimson/os/seastore/seastore_types.h | 12 ++++++++---- src/crimson/os/seastore/transaction.h | 6 +++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index 751d362cfc4..9b895900437 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -314,12 +314,12 @@ std::optional 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(std::move(record)); diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index 0a4ea3607b7..46383168cc3 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -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_ids; - blk_paddr_t addr; - ceph::bufferlist bl; + interval_set alloc_blk_ids; + op_types_t op; }; } diff --git a/src/crimson/os/seastore/transaction.h b/src/crimson/os/seastore/transaction.h index 40e4c379c0e..941e61bb127 100644 --- a/src/crimson/os/seastore/transaction.h +++ b/src/crimson/os/seastore/transaction.h @@ -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 allocated_blocks; + std::vector allocated_blocks; public: Transaction( -- 2.39.5