Skip to content

Commit 520c8df

Browse files
authored
Merge pull request ceph#58356 from xxhdx1985126/wip-seastore-onode-name
crimson/os/seastore/onode: add hobject_t into Onode Reviewed-by: Yingxin Cheng <[email protected]>
2 parents 6f5a6f4 + 8f58b86 commit 520c8df

File tree

8 files changed

+23
-11
lines changed

8 files changed

+23
-11
lines changed

src/crimson/os/seastore/onode.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ std::ostream& operator<<(std::ostream &out, const Onode &rhs)
1010
{
1111
auto &layout = rhs.get_layout();
1212
return out << "Onode("
13+
<< "hobj=" << rhs.hobj << ", "
1314
<< "size=" << static_cast<uint32_t>(layout.size)
1415
<< ")";
1516
}

src/crimson/os/seastore/onode.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <boost/intrusive_ptr.hpp>
99
#include <boost/smart_ptr/intrusive_ref_counter.hpp>
1010

11+
#include "common/hobject.h"
1112
#include "include/byteorder.h"
1213
#include "seastore_types.h"
1314

@@ -56,10 +57,12 @@ class Onode : public boost::intrusive_ref_counter<
5657
virtual laddr_t get_hint() const = 0;
5758
const uint32_t default_metadata_offset = 0;
5859
const uint32_t default_metadata_range = 0;
60+
const hobject_t hobj;
5961
public:
60-
Onode(uint32_t ddr, uint32_t dmr)
62+
Onode(uint32_t ddr, uint32_t dmr, const hobject_t &hobj)
6163
: default_metadata_offset(ddr),
62-
default_metadata_range(dmr)
64+
default_metadata_range(dmr),
65+
hobj(hobj)
6366
{}
6467

6568
virtual bool is_alive() const = 0;
@@ -85,6 +88,7 @@ class Onode : public boost::intrusive_ref_counter<
8588
laddr_t get_data_hint() const {
8689
return get_hint();
8790
}
91+
friend std::ostream& operator<<(std::ostream &out, const Onode &rhs);
8892
};
8993

9094

src/crimson/os/seastore/onode_manager/staged-fltree/fltree_onode_manager.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ FLTreeOnodeManager::get_onode_ret FLTreeOnodeManager::get_onode(
151151
auto val = OnodeRef(new FLTreeOnode(
152152
default_data_reservation,
153153
default_metadata_range,
154+
hoid.hobj,
154155
cursor.value()));
155156
return get_onode_iertr::make_ready_future<OnodeRef>(
156157
val
@@ -173,6 +174,7 @@ FLTreeOnodeManager::get_or_create_onode(
173174
auto onode = new FLTreeOnode(
174175
default_data_reservation,
175176
default_metadata_range,
177+
hoid.hobj,
176178
cursor.value());
177179
if (created) {
178180
DEBUGT("created onode for entry for {}", trans, hoid);

src/crimson/os/seastore/onode_manager/staged-fltree/fltree_onode_manager.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ struct FLTreeOnode final : Onode, Value {
3636
FLTreeOnode& operator=(const FLTreeOnode&) = delete;
3737

3838
template <typename... T>
39-
FLTreeOnode(uint32_t ddr, uint32_t dmr, T&&... args)
40-
: Onode(ddr, dmr),
39+
FLTreeOnode(uint32_t ddr, uint32_t dmr, const hobject_t &hobj, T&&... args)
40+
: Onode(ddr, dmr, hobj),
4141
Value(std::forward<T>(args)...) {}
4242

4343
template <typename... T>
44-
FLTreeOnode(T&&... args)
45-
: Onode(0, 0),
44+
FLTreeOnode(const hobject_t &hobj, T&&... args)
45+
: Onode(0, 0, hobj),
4646
Value(std::forward<T>(args)...) {}
4747

4848
struct Recorder : public ValueDeltaRecorder {

src/crimson/os/seastore/onode_manager/staged-fltree/tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class Btree {
9292
ValueImpl value() {
9393
assert(!is_end());
9494
return p_tree->value_builder.build_value(
95-
*p_tree->nm, p_tree->value_builder, p_cursor);
95+
get_ghobj().hobj, *p_tree->nm, p_tree->value_builder, p_cursor);
9696
}
9797

9898
bool operator==(const Cursor& o) const { return operator<=>(o) == 0; }

src/crimson/os/seastore/onode_manager/staged-fltree/value.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,12 @@ struct ValueBuilderImpl final : public ValueBuilder {
312312
return ret;
313313
}
314314

315-
ValueImpl build_value(NodeExtentManager& nm,
315+
ValueImpl build_value(const hobject_t &hobj,
316+
NodeExtentManager& nm,
316317
const ValueBuilder& vb,
317318
Ref<tree_cursor_t>& p_cursor) const {
318319
assert(vb.get_header_magic() == get_header_magic());
319-
return ValueImpl(nm, vb, p_cursor);
320+
return ValueImpl(hobj, nm, vb, p_cursor);
320321
}
321322
};
322323

src/test/crimson/seastore/onode_tree/test_value.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ class TestValue final : public Value {
176176
}
177177
};
178178

179-
TestValue(NodeExtentManager& nm, const ValueBuilder& vb, Ref<tree_cursor_t>& p_cursor)
179+
TestValue(
180+
const hobject_t &hobj,
181+
NodeExtentManager& nm,
182+
const ValueBuilder& vb,
183+
Ref<tree_cursor_t>& p_cursor)
180184
: Value(nm, vb, p_cursor) {}
181185
~TestValue() override = default;
182186

src/test/crimson/seastore/test_object_data_handler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TestOnode final : public Onode {
2626
bool dirty = false;
2727

2828
public:
29-
TestOnode(uint32_t ddr, uint32_t dmr) : Onode(ddr, dmr) {}
29+
TestOnode(uint32_t ddr, uint32_t dmr) : Onode(ddr, dmr, hobject_t()) {}
3030
const onode_layout_t &get_layout() const final {
3131
return layout;
3232
}

0 commit comments

Comments
 (0)