]>
git.proxmox.com Git - ceph.git/blob - ceph/src/common/mutex_debug.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #include "common/mutex_debug.h"
16 #include "common/perf_counters.h"
17 #include "common/ceph_context.h"
18 #include "common/config.h"
21 namespace mutex_debug_detail
{
23 l_mutex_first
= 999082,
28 mutex_debugging_base::mutex_debugging_base(std::string group
, bool ld
, bool bt
)
29 : group(std::move(group
)),
33 if (_enable_lockdep()) {
38 mutex_debugging_base::~mutex_debugging_base() {
39 ceph_assert(nlock
== 0);
40 if (_enable_lockdep()) {
41 lockdep_unregister(id
);
45 void mutex_debugging_base::_register() {
46 id
= lockdep_register(group
.c_str());
48 void mutex_debugging_base::_will_lock(bool recursive
) { // about to lock
49 id
= lockdep_will_lock(group
.c_str(), id
, backtrace
, recursive
);
51 void mutex_debugging_base::_locked() { // just locked
52 id
= lockdep_locked(group
.c_str(), id
, backtrace
);
54 void mutex_debugging_base::_will_unlock() { // about to unlock
55 id
= lockdep_will_unlock(group
.c_str(), id
);
58 } // namespace mutex_debug_detail