summaryrefslogtreecommitdiffstats
path: root/src/crimson
diff options
context:
space:
mode:
authorZhang Song <zhangsong02@qianxin.com>2024-08-22 14:54:03 +0200
committerZhang Song <zhangsong02@qianxin.com>2024-08-23 13:19:38 +0200
commitb2d604e581d993ac1fa9b02a8abe33fe4336853d (patch)
treeca303f582fcdd9f702adc415cf9b787fae68471c /src/crimson
parentcrimson/os/seastore: remove laddr_t alignment check (diff)
downloadceph-b2d604e581d993ac1fa9b02a8abe33fe4336853d.tar.xz
ceph-b2d604e581d993ac1fa9b02a8abe33fe4336853d.zip
crimson/os/seastore: construct laddr_t explicitly
Signed-off-by: Zhang Song <zhangsong02@qianxin.com>
Diffstat (limited to 'src/crimson')
-rw-r--r--src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h3
-rw-r--r--src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h6
-rw-r--r--src/crimson/tools/store_nbd/tm_driver.cc10
3 files changed, 10 insertions, 9 deletions
diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h
index ab5971dfe5f..df2e5fe7503 100644
--- a/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h
+++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h
@@ -150,7 +150,8 @@ class DummyNodeExtentManager final: public NodeExtentManager {
Transaction& t, extent_len_t len) {
assert(len % ALIGNMENT == 0);
auto r = ceph::buffer::create_aligned(len, ALIGNMENT);
- auto addr = laddr_t(reinterpret_cast<laddr_t::Unsigned>(r->get_data()));
+ auto addr = laddr_t::from_byte_offset(
+ reinterpret_cast<laddr_t::Unsigned>(r->get_data()));
auto bp = ceph::bufferptr(std::move(r));
auto extent = Ref<DummyNodeExtent>(new DummyNodeExtent(std::move(bp)));
extent->set_laddr(addr);
diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h
index 18ebb039f89..b40f7a061a8 100644
--- a/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h
+++ b/src/crimson/os/seastore/onode_manager/staged-fltree/stages/key_layout.h
@@ -46,9 +46,9 @@ static laddr_t get_lba_hint(shard_t shard, pool_t pool, crush_hash_t crush) {
// FIXME: It is possible that PGs from different pools share the same prefix
// if the mask 0xFF is not long enough, result in unexpected transaction
// conflicts.
- return laddr_t((uint64_t)(shard & 0xFF)<<56 |
- (uint64_t)(pool & 0xFF)<<48 |
- (uint64_t)(crush )<<16);
+ return laddr_t::from_raw_uint((uint64_t)(shard & 0xFF)<<56 |
+ (uint64_t)(pool & 0xFF)<<48 |
+ (uint64_t)(crush )<<16);
}
struct node_offset_packed_t {
diff --git a/src/crimson/tools/store_nbd/tm_driver.cc b/src/crimson/tools/store_nbd/tm_driver.cc
index 860ce517db8..44c62fe8b22 100644
--- a/src/crimson/tools/store_nbd/tm_driver.cc
+++ b/src/crimson/tools/store_nbd/tm_driver.cc
@@ -27,20 +27,20 @@ seastar::future<> TMDriver::write(
"write",
[this, offset, &ptr](auto& t)
{
- return tm->remove(t, laddr_t(offset)
+ return tm->remove(t, laddr_t::from_byte_offset(offset)
).discard_result().handle_error_interruptible(
crimson::ct_error::enoent::handle([](auto) { return seastar::now(); }),
crimson::ct_error::pass_further_all{}
).si_then([this, offset, &t, &ptr] {
logger().debug("dec_ref complete");
- return tm->alloc_data_extents<TestBlock>(t, laddr_t(offset), ptr.length());
+ return tm->alloc_data_extents<TestBlock>(t, laddr_t::from_byte_offset(offset), ptr.length());
}).si_then([this, offset, &t, &ptr](auto extents) mutable {
boost::ignore_unused(offset); // avoid clang warning;
auto off = offset;
auto left = ptr.length();
size_t written = 0;
for (auto &ext : extents) {
- assert(ext->get_laddr() == laddr_t(off));
+ assert(ext->get_laddr() == laddr_t::from_byte_offset(off));
assert(ext->get_bptr().length() <= left);
ptr.copy_out(written, ext->get_length(), ext->get_bptr().c_str());
off += ext->get_length();
@@ -111,9 +111,9 @@ seastar::future<bufferlist> TMDriver::read(
"read",
[=, &blret, this](auto& t)
{
- return read_extents(t, laddr_t(offset), size
+ return read_extents(t, laddr_t::from_byte_offset(offset), size
).si_then([=, &blret](auto ext_list) {
- laddr_t cur(offset);
+ auto cur = laddr_t::from_byte_offset(offset);
for (auto &i: ext_list) {
if (cur != i.first) {
assert(cur < i.first);