]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PrimaryLogPG: define soid just before using it
authorEnming Zhang <enming.zhang@umcloud.com>
Wed, 13 Dec 2017 14:32:32 +0000 (22:32 +0800)
committerEnming Zhang <enming.zhang@umcloud.com>
Wed, 13 Dec 2017 14:32:32 +0000 (22:32 +0800)
Define the soid just before using it to avoid a redundant
definition if an error happens and function prepare_transaction
returns directly.

Signed-off-by: Enming Zhang <enming.zhang@umcloud.com>
src/osd/PrimaryLogPG.cc

index 3f75eb5d443a46fa51b21a0e93169df697b51f1f..a658abfbf5b9ae6c16f1b15c48a9a6686d38d788 100644 (file)
@@ -7756,8 +7756,6 @@ int PrimaryLogPG::prepare_transaction(OpContext *ctx)
 {
   assert(!ctx->ops->empty());
 
-  const hobject_t& soid = ctx->obs->oi.soid;
-
   // valid snap context?
   if (!ctx->snapc.is_valid()) {
     dout(10) << " invalid snapc " << ctx->snapc << dendl;
@@ -7808,6 +7806,7 @@ int PrimaryLogPG::prepare_transaction(OpContext *ctx)
     }
   }
 
+  const hobject_t& soid = ctx->obs->oi.soid;
   // clone, if necessary
   if (soid.snap == CEPH_NOSNAP)
     make_writeable(ctx);