]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: cosmetic gc cleanups
authorSage Weil <sage@redhat.com>
Fri, 30 Sep 2016 18:23:32 +0000 (14:23 -0400)
committerSage Weil <sage@redhat.com>
Fri, 30 Sep 2016 18:23:32 +0000 (14:23 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 7e4785ebd31157c2e999a5cd93d8c2f97993cf00..ec1961173345654a9bd729c1baa1df0aacf29b4b 100644 (file)
@@ -1389,6 +1389,7 @@ ostream& operator<<(ostream& out, const BlueStore::Extent& e)
 {
   return out << std::hex << "0x" << e.logical_offset << "~" << e.length
             << ": 0x" << e.blob_offset << "~" << e.length << std::dec
+            << " depth " << (int)e.blob_depth
             << " " << *e.blob;
 }
 
@@ -7512,7 +7513,7 @@ void BlueStore::_wctx_finish(
   }
 }
 
-bool BlueStore::_blobs_need_garbage_collection(
+bool BlueStore::_do_write_check_depth(
   OnodeRef o,
   uint64_t start_offset,
   uint64_t end_offset,
@@ -7529,16 +7530,16 @@ bool BlueStore::_blobs_need_garbage_collection(
   *blob_depth = 1;
 
   auto hp = o->extent_map.seek_lextent(start_offset);
-
-  if (hp != o->extent_map.extent_map.end() && hp->logical_offset < start_offset &&
+  if (hp != o->extent_map.extent_map.end() &&
+      hp->logical_offset < start_offset &&
       start_offset < hp->logical_offset + hp->length) {
     depth = hp->blob_depth;
     head_overlap = true;
   }
   
   auto tp = o->extent_map.seek_lextent(end_offset);
-
-  if (tp != o->extent_map.extent_map.end() && tp->logical_offset < end_offset &&
+  if (tp != o->extent_map.extent_map.end() &&
+      tp->logical_offset < end_offset &&
     end_offset < tp->logical_offset + tp->length) {
     tail_overlap = true;
     if (depth < tp->blob_depth) {
@@ -7574,6 +7575,10 @@ bool BlueStore::_blobs_need_garbage_collection(
       *gc_end_offset = tp->logical_offset + tp_prev->length;
     }
   }
+  dout(20) << __func__ << " depth " << (int)depth
+          << ", gc 0x" << std::hex << *gc_start_offset << "~"
+          << (*gc_end_offset - *gc_start_offset)
+          << std::dec << dendl;
   if (depth >= g_conf->bluestore_gc_max_blob_depth) {
     return true;
   } else {
@@ -7688,9 +7693,8 @@ int BlueStore::_do_write(
           << std::dec << dendl;
 
   uint64_t gc_start_offset = offset, gc_end_offset = end;
-
-  if (_blobs_need_garbage_collection(o, offset, end, &wctx.blob_depth,
-                            &gc_start_offset, &gc_end_offset) == true) {
+  if (_do_write_check_depth(o, offset, end, &wctx.blob_depth,
+                            &gc_start_offset, &gc_end_offset)) {
     // we need garbage collection of blobs.
     if (offset > gc_start_offset) {
       bufferlist head_bl;
index 16b59ed12ff6950c93e3ea8bd0c8753702e4f7df..04831ab78604a80d5fbd19376014e8ec6dca3260 100644 (file)
@@ -1782,12 +1782,13 @@ private:
   void _pad_zeros(bufferlist *bl, uint64_t *offset,
                  uint64_t chunk_size);
 
-  bool _blobs_need_garbage_collection(OnodeRef o,
-                          uint64_t start_offset,
-                          uint64_t end_offset,
-                          uint8_t  *blob_depth,
-                          uint64_t *gc_start_offset,
-                          uint64_t *gc_end_offset);
+  bool _do_write_check_depth(
+    OnodeRef o,
+    uint64_t start_offset,
+    uint64_t end_offset,
+    uint8_t  *blob_depth,
+    uint64_t *gc_start_offset,
+    uint64_t *gc_end_offset);
 
   int _do_write(TransContext *txc,
                CollectionRef &c,