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 <myoungwon.oh@samsung.com>
This commit is contained in:
myoungwon oh 2021-05-21 14:00:02 +09:00
parent 70bced5b17
commit 835ddb7303
3 changed files with 17 additions and 13 deletions

View 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));

View 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;
};
}

View 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(