]>
git.proxmox.com Git - ceph.git/blob - ceph/src/os/bluestore/FreelistManager.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "FreelistManager.h"
5 #include "BitmapFreelistManager.h"
7 #include "ZonedFreelistManager.h"
10 FreelistManager
*FreelistManager::create(
15 // a bit of a hack... we hard-code the prefixes here. we need to
16 // put the freelistmanagers in different prefixes because the merge
17 // op is per prefix, has to done pre-db-open, and we don't know the
18 // freelist type until after we open the db.
19 ceph_assert(prefix
== "B");
20 if (type
== "bitmap") {
21 return new BitmapFreelistManager(cct
, "B", "b");
24 // use BitmapFreelistManager with the null option to stop allocations from going to RocksDB
25 auto *fm
= new BitmapFreelistManager(cct
, "B", "b");
26 fm
->set_null_manager();
31 // With zoned drives there is only one FreelistManager implementation that we
32 // can use, and we also know if a drive is zoned right after opening it
33 // (BlueStore::_open_bdev). Hence, we set freelist_type to "zoned" whenever
34 // we open the device and it turns out to be is zoned. We ignore |prefix|
35 // passed to create and use the prefixes defined for zoned devices at the top
38 return new ZonedFreelistManager(cct
, "Z", "z");
44 void FreelistManager::setup_merge_operators(KeyValueDB
*db
,
45 const std::string
& type
)
49 ZonedFreelistManager::setup_merge_operator(db
, "z");
52 BitmapFreelistManager::setup_merge_operator(db
, "b");