Skip to content

Commit

Permalink
crimson/seastore: put ObjectDataHandler instance into do_with
Browse files Browse the repository at this point in the history
make ObjectDataHandler instance alive before sub functions are resolved.

Signed-off-by: chunmei-liu <chunmei.liu@intel.com>
  • Loading branch information
chunmei-liu committed Feb 17, 2022
1 parent f4e20ee commit bc1e111
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/crimson/os/seastore/seastore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1145,8 +1145,9 @@ SeaStore::tm_ret SeaStore::_write(
}
return seastar::do_with(
std::move(_bl),
[=, &ctx, &onode](auto &bl) {
return ObjectDataHandler(max_object_size).write(
ObjectDataHandler(max_object_size),
[=, &ctx, &onode](auto &bl, auto &objhandler) {
return objhandler.write(
ObjectDataHandler::context_t{
*transaction_manager,
*ctx.transaction,
Expand Down Expand Up @@ -1278,13 +1279,17 @@ SeaStore::tm_ret SeaStore::_truncate(
LOG_PREFIX(SeaStore::_truncate);
DEBUGT("onode={} size={}", *ctx.transaction, *onode, size);
onode->get_mutable_layout(*ctx.transaction).size = size;
return ObjectDataHandler(max_object_size).truncate(
ObjectDataHandler::context_t{
*transaction_manager,
*ctx.transaction,
*onode
},
size);
return seastar::do_with(
ObjectDataHandler(max_object_size),
[=, &ctx, &onode](auto &objhandler) {
return objhandler.truncate(
ObjectDataHandler::context_t{
*transaction_manager,
*ctx.transaction,
*onode
},
size);
});
}

SeaStore::tm_ret SeaStore::_setattrs(
Expand Down

0 comments on commit bc1e111

Please sign in to comment.