]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: use min_alloc_size for freelist resolution 17610/head
authorSage Weil <sage@redhat.com>
Fri, 8 Sep 2017 22:08:51 +0000 (18:08 -0400)
committerSage Weil <sage@redhat.com>
Fri, 8 Sep 2017 22:18:15 +0000 (18:18 -0400)
For HDD with min_alloc_size=64k, this is a 16x reduction in allocation
metadata!

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index 1e24c7b521b9579609c2176a838115f1531f9b78..7b9cfaab0b2f04f0aa9ea04e71a4f7b0a665597d 100644 (file)
@@ -4169,7 +4169,7 @@ int BlueStore::_open_fm(bool create)
       bl.append(freelist_type);
       t->set(PREFIX_SUPER, "freelist_type", bl);
     }
-    fm->create(bdev->get_size(), cct->_conf->bdev_block_size, t);
+    fm->create(bdev->get_size(), min_alloc_size, t);
 
     // allocate superblock reserved space.  note that we do not mark
     // bluefs space as allocated in the freelist; we instead rely on
@@ -5460,7 +5460,7 @@ int BlueStore::_fsck_check_extents(
     }
     bool already = false;
     apply(
-      e.offset, e.length, block_size, used_blocks,
+      e.offset, e.length, min_alloc_size, used_blocks,
       [&](uint64_t pos, mempool_dynamic_bitset &bs) {
        if (bs.test(pos))
          already = true;
@@ -5562,9 +5562,9 @@ int BlueStore::fsck(bool deep)
   if (r < 0)
     goto out_scan;
 
-  used_blocks.resize(bdev->get_size() / block_size);
+  used_blocks.resize(bdev->get_size() / min_alloc_size);
   apply(
-    0, SUPER_RESERVED, block_size, used_blocks,
+    0, MAX(min_alloc_size, SUPER_RESERVED), min_alloc_size, used_blocks,
     [&](uint64_t pos, mempool_dynamic_bitset &bs) {
       bs.set(pos);
     }
@@ -5573,7 +5573,7 @@ int BlueStore::fsck(bool deep)
   if (bluefs) {
     for (auto e = bluefs_extents.begin(); e != bluefs_extents.end(); ++e) {
       apply(
-        e.get_start(), e.get_len(), block_size, used_blocks,
+        e.get_start(), e.get_len(), min_alloc_size, used_blocks,
         [&](uint64_t pos, mempool_dynamic_bitset &bs) {
           bs.set(pos);
         }
@@ -5972,7 +5972,7 @@ int BlueStore::fsck(bool deep)
               << " released 0x" << std::hex << wt.released << std::dec << dendl;
       for (auto e = wt.released.begin(); e != wt.released.end(); ++e) {
         apply(
-          e.get_start(), e.get_len(), block_size, used_blocks,
+          e.get_start(), e.get_len(), min_alloc_size, used_blocks,
           [&](uint64_t pos, mempool_dynamic_bitset &bs) {
             bs.set(pos);
           }
@@ -5987,7 +5987,7 @@ int BlueStore::fsck(bool deep)
     // know they are allocated.
     for (auto e = bluefs_extents.begin(); e != bluefs_extents.end(); ++e) {
       apply(
-        e.get_start(), e.get_len(), block_size, used_blocks,
+        e.get_start(), e.get_len(), min_alloc_size, used_blocks,
         [&](uint64_t pos, mempool_dynamic_bitset &bs) {
          bs.reset(pos);
         }
@@ -5998,7 +5998,7 @@ int BlueStore::fsck(bool deep)
     while (fm->enumerate_next(&offset, &length)) {
       bool intersects = false;
       apply(
-        offset, length, block_size, used_blocks,
+        offset, length, min_alloc_size, used_blocks,
         [&](uint64_t pos, mempool_dynamic_bitset &bs) {
           if (bs.test(pos)) {
             intersects = true;
@@ -6027,8 +6027,8 @@ int BlueStore::fsck(bool deep)
          size_t next = used_blocks.find_next(cur);
          if (next != cur + 1) {
            derr << __func__ << " error: leaked extent 0x" << std::hex
-                << ((uint64_t)start * block_size) << "~"
-                << ((cur + 1 - start) * block_size) << std::dec
+                << ((uint64_t)start * min_alloc_size) << "~"
+                << ((cur + 1 - start) * min_alloc_size) << std::dec
                 << dendl;
            start = next;
            break;