]> git.proxmox.com Git - ceph.git/blame - ceph/src/common/lockdep.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / common / lockdep.h
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3/*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2008-2011 New Dream Network
7 *
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.
12 *
13 */
14
15#ifndef CEPH_LOCKDEP_H
16#define CEPH_LOCKDEP_H
17
9f95a23c 18#include "include/common_fwd.h"
20effc67
TL
19
20#ifdef CEPH_DEBUG_MUTEX
21
b32b8144 22extern bool g_lockdep;
7c673cae
FG
23
24extern void lockdep_register_ceph_context(CephContext *cct);
25extern void lockdep_unregister_ceph_context(CephContext *cct);
9f95a23c
TL
26// lockdep tracks dependencies between multiple and different instances
27// of locks within a class denoted by `n`.
28// Caller is obliged to guarantee name uniqueness.
7c673cae
FG
29extern int lockdep_register(const char *n);
30extern void lockdep_unregister(int id);
11fdf7f2
TL
31extern int lockdep_will_lock(const char *n, int id, bool force_backtrace=false,
32 bool recursive=false);
7c673cae
FG
33extern int lockdep_locked(const char *n, int id, bool force_backtrace=false);
34extern int lockdep_will_unlock(const char *n, int id);
35extern int lockdep_dump_locks();
20effc67
TL
36
37#else
38
39static constexpr bool g_lockdep = false;
40#define lockdep_register(...) 0
41#define lockdep_unregister(...)
42#define lockdep_will_lock(...) 0
43#define lockdep_locked(...) 0
44#define lockdep_will_unlock(...) 0
45
46#endif // CEPH_DEBUG_MUTEX
47
48
7c673cae 49#endif