]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: avoid unnecessary call to init_csum()
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 16 Nov 2016 06:33:30 +0000 (14:33 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 16 Nov 2016 06:33:30 +0000 (14:33 +0800)
We have to initiate CSumType from 1, which represents CSUM_NONE,
to be aligned with OSDMnitor's pool_opts_t handling.

So we have to explicitly check against CSUM_NONE to skip init_csum(),
which will set FLAG_CSUM and alloc memory for csum_data and thus
shall be avoided whenever it is possible.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 140a8e62bd250cacf78172460394418a19edfa62..ca886c607595c9f13c15c1ec2c9f0aff13ba7d9d 100644 (file)
@@ -7906,7 +7906,7 @@ int BlueStore::_do_alloc_write(
             << " csum_length 0x" << std::hex << csum_length << std::dec
             << dendl;
 
-    if (csum) {
+    if (csum != Checksummer::CSUM_NONE) {
       dblob.init_csum(csum, csum_order, csum_length);
       dblob.calc_csum(b_off, *l);
     }