]>
git.proxmox.com Git - ceph.git/blob - ceph/src/os/bluestore/FreelistManager.cc
5907df443e00b9a7134f6a569a7d86c3a2aa1413
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");
21 return new BitmapFreelistManager(cct
, "B", "b");
24 // With zoned drives there is only one FreelistManager implementation that we
25 // can use, and we also know if a drive is zoned right after opening it
26 // (BlueStore::_open_bdev). Hence, we set freelist_type to "zoned" whenever
27 // we open the device and it turns out to be is zoned. We ignore |prefix|
28 // passed to create and use the prefixes defined for zoned devices at the top
31 return new ZonedFreelistManager(cct
, "Z", "z");
37 void FreelistManager::setup_merge_operators(KeyValueDB
*db
,
38 const std::string
& type
)
42 ZonedFreelistManager::setup_merge_operator(db
, "z");
45 BitmapFreelistManager::setup_merge_operator(db
, "b");