Skip to content

Commit

Permalink
crimson/os/seastore/rbm: add assert to check if bptr is page-aligned
Browse files Browse the repository at this point in the history
Signed-off-by: Myoungwon Oh <[email protected]>
  • Loading branch information
myoungwon committed Sep 16, 2024
1 parent 3bc36d1 commit 8fccda9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ BlockRBManager::write_ertr::future<> BlockRBManager::write(
bufferptr bptr)
{
ceph_assert(device);
ceph_assert(bptr.is_page_aligned());
rbm_abs_addr addr = convert_paddr_to_abs_addr(paddr);
if (!check_valid_range(addr, bptr)) {
return crimson::ct_error::erange::make();
Expand All @@ -146,6 +147,7 @@ BlockRBManager::read_ertr::future<> BlockRBManager::read(
bufferptr &bptr)
{
ceph_assert(device);
ceph_assert(bptr.is_page_aligned());
rbm_abs_addr addr = convert_paddr_to_abs_addr(paddr);
if (!check_valid_range(addr, bptr)) {
return crimson::ct_error::erange::make();
Expand Down
4 changes: 3 additions & 1 deletion src/test/crimson/seastore/test_randomblock_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ struct rbm_test_t :
std::numeric_limits<char>::max()
);
char contents = distribution(generator);
return buffer::ptr(buffer::create(blocks * block_size, contents));
auto bp = bufferptr(ceph::buffer::create_page_aligned(blocks * block_size));
memset(bp.c_str(), contents, bp.length());
return bp;
}

void close() {
Expand Down

0 comments on commit 8fccda9

Please sign in to comment.