]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: narrow scope of local variables 11514/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 15 Oct 2016 02:53:43 +0000 (10:53 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 15 Oct 2016 02:57:06 +0000 (10:57 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index eea0b0ed2e5f664e61c576ef1033dce63b09ee84..26b3490126524927b27da10d1b4b90bd6b009cfb 100644 (file)
@@ -8352,7 +8352,6 @@ int BlueStore::_clone(TransContext *txc,
     return -EINVAL;
   }
 
-  bufferlist bl;
   newo->exists = true;
   _assign_nid(txc, newo);
 
@@ -8364,6 +8363,7 @@ int BlueStore::_clone(TransContext *txc,
   if (g_conf->bluestore_clone_cow) {
     _do_clone_range(txc, c, oldo, newo, 0, oldo->onode.size, 0);
   } else {
+    bufferlist bl;
     r = _do_read(c.get(), oldo, 0, oldo->onode.size, bl, 0);
     if (r < 0)
       goto out;
@@ -8391,13 +8391,13 @@ int BlueStore::_clone(TransContext *txc,
     get_omap_tail(oldo->onode.omap_head, &tail);
     it->lower_bound(head);
     while (it->valid()) {
-      string key;
       if (it->key() >= tail) {
        dout(30) << __func__ << "  reached tail" << dendl;
        break;
       } else {
        dout(30) << __func__ << "  got header/data "
                 << pretty_binary_string(it->key()) << dendl;
+        string key;
        rewrite_omap_key(newo->onode.omap_head, it->key(), &key);
        txc->t->set(PREFIX_OMAP, key, it->value());
       }
@@ -8533,7 +8533,6 @@ int BlueStore::_clone_range(TransContext *txc,
           << newo->oid << " from 0x" << std::hex << srcoff << "~" << length
           << " to offset 0x" << dstoff << std::dec << dendl;
   int r = 0;
-  bufferlist bl;
 
   if (srcoff + length > oldo->onode.size) {
     r = -EINVAL;
@@ -8547,6 +8546,7 @@ int BlueStore::_clone_range(TransContext *txc,
     _do_zero(txc, c, newo, dstoff, length);
     _do_clone_range(txc, c, oldo, newo, srcoff, length, dstoff);
   } else {
+    bufferlist bl;
     r = _do_read(c.get(), oldo, srcoff, length, bl, 0);
     if (r < 0)
       goto out;