mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
test/librados_test_stub: s/Mutex/ceph::mutex/
Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
af0e1b4ec6
commit
e3e65af172
@ -8,8 +8,7 @@
|
||||
#include "include/buffer.h"
|
||||
#include "include/interval_set.h"
|
||||
#include "include/int_types.h"
|
||||
#include "common/Cond.h"
|
||||
#include "common/Mutex.h"
|
||||
#include "common/ceph_mutex.h"
|
||||
#include "common/RefCountedObj.h"
|
||||
#include "common/RWLock.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
@ -768,8 +768,9 @@ void TestMemIoCtxImpl::ensure_minimum_length(size_t len, bufferlist *bl) {
|
||||
|
||||
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(
|
||||
|
@ -32,10 +32,10 @@ static int get_concurrency() {
|
||||
namespace librados {
|
||||
|
||||
static void finish_aio_completion(AioCompletionImpl *c, int r) {
|
||||
c->lock.Lock();
|
||||
c->lock.lock();
|
||||
c->complete = true;
|
||||
c->rval = r;
|
||||
c->lock.Unlock();
|
||||
c->lock.unlock();
|
||||
|
||||
rados_callback_t cb_complete = c->callback_complete;
|
||||
void *cb_complete_arg = c->callback_complete_arg;
|
||||
@ -49,10 +49,10 @@ static void finish_aio_completion(AioCompletionImpl *c, int r) {
|
||||
cb_safe(c, cb_safe_arg);
|
||||
}
|
||||
|
||||
c->lock.Lock();
|
||||
c->lock.lock();
|
||||
c->callback_complete = NULL;
|
||||
c->callback_safe = NULL;
|
||||
c->cond.Signal();
|
||||
c->cond.notify_all();
|
||||
c->put_unlock();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ struct TestWatchNotify::ObjectHandler : public TestCluster::ObjectHandler {
|
||||
};
|
||||
|
||||
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) {
|
||||
@ -171,10 +171,10 @@ void TestWatchNotify::execute_watch(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;
|
||||
}
|
||||
@ -193,7 +193,7 @@ void TestWatchNotify::execute_watch(TestRadosClient *rados_client,
|
||||
|
||||
ldout(cct, 20) << "oid=" << o << ", gid=" << gid << ": handle=" << *handle
|
||||
<< dendl;
|
||||
m_lock.Unlock();
|
||||
m_lock.unlock();
|
||||
|
||||
on_finish->complete(0);
|
||||
}
|
||||
@ -222,7 +222,7 @@ void TestWatchNotify::execute_unwatch(TestRadosClient *rados_client,
|
||||
|
||||
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()) {
|
||||
@ -243,7 +243,7 @@ TestWatchNotify::SharedWatcher TestWatchNotify::get_watcher(
|
||||
}
|
||||
|
||||
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()) {
|
||||
@ -267,13 +267,13 @@ void TestWatchNotify::execute_notify(TestRadosClient *rados_client,
|
||||
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;
|
||||
}
|
||||
@ -316,7 +316,7 @@ void TestWatchNotify::execute_notify(TestRadosClient *rados_client,
|
||||
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,
|
||||
@ -326,7 +326,7 @@ 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;
|
||||
@ -359,7 +359,7 @@ void TestWatchNotify::finish_notify(TestRadosClient *rados_client,
|
||||
|
||||
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;
|
||||
|
@ -6,13 +6,12 @@
|
||||
|
||||
#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 {
|
||||
@ -109,7 +108,8 @@ private:
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user