]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: optimize the code doing the BufferHead mapping 22509/head
authordongdong tao <tdd21151186@gmail.com>
Sun, 10 Jun 2018 23:09:35 +0000 (07:09 +0800)
committerdongdong tao <tdd21151186@gmail.com>
Sun, 10 Jun 2018 23:20:53 +0000 (07:20 +0800)
get rid of the "newbl"
Signed-off-by: dongdong tao <tdd21151186@gmail.com>
src/osdc/ObjectCacher.cc

index 50f9a8d6a6c07de069bcb044606fc2eff1258c51..8d524ca0898792399ecf19ad009a3bb4db59b15f 100644 (file)
@@ -1733,15 +1733,13 @@ int ObjectCacher::writex(OSDWrite *wr, ObjectSet *oset, Context *onfreespace,
 
       // get the frag we're mapping in
       bufferlist frag;
-      frag.substr_of(wr->bl,
-                    f_it->first, f_it->second);
+      frag.substr_of(wr->bl, f_it->first, f_it->second);
 
       // keep anything left of bhoff
-      bufferlist newbl;
-      if (bhoff)
-       newbl.substr_of(bh->bl, 0, bhoff);
-      newbl.claim_append(frag);
-      bh->bl.swap(newbl);
+      if (!bhoff)
+        bh->bl.swap(frag);
+      else
+        bh->bl.claim_append(frag);
 
       opos += f_it->second;
     }