Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mimic: os/bluestore: backport new bitmap allocator #26983

Merged
merged 21 commits into from Apr 1, 2019
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
480b285
test/allocator: get rid off bitmap allocator specifics and introduce new
ifed01 May 3, 2018
dd0912f
os/bluestore: add new bitmap allocator
ifed01 May 3, 2018
ba5c402
test/allocator: move bluestore allocator's benchmarks to a standalone UT
ifed01 May 4, 2018
d8d6cdb
os/bluestore: get rid off allocator's reserve method
ifed01 May 7, 2018
4773293
os/bluestore: add release(PExtentVector) helper to Allocator class to
ifed01 May 7, 2018
5525533
os/bluestore: fix improper access to a BitmapFastAllocator::last_pos
ifed01 May 10, 2018
d42bb17
os/bluestore: align BitMap allocator's init_rm_free/init_add_free par…
ifed01 May 11, 2018
5651097
os/bluestore: remove original bitmap allocator
ifed01 May 14, 2018
506dbcc
os/bluestore: more verbose logging in new bitmap allocator
ifed01 May 30, 2018
3885860
os/bluestore: cosmetic cleanup in new bitmap allocator.
ifed01 May 31, 2018
33482e0
os/bluestore: properly respect min_length when analysing partially free
ifed01 May 31, 2018
8b9fb75
os/bluestore: cosmetic new allocator internal method rename.
ifed01 May 31, 2018
ececb8f
os/bluestore: respect min_length as allocation granularity for new
ifed01 May 31, 2018
c645f2f
test/objectstore/unitetest_fastbmap_allocator: replace ASSERT_TRUE with
ifed01 Jun 1, 2018
25b7d0e
os/bluestore: perform allocations aligned with min_length in new bit…
ifed01 Jun 1, 2018
811857a
os/bluestore: rename new bitmap allocator class to BitmapAllocator.
ifed01 Jun 12, 2018
d08e2b7
os/bluestore: provide a rough estimate for bitmap allocator
ifed01 Jun 15, 2018
0bdbe66
os/bluestore: fix overlappedd allocation returned by bitmap allocator
ifed01 Jun 25, 2018
e5de298
os/bluestore: fix minor issues in bitmap logging output
ifed01 Jun 25, 2018
cf984c8
qa/objectstore: bluestore -> bluestore-{bitmap,stupid}
liewegas Nov 30, 2018
f26b219
qa/suites: fix bluestore links
liewegas Dec 5, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

os/bluestore: add new bitmap allocator

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit 631041a)
  • Loading branch information...
ifed01 committed May 3, 2018
commit dd0912f718cfd453cb31169d164b571a4a0d9a60
@@ -28,9 +28,11 @@ if(WITH_BLUESTORE)
bluestore/BlueRocksEnv.cc
bluestore/BlueStore.cc
bluestore/bluestore_types.cc
bluestore/fastbmap_allocator_impl.cc
bluestore/FreelistManager.cc
bluestore/StupidAllocator.cc
bluestore/BitMapAllocator.cc
bluestore/BitmapFastAllocator.cc
bluestore/BitAllocator.cc
)
endif(WITH_BLUESTORE)
@@ -4,6 +4,7 @@
#include "Allocator.h"
#include "StupidAllocator.h"
#include "BitMapAllocator.h"
#include "BitmapFastAllocator.h"
#include "common/debug.h"

#define dout_subsys ceph_subsys_bluestore
@@ -14,7 +15,7 @@ Allocator *Allocator::create(CephContext* cct, string type,
if (type == "stupid") {
return new StupidAllocator(cct);
} else if (type == "bitmap") {
return new BitMapAllocator(cct, size, block_size);
return new BitmapFastAllocator(cct, size, block_size);
}
lderr(cct) << "Allocator::" << __func__ << " unknown alloc type "
<< type << dendl;
@@ -0,0 +1,73 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "BitmapFastAllocator.h"

#define dout_context cct
#define dout_subsys ceph_subsys_bluestore
#undef dout_prefix
#define dout_prefix *_dout << "fbmap_alloc 0x" << this << " "

BitmapFastAllocator::BitmapFastAllocator(CephContext* _cct,
int64_t capacity,
int64_t alloc_unit) :
cct(_cct)
{
ldout(cct, 10) << __func__ << " 0x" << std::hex << capacity << "/"
<< alloc_unit << std::dec << dendl;
_init(capacity, alloc_unit, false);
}

int64_t BitmapFastAllocator::allocate(
uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
int64_t hint, PExtentVector *extents)
{
uint64_t allocated = 0;

if (hint != 0) {
last_pos = hint;
}

_allocate_l2(want_size, alloc_unit, max_alloc_size, &last_pos,
&allocated, extents);
if (!allocated) {
return -ENOSPC;
}
for (auto e : *extents) {
ldout(cct, 10) << __func__
<< " 0x" << std::hex << e.offset << "~" << e.length
<< "/" << alloc_unit << "," << max_alloc_size << "," << hint
<< std::dec << dendl;
}
return int64_t(allocated);
}

void BitmapFastAllocator::release(
const interval_set<uint64_t>& release_set)
{
for (auto r : release_set) {
ldout(cct, 10) << __func__ << " 0x" << std::hex << r.first << "~" << r.second
<< std::dec << dendl;
}
_free_l2(release_set);
}


void BitmapFastAllocator::init_add_free(uint64_t offset, uint64_t length)
{
ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
<< std::dec << dendl;
_mark_free(offset, length);
}
void BitmapFastAllocator::init_rm_free(uint64_t offset, uint64_t length)
{
ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
<< std::dec << dendl;
_mark_allocated(offset, length);
}

void BitmapFastAllocator::shutdown()
{
ldout(cct, 1) << __func__ << dendl;
last_pos = 0;
}
@@ -0,0 +1,49 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#ifndef CEPH_OS_BLUESTORE_BITMAPFASTALLOCATOR_H
#define CEPH_OS_BLUESTORE_BITMAPFASTALLOCATOR_H

#include <mutex>

#include "Allocator.h"
#include "os/bluestore/bluestore_types.h"
#include "fastbmap_allocator_impl.h"
#include "include/mempool.h"
#include "common/debug.h"

class BitmapFastAllocator : public Allocator,
public AllocatorLevel02<AllocatorLevel01Loose> {
CephContext* cct;
uint64_t last_pos = 0;

public:
BitmapFastAllocator(CephContext* _cct, int64_t capacity, int64_t alloc_unit);
~BitmapFastAllocator() override
{
}


int64_t allocate(
uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
int64_t hint, PExtentVector *extents) override;

void release(
const interval_set<uint64_t>& release_set) override;

uint64_t get_free() override
{
return get_available();
}

void dump() override
{
}

void init_add_free(uint64_t offset, uint64_t length) override;
void init_rm_free(uint64_t offset, uint64_t length) override;

void shutdown() override;
};

#endif
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.