orangefs-debug.h 11 KB

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