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>
}
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));
#include "include/buffer.h"
#include "include/cmp.h"
#include "include/uuid.h"
+#include "include/interval_set.h"
namespace crimson::os::seastore {
// 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;
};
}
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()) {
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(