]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/seastore: put ObjectDataHandler instance into do_with 44933/head
authorchunmei-liu <chunmei.liu@intel.com>
Wed, 16 Feb 2022 03:13:15 +0000 (19:13 -0800)
committerchunmei-liu <chunmei.liu@intel.com>
Thu, 17 Feb 2022 17:18:55 +0000 (09:18 -0800)
make ObjectDataHandler instance alive before sub functions are resolved.

Signed-off-by: chunmei-liu <chunmei.liu@intel.com>
src/crimson/os/seastore/seastore.cc

index 0323f81e956e6404b99550cd3de1fe72910b5347..3c17d90be196adf1567fb8b4a79851d7692422e4 100644 (file)
@@ -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,
@@ -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(