Skip to content

Commit

Permalink
Merge pull request ceph#44782 from liu-chunmei/crimson-fix-content-co…
Browse files Browse the repository at this point in the history
…rrupt

crimson: fix qa/RadosModel content corrupt

reviewed by: Samuel Just <[email protected]>
  • Loading branch information
Liu-Chunmei authored Jan 26, 2022
2 parents b152c05 + a59057a commit 3e23850
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/crimson/os/seastore/object_data_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ ObjectDataHandler::clear_ret ObjectDataHandler::trim_data_reservation(
context_t ctx, object_data_t &object_data, extent_len_t size)
{
ceph_assert(!object_data.is_null());
assert_aligned(size);
ceph_assert(size <= object_data.get_reserved_data_len());
return seastar::do_with(
lba_pin_list_t(),
Expand Down Expand Up @@ -322,7 +321,7 @@ ObjectDataHandler::clear_ret ObjectDataHandler::trim_data_reservation(
return read_pin(
ctx,
pin.duplicate()
).si_then([size, pin_offset, &pin, &object_data, &to_write](
).si_then([ctx, size, pin_offset, &pin, &object_data, &to_write](
auto extent) {
bufferlist bl;
bl.append(
Expand All @@ -331,12 +330,15 @@ ObjectDataHandler::clear_ret ObjectDataHandler::trim_data_reservation(
0,
size - pin_offset
));
bl.append_zero(p2roundup(size, ctx.tm.get_block_size()) - size);
to_write.emplace_back(
pin.get_laddr(),
bl);
to_write.emplace_back(
object_data.get_reserved_data_base() + size,
object_data.get_reserved_data_len() - size);
object_data.get_reserved_data_base() +
p2roundup(size, ctx.tm.get_block_size()),
object_data.get_reserved_data_len() -
p2roundup(size, ctx.tm.get_block_size()));
return clear_iertr::now();
});
}
Expand Down Expand Up @@ -553,7 +555,6 @@ ObjectDataHandler::truncate_ret ObjectDataHandler::truncate(
context_t ctx,
objaddr_t offset)
{
offset = p2roundup(offset, ctx.tm.get_block_size());
return with_object_data(
ctx,
[this, ctx, offset](auto &object_data) {
Expand All @@ -569,7 +570,7 @@ ObjectDataHandler::truncate_ret ObjectDataHandler::truncate(
return prepare_data_reservation(
ctx,
object_data,
offset);
p2roundup(offset, ctx.tm.get_block_size()));
} else {
return truncate_iertr::now();
}
Expand Down

0 comments on commit 3e23850

Please sign in to comment.