void *BlueStore::MempoolThread::entry()
{
- Mutex::Locker l(lock);
+ std::unique_lock l(lock);
std::list<PriorityCache::PriCache *> caches;
caches.push_back(store->db);
interval_stats_trim = false;
store->_update_cache_logger();
- utime_t wait;
- wait += store->cct->_conf->bluestore_cache_trim_interval;
- cond.WaitInterval(lock, wait);
+ auto wait = ceph::make_timespan(
+ store->cct->_conf->bluestore_cache_trim_interval);
+ cond.wait_for(l, wait);
}
stop = false;
return NULL;
public:
BlueStore *store;
- Cond cond;
- Mutex lock;
+ ceph::condition_variable cond;
+ ceph::mutex lock = ceph::make_mutex("BlueStore::MempoolThread::lock");
bool stop = false;
uint64_t autotune_cache_size = 0;
public:
explicit MempoolThread(BlueStore *s)
: store(s),
- lock("BlueStore::MempoolThread::lock"),
meta_cache(MetaCache(s)),
data_cache(DataCache(s)) {}
create("bstore_mempool");
}
void shutdown() {
- lock.Lock();
+ lock.lock();
stop = true;
- cond.Signal();
- lock.Unlock();
+ cond.notify_all();
+ lock.unlock();
join();
}
fd_direct(-1),
fd_buffered(-1),
aio(false), dio(false),
- debug_lock("KernelDevice::debug_lock"),
aio_queue(cct->_conf->bdev_aio_max_queue_depth),
discard_callback(d_cb),
discard_callback_priv(d_cbpriv),
dout(20) << __func__ << " 0x" << std::hex << offset << "~" << length
<< std::dec << dendl;
if (cct->_conf->bdev_debug_inflight_ios) {
- Mutex::Locker l(debug_lock);
+ std::lock_guard l(debug_lock);
if (debug_inflight.intersects(offset, length)) {
derr << __func__ << " inflight overlap of 0x"
<< std::hex
dout(20) << __func__ << " " << aio << " 0x"
<< std::hex << offset << "~" << length << std::dec << dendl;
if (cct->_conf->bdev_debug_inflight_ios) {
- Mutex::Locker l(debug_lock);
+ std::lock_guard l(debug_lock);
debug_inflight.erase(offset, length);
}
}
#include "include/types.h"
#include "include/interval_set.h"
-#include "common/Mutex.h"
-#include "common/Cond.h"
+#include "common/Thread.h"
+#include "include/utime.h"
#include "aio.h"
#include "BlockDevice.h"
std::string devname; ///< kernel dev name (/sys/block/$devname), if any
- Mutex debug_lock;
+ ceph::mutex debug_lock = ceph::make_mutex("KernelDevice::debug_lock");
interval_set<uint64_t> debug_inflight;
std::atomic<bool> io_since_flush = {false};
};
private:
- Mutex lock;
+ ceph::mutex lock = ceph::make_mutex("NVMEManager::lock");
bool init = false;
std::vector<SharedDriverData*> shared_driver_datas;
std::thread dpdk_thread;
std::list<ProbeContext*> probe_queue;
public:
- NVMEManager()
- : lock("NVMEDevice::NVMEManager::lock") {}
+ NVMEManager() {}
int try_get(const spdk_nvme_transport_id& trid, SharedDriverData **driver);
void register_ctrlr(const spdk_nvme_transport_id& trid, spdk_nvme_ctrlr *c, SharedDriverData **driver) {
- ceph_assert(lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(lock));
spdk_nvme_ns *ns;
int num_ns = spdk_nvme_ctrlr_get_num_ns(c);
ceph_assert(num_ns >= 1);
int NVMEManager::try_get(const spdk_nvme_transport_id& trid, SharedDriverData **driver)
{
- Mutex::Locker l(lock);
+ std::lock_guard l(lock);
for (auto &&it : shared_driver_datas) {
if (it->is_equal(trid)) {
*driver = it;
#include "include/interval_set.h"
#include "common/ceph_time.h"
-#include "common/Mutex.h"
-#include "common/Cond.h"
#include "BlockDevice.h"
enum class IOCommand {
PMEMDevice::PMEMDevice(CephContext *cct, aio_callback_t cb, void *cbpriv)
: BlockDevice(cct, cb, cbpriv),
fd(-1), addr(0),
- debug_lock("PMEMDevice::debug_lock"),
injecting_crash(0)
{
}
char *addr; //the address of mmap
std::string path;
- Mutex debug_lock;
+ ceph::mutex debug_lock = ceph::make_mutex("PMEMDevice::debug_lock");
interval_set<uint64_t> debug_inflight;
std::atomic_int injecting_crash;