]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/src/engine/engine_debug.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / ocf / src / engine / engine_debug.h
1 /*
2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
4 */
5
6 #ifndef ENGINE_DEBUG_H_
7 #define ENGINE_DEBUG_H_
8
9 #ifndef OCF_ENGINE_DEBUG
10 #define OCF_ENGINE_DEBUG 0
11 #endif
12
13 #if 1 == OCF_ENGINE_DEBUG
14
15 #ifndef OCF_ENGINE_DEBUG_IO_NAME
16 #define OCF_ENGINE_DEBUG_IO_NAME "null"
17 #endif
18
19 #define OCF_DEBUG_PREFIX "[Engine][%s] %s "
20
21 #define OCF_DEBUG_LOG(cache, format, ...) \
22 ocf_cache_log_prefix(cache, log_info, OCF_DEBUG_PREFIX, \
23 format"\n", OCF_ENGINE_DEBUG_IO_NAME, __func__, \
24 ##__VA_ARGS__)
25
26 #define OCF_DEBUG_TRACE(cache) OCF_DEBUG_LOG(cache, "")
27
28 #define OCF_DEBUG_MSG(cache, msg) OCF_DEBUG_LOG(cache, "- %s", msg)
29
30 #define OCF_DEBUG_PARAM(cache, format, ...) OCF_DEBUG_LOG(cache, "- "format, \
31 ##__VA_ARGS__)
32
33 #define OCF_DEBUG_RQ(req, format, ...) \
34 ocf_cache_log(req->cache, log_info, "[Engine][%s][%s, %llu, %u] %s - " \
35 format"\n", OCF_ENGINE_DEBUG_IO_NAME, \
36 OCF_READ == (req)->rw ? "RD" : "WR", req->byte_position, \
37 req->byte_length, __func__, ##__VA_ARGS__)
38
39 #else
40 #define OCF_DEBUG_PREFIX
41 #define OCF_DEBUG_LOG(cache, format, ...)
42 #define OCF_DEBUG_TRACE(cache)
43 #define OCF_DEBUG_MSG(cache, msg)
44 #define OCF_DEBUG_PARAM(cache, format, ...)
45 #define OCF_DEBUG_RQ(req, format, ...)
46 #endif
47
48 #endif /* ENGINE_DEBUG_H_ */