TestMemCluster::SharedFile TestMemIoCtxImpl::get_file(
const std::string &oid, bool write, const SnapContext &snapc) {
- ceph_assert(m_pool->file_lock.is_locked() || m_pool->file_lock.is_wlocked());
- ceph_assert(!write || m_pool->file_lock.is_wlocked());
+ ceph_assert(ceph_mutex_is_locked(m_pool->file_lock) ||
+ ceph_mutex_is_wlocked(m_pool->file_lock));
+ ceph_assert(!write || ceph_mutex_is_wlocked(m_pool->file_lock));
TestMemCluster::SharedFile file;
TestMemCluster::Files::iterator it = m_pool->files.find(
};
TestWatchNotify::TestWatchNotify(TestCluster* test_cluster)
- : m_test_cluster(test_cluster), m_lock("librados::TestWatchNotify::m_lock") {
+ : m_test_cluster(test_cluster) {
}
void TestWatchNotify::flush(TestRadosClient *rados_client) {
Context* on_finish) {
CephContext *cct = rados_client->cct();
- m_lock.Lock();
+ m_lock.lock();
SharedWatcher watcher = get_watcher(pool_id, nspace, o);
if (!watcher) {
- m_lock.Unlock();
+ m_lock.unlock();
on_finish->complete(-ENOENT);
return;
}
ldout(cct, 20) << "oid=" << o << ", gid=" << gid << ": handle=" << *handle
<< dendl;
- m_lock.Unlock();
+ m_lock.unlock();
on_finish->complete(0);
}
TestWatchNotify::SharedWatcher TestWatchNotify::get_watcher(
int64_t pool_id, const std::string& nspace, const std::string& oid) {
- ceph_assert(m_lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(m_lock));
auto it = m_file_watchers.find({pool_id, nspace, oid});
if (it == m_file_watchers.end()) {
}
void TestWatchNotify::maybe_remove_watcher(SharedWatcher watcher) {
- ceph_assert(m_lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(m_lock));
// TODO
if (watcher->watch_handles.empty() && watcher->notify_handles.empty()) {
Context *on_notify) {
CephContext *cct = rados_client->cct();
- m_lock.Lock();
+ m_lock.lock();
uint64_t notify_id = ++m_notify_id;
SharedWatcher watcher = get_watcher(pool_id, nspace, oid);
if (!watcher) {
ldout(cct, 1) << "oid=" << oid << ": not found" << dendl;
- m_lock.Unlock();
+ m_lock.unlock();
on_notify->complete(-ENOENT);
return;
}
watcher->notify_handles[notify_id] = notify_handle;
finish_notify(rados_client, pool_id, nspace, oid, notify_id);
- m_lock.Unlock();
+ m_lock.unlock();
}
void TestWatchNotify::ack_notify(TestRadosClient *rados_client, int64_t pool_id,
const bufferlist &bl) {
CephContext *cct = rados_client->cct();
- ceph_assert(m_lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(m_lock));
SharedWatcher watcher = get_watcher(pool_id, nspace, oid);
if (!watcher) {
ldout(cct, 1) << "oid=" << oid << ": not found" << dendl;
ldout(cct, 20) << "oid=" << oid << ", notify_id=" << notify_id << dendl;
- ceph_assert(m_lock.is_locked());
+ ceph_assert(ceph_mutex_is_locked(m_lock));
SharedWatcher watcher = get_watcher(pool_id, nspace, oid);
if (!watcher) {
ldout(cct, 1) << "oid=" << oid << ": not found" << dendl;
#include "include/rados/librados.hpp"
#include "common/AsyncOpTracker.h"
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <list>
#include <map>
-class Cond;
class Finisher;
namespace librados {
uint64_t m_handle = 0;
uint64_t m_notify_id = 0;
- Mutex m_lock;
+ ceph::mutex m_lock =
+ ceph::make_mutex("librados::TestWatchNotify::m_lock");
AsyncOpTracker m_async_op_tracker;
FileWatchers m_file_watchers;