blob: e6b4baa5e8fbaecaceae945a918abcaa972472ca [file] [log] [blame]
Mike Marshallf7ab0932015-07-17 10:38:11 -04001/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6
7/* This file just defines debugging masks to be used with the gossip
Yi Liu8bb8aef2015-11-24 15:12:14 -05008 * logging utility. All debugging masks for ORANGEFS are kept here to make
Mike Marshallf7ab0932015-07-17 10:38:11 -04009 * sure we don't have collisions.
10 */
11
Yi Liu8bb8aef2015-11-24 15:12:14 -050012#ifndef __ORANGEFS_DEBUG_H
13#define __ORANGEFS_DEBUG_H
Mike Marshallf7ab0932015-07-17 10:38:11 -040014
15#ifdef __KERNEL__
16#include <linux/types.h>
17#else
18#include <stdint.h>
19#endif
20
21#define GOSSIP_NO_DEBUG (__u64)0
22#define GOSSIP_BMI_DEBUG_TCP ((__u64)1 << 0)
23#define GOSSIP_BMI_DEBUG_CONTROL ((__u64)1 << 1)
24#define GOSSIP_BMI_DEBUG_OFFSETS ((__u64)1 << 2)
25#define GOSSIP_BMI_DEBUG_GM ((__u64)1 << 3)
26#define GOSSIP_JOB_DEBUG ((__u64)1 << 4)
27#define GOSSIP_SERVER_DEBUG ((__u64)1 << 5)
28#define GOSSIP_STO_DEBUG_CTRL ((__u64)1 << 6)
29#define GOSSIP_STO_DEBUG_DEFAULT ((__u64)1 << 7)
30#define GOSSIP_FLOW_DEBUG ((__u64)1 << 8)
31#define GOSSIP_BMI_DEBUG_GM_MEM ((__u64)1 << 9)
32#define GOSSIP_REQUEST_DEBUG ((__u64)1 << 10)
33#define GOSSIP_FLOW_PROTO_DEBUG ((__u64)1 << 11)
34#define GOSSIP_NCACHE_DEBUG ((__u64)1 << 12)
35#define GOSSIP_CLIENT_DEBUG ((__u64)1 << 13)
36#define GOSSIP_REQ_SCHED_DEBUG ((__u64)1 << 14)
37#define GOSSIP_ACACHE_DEBUG ((__u64)1 << 15)
38#define GOSSIP_TROVE_DEBUG ((__u64)1 << 16)
39#define GOSSIP_TROVE_OP_DEBUG ((__u64)1 << 17)
40#define GOSSIP_DIST_DEBUG ((__u64)1 << 18)
41#define GOSSIP_BMI_DEBUG_IB ((__u64)1 << 19)
42#define GOSSIP_DBPF_ATTRCACHE_DEBUG ((__u64)1 << 20)
43#define GOSSIP_MMAP_RCACHE_DEBUG ((__u64)1 << 21)
44#define GOSSIP_LOOKUP_DEBUG ((__u64)1 << 22)
45#define GOSSIP_REMOVE_DEBUG ((__u64)1 << 23)
46#define GOSSIP_GETATTR_DEBUG ((__u64)1 << 24)
47#define GOSSIP_READDIR_DEBUG ((__u64)1 << 25)
48#define GOSSIP_IO_DEBUG ((__u64)1 << 26)
49#define GOSSIP_DBPF_OPEN_CACHE_DEBUG ((__u64)1 << 27)
50#define GOSSIP_PERMISSIONS_DEBUG ((__u64)1 << 28)
51#define GOSSIP_CANCEL_DEBUG ((__u64)1 << 29)
52#define GOSSIP_MSGPAIR_DEBUG ((__u64)1 << 30)
53#define GOSSIP_CLIENTCORE_DEBUG ((__u64)1 << 31)
54#define GOSSIP_CLIENTCORE_TIMING_DEBUG ((__u64)1 << 32)
55#define GOSSIP_SETATTR_DEBUG ((__u64)1 << 33)
56#define GOSSIP_MKDIR_DEBUG ((__u64)1 << 34)
57#define GOSSIP_VARSTRIP_DEBUG ((__u64)1 << 35)
58#define GOSSIP_GETEATTR_DEBUG ((__u64)1 << 36)
59#define GOSSIP_SETEATTR_DEBUG ((__u64)1 << 37)
60#define GOSSIP_ENDECODE_DEBUG ((__u64)1 << 38)
61#define GOSSIP_DELEATTR_DEBUG ((__u64)1 << 39)
62#define GOSSIP_ACCESS_DEBUG ((__u64)1 << 40)
63#define GOSSIP_ACCESS_DETAIL_DEBUG ((__u64)1 << 41)
64#define GOSSIP_LISTEATTR_DEBUG ((__u64)1 << 42)
65#define GOSSIP_PERFCOUNTER_DEBUG ((__u64)1 << 43)
66#define GOSSIP_STATE_MACHINE_DEBUG ((__u64)1 << 44)
67#define GOSSIP_DBPF_KEYVAL_DEBUG ((__u64)1 << 45)
68#define GOSSIP_LISTATTR_DEBUG ((__u64)1 << 46)
69#define GOSSIP_DBPF_COALESCE_DEBUG ((__u64)1 << 47)
70#define GOSSIP_ACCESS_HOSTNAMES ((__u64)1 << 48)
71#define GOSSIP_FSCK_DEBUG ((__u64)1 << 49)
72#define GOSSIP_BMI_DEBUG_MX ((__u64)1 << 50)
73#define GOSSIP_BSTREAM_DEBUG ((__u64)1 << 51)
74#define GOSSIP_BMI_DEBUG_PORTALS ((__u64)1 << 52)
75#define GOSSIP_USER_DEV_DEBUG ((__u64)1 << 53)
76#define GOSSIP_DIRECTIO_DEBUG ((__u64)1 << 54)
77#define GOSSIP_MGMT_DEBUG ((__u64)1 << 55)
78#define GOSSIP_MIRROR_DEBUG ((__u64)1 << 56)
79#define GOSSIP_WIN_CLIENT_DEBUG ((__u64)1 << 57)
80#define GOSSIP_SECURITY_DEBUG ((__u64)1 << 58)
81#define GOSSIP_USRINT_DEBUG ((__u64)1 << 59)
82#define GOSSIP_RCACHE_DEBUG ((__u64)1 << 60)
83#define GOSSIP_SECCACHE_DEBUG ((__u64)1 << 61)
84
85#define GOSSIP_BMI_DEBUG_ALL ((__u64) (GOSSIP_BMI_DEBUG_TCP + \
86 GOSSIP_BMI_DEBUG_CONTROL + \
87 GOSSIP_BMI_DEBUG_GM + \
88 GOSSIP_BMI_DEBUG_OFFSETS + \
89 GOSSIP_BMI_DEBUG_IB + \
90 GOSSIP_BMI_DEBUG_MX + \
91 GOSSIP_BMI_DEBUG_PORTALS))
92
Yi Liu8bb8aef2015-11-24 15:12:14 -050093const char *ORANGEFS_debug_get_next_debug_keyword(int position);
Mike Marshallf7ab0932015-07-17 10:38:11 -040094
95#define GOSSIP_SUPER_DEBUG ((__u64)1 << 0)
96#define GOSSIP_INODE_DEBUG ((__u64)1 << 1)
97#define GOSSIP_FILE_DEBUG ((__u64)1 << 2)
98#define GOSSIP_DIR_DEBUG ((__u64)1 << 3)
99#define GOSSIP_UTILS_DEBUG ((__u64)1 << 4)
100#define GOSSIP_WAIT_DEBUG ((__u64)1 << 5)
101#define GOSSIP_ACL_DEBUG ((__u64)1 << 6)
102#define GOSSIP_DCACHE_DEBUG ((__u64)1 << 7)
103#define GOSSIP_DEV_DEBUG ((__u64)1 << 8)
104#define GOSSIP_NAME_DEBUG ((__u64)1 << 9)
105#define GOSSIP_BUFMAP_DEBUG ((__u64)1 << 10)
106#define GOSSIP_CACHE_DEBUG ((__u64)1 << 11)
107#define GOSSIP_DEBUGFS_DEBUG ((__u64)1 << 12)
108#define GOSSIP_XATTR_DEBUG ((__u64)1 << 13)
109#define GOSSIP_INIT_DEBUG ((__u64)1 << 14)
110#define GOSSIP_SYSFS_DEBUG ((__u64)1 << 15)
111
112#define GOSSIP_MAX_NR 16
113#define GOSSIP_MAX_DEBUG (((__u64)1 << GOSSIP_MAX_NR) - 1)
114
115/*function prototypes*/
Yi Liu8bb8aef2015-11-24 15:12:14 -0500116__u64 ORANGEFS_kmod_eventlog_to_mask(const char *event_logging);
117__u64 ORANGEFS_debug_eventlog_to_mask(const char *event_logging);
118char *ORANGEFS_debug_mask_to_eventlog(__u64 mask);
119char *ORANGEFS_kmod_mask_to_eventlog(__u64 mask);
Mike Marshallf7ab0932015-07-17 10:38:11 -0400120
121/* a private internal type */
122struct __keyword_mask_s {
123 const char *keyword;
124 __u64 mask_val;
125};
126
127#define __DEBUG_ALL ((__u64) -1)
128
129/* map all config keywords to pvfs2 debug masks here */
130static struct __keyword_mask_s s_keyword_mask_map[] = {
131 /* Log trove debugging info. Same as 'trove'. */
132 {"storage", GOSSIP_TROVE_DEBUG},
133 /* Log trove debugging info. Same as 'storage'. */
134 {"trove", GOSSIP_TROVE_DEBUG},
135 /* Log trove operations. */
136 {"trove_op", GOSSIP_TROVE_OP_DEBUG},
137 /* Log network debug info. */
138 {"network", GOSSIP_BMI_DEBUG_ALL},
139 /* Log server info, including new operations. */
140 {"server", GOSSIP_SERVER_DEBUG},
141 /* Log client sysint info. This is only useful for the client. */
142 {"client", GOSSIP_CLIENT_DEBUG},
143 /* Debug the varstrip distribution */
144 {"varstrip", GOSSIP_VARSTRIP_DEBUG},
145 /* Log job info */
146 {"job", GOSSIP_JOB_DEBUG},
147 /* Debug PINT_process_request calls. EXTREMELY verbose! */
148 {"request", GOSSIP_REQUEST_DEBUG},
149 /* Log request scheduler events */
150 {"reqsched", GOSSIP_REQ_SCHED_DEBUG},
151 /* Log the flow protocol events, including flowproto_multiqueue */
152 {"flowproto", GOSSIP_FLOW_PROTO_DEBUG},
153 /* Log flow calls */
154 {"flow", GOSSIP_FLOW_DEBUG},
155 /* Debug the client name cache. Only useful on the client. */
156 {"ncache", GOSSIP_NCACHE_DEBUG},
157 /* Debug read-ahead cache events. Only useful on the client. */
158 {"mmaprcache", GOSSIP_MMAP_RCACHE_DEBUG},
159 /* Debug the attribute cache. Only useful on the client. */
160 {"acache", GOSSIP_ACACHE_DEBUG},
161 /* Log/Debug distribution calls */
162 {"distribution", GOSSIP_DIST_DEBUG},
163 /* Debug the server-side dbpf attribute cache */
164 {"dbpfattrcache", GOSSIP_DBPF_ATTRCACHE_DEBUG},
165 /* Debug the client lookup state machine. */
166 {"lookup", GOSSIP_LOOKUP_DEBUG},
167 /* Debug the client remove state macine. */
168 {"remove", GOSSIP_REMOVE_DEBUG},
169 /* Debug the server getattr state machine. */
170 {"getattr", GOSSIP_GETATTR_DEBUG},
171 /* Debug the server setattr state machine. */
172 {"setattr", GOSSIP_SETATTR_DEBUG},
173 /* vectored getattr server state machine */
174 {"listattr", GOSSIP_LISTATTR_DEBUG},
175 /* Debug the client and server get ext attributes SM. */
176 {"geteattr", GOSSIP_GETEATTR_DEBUG},
177 /* Debug the client and server set ext attributes SM. */
178 {"seteattr", GOSSIP_SETEATTR_DEBUG},
179 /* Debug the readdir operation (client and server) */
180 {"readdir", GOSSIP_READDIR_DEBUG},
181 /* Debug the mkdir operation (server only) */
182 {"mkdir", GOSSIP_MKDIR_DEBUG},
Mike Marshall54804942015-10-05 13:44:24 -0400183 /*
184 * Debug the io operation (reads and writes)
185 * for both the client and server.
186 */
Mike Marshallf7ab0932015-07-17 10:38:11 -0400187 {"io", GOSSIP_IO_DEBUG},
188 /* Debug the server's open file descriptor cache */
189 {"open_cache", GOSSIP_DBPF_OPEN_CACHE_DEBUG},
190 /* Debug permissions checking on the server */
191 {"permissions", GOSSIP_PERMISSIONS_DEBUG},
192 /* Debug the cancel operation */
193 {"cancel", GOSSIP_CANCEL_DEBUG},
194 /* Debug the msgpair state machine */
195 {"msgpair", GOSSIP_MSGPAIR_DEBUG},
196 /* Debug the client core app */
197 {"clientcore", GOSSIP_CLIENTCORE_DEBUG},
198 /* Debug the client timing state machines (job timeout, etc.) */
199 {"clientcore_timing", GOSSIP_CLIENTCORE_TIMING_DEBUG},
200 /* network encoding */
201 {"endecode", GOSSIP_ENDECODE_DEBUG},
202 /* Show server file (metadata) accesses (both modify and read-only). */
203 {"access", GOSSIP_ACCESS_DEBUG},
204 /* Show more detailed server file accesses */
205 {"access_detail", GOSSIP_ACCESS_DETAIL_DEBUG},
206 /* Debug the listeattr operation */
207 {"listeattr", GOSSIP_LISTEATTR_DEBUG},
208 /* Debug the state machine management code */
209 {"sm", GOSSIP_STATE_MACHINE_DEBUG},
210 /* Debug the metadata dbpf keyval functions */
211 {"keyval", GOSSIP_DBPF_KEYVAL_DEBUG},
212 /* Debug the metadata sync coalescing code */
213 {"coalesce", GOSSIP_DBPF_COALESCE_DEBUG},
214 /* Display the hostnames instead of IP addrs in debug output */
215 {"access_hostnames", GOSSIP_ACCESS_HOSTNAMES},
216 /* Show the client device events */
217 {"user_dev", GOSSIP_USER_DEV_DEBUG},
218 /* Debug the fsck tool */
219 {"fsck", GOSSIP_FSCK_DEBUG},
220 /* Debug the bstream code */
221 {"bstream", GOSSIP_BSTREAM_DEBUG},
222 /* Debug trove in direct io mode */
223 {"directio", GOSSIP_DIRECTIO_DEBUG},
224 /* Debug direct io thread management */
225 {"mgmt", GOSSIP_MGMT_DEBUG},
226 /* Debug mirroring process */
227 {"mirror", GOSSIP_MIRROR_DEBUG},
228 /* Windows client */
229 {"win_client", GOSSIP_WIN_CLIENT_DEBUG},
230 /* Debug robust security code */
231 {"security", GOSSIP_SECURITY_DEBUG},
232 /* Capability Cache */
233 {"seccache", GOSSIP_SECCACHE_DEBUG},
234 /* Client User Interface */
235 {"usrint", GOSSIP_USRINT_DEBUG},
236 /* rcache */
237 {"rcache", GOSSIP_RCACHE_DEBUG},
238 /* Everything except the periodic events. Useful for debugging */
239 {"verbose",
240 (__DEBUG_ALL &
241 ~(GOSSIP_PERFCOUNTER_DEBUG | GOSSIP_STATE_MACHINE_DEBUG |
242 GOSSIP_ENDECODE_DEBUG | GOSSIP_USER_DEV_DEBUG))
243 },
244 /* No debug output */
245 {"none", GOSSIP_NO_DEBUG},
246 /* Everything */
247 {"all", __DEBUG_ALL}
248};
249
250#undef __DEBUG_ALL
251
252/*
253 * Map all kmod keywords to kmod debug masks here. Keep this
254 * structure "packed":
255 *
256 * "all" is always last...
257 *
258 * keyword mask_val index
259 * foo 1 0
260 * bar 2 1
261 * baz 4 2
262 * qux 8 3
263 * . . .
264 */
265static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
266 {"super", GOSSIP_SUPER_DEBUG},
267 {"inode", GOSSIP_INODE_DEBUG},
268 {"file", GOSSIP_FILE_DEBUG},
269 {"dir", GOSSIP_DIR_DEBUG},
270 {"utils", GOSSIP_UTILS_DEBUG},
271 {"wait", GOSSIP_WAIT_DEBUG},
272 {"acl", GOSSIP_ACL_DEBUG},
273 {"dcache", GOSSIP_DCACHE_DEBUG},
274 {"dev", GOSSIP_DEV_DEBUG},
275 {"name", GOSSIP_NAME_DEBUG},
276 {"bufmap", GOSSIP_BUFMAP_DEBUG},
277 {"cache", GOSSIP_CACHE_DEBUG},
278 {"debugfs", GOSSIP_DEBUGFS_DEBUG},
279 {"xattr", GOSSIP_XATTR_DEBUG},
280 {"init", GOSSIP_INIT_DEBUG},
281 {"sysfs", GOSSIP_SYSFS_DEBUG},
282 {"none", GOSSIP_NO_DEBUG},
283 {"all", GOSSIP_MAX_DEBUG}
284};
285
286static const int num_kmod_keyword_mask_map = (int)
287 (sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s));
288
289static const int num_keyword_mask_map = (int)
290 (sizeof(s_keyword_mask_map) / sizeof(struct __keyword_mask_s));
291
Yi Liu8bb8aef2015-11-24 15:12:14 -0500292#endif /* __ORANGEFS_DEBUG_H */