]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make allocated space calc a little faster
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 28 Sep 2016 07:24:19 +0000 (15:24 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 28 Sep 2016 07:24:19 +0000 (15:24 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 41db614933420a8491627ce4b1fd9e7175c9cd70..cd73bef1eedc477de7674e789516032ea73c9389 100644 (file)
@@ -7317,16 +7317,17 @@ int BlueStore::_do_alloc_write(
 
     int r = alloc->alloc_extents(final_length, min_alloc_size, max_alloc_size,
                                  hint, &extents, &count);
-
-    need -= final_length;
     assert(r == 0);
+    need -= final_length;
+    txc->statfs_delta.allocated() += final_length;
+    assert(count > 0);
+    hint = extents[count - 1].end();
+
     bluestore_blob_t& dblob = b->dirty_blob();
     for (int i = 0; i < count; i++) {
       bluestore_pextent_t e = bluestore_pextent_t(extents[i]);
       txc->allocated.insert(e.offset, e.length);
-      txc->statfs_delta.allocated() += e.length;
       dblob.extents.push_back(e);
-      hint = e.end();
     }
 
     dout(20) << __func__ << " blob " << *b