From 6b8e4d512604095fb8a209229d4633ac19b499de Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 8 Sep 2017 18:08:51 -0400 Subject: [PATCH] os/bluestore: use min_alloc_size for freelist resolution For HDD with min_alloc_size=64k, this is a 16x reduction in allocation metadata! Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 1e24c7b521b9..7b9cfaab0b2f 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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; -- 2.47.3