diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-05-13 03:46:38 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-05-13 12:12:38 -0700 |
commit | 675d330897aa6923d667cc318ee466cb0cb84f9b (patch) | |
tree | 75ee0945bcf7ef7720e5bbe6ed2f2ffa4c7c7317 /libglusterfs/src/statedump.h | |
parent | 16f0d3b9da3a0b21204cd8fc7ad2139a6f58ee90 (diff) |
libglusterfs: Provide ability to filter output of state dump
Output of statedump can be controlled by having file /tmp/glusterdump.input.
/tmp/glusterdump.input needs to have a <key>=<value> in each line.
key can be one of 'priv', 'fd', 'inode', 'mem', 'callpool' and 'iobuf'.
value has to be one of 'yes' or 'no'.
If /tmp/glusterdump.input is not available, no filtering happens in statedump.
Else statedump would contain only those sections which correspond to a <key>
having value 'yes'.
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 828 (glusterdump filled up the /)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=828
Diffstat (limited to 'libglusterfs/src/statedump.h')
-rw-r--r-- | libglusterfs/src/statedump.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/libglusterfs/src/statedump.h b/libglusterfs/src/statedump.h index 1261ebbef1b..21b15b245ed 100644 --- a/libglusterfs/src/statedump.h +++ b/libglusterfs/src/statedump.h @@ -19,7 +19,7 @@ #ifndef STATEDUMP_H -#define STATEDUMP_H +#define STATEDUMP_H #include <stdarg.h> #include "inode.h" @@ -29,28 +29,46 @@ #define GF_DUMP_LOGFILE_ROOT "/tmp/glusterdump" #define GF_DUMP_LOGFILE_ROOT_LEN 256 +#define GF_DUMP_OPTIONFILE "/tmp/glusterdump.input" + +typedef struct gf_dump_xl_options_ { + gf_boolean_t dump_priv; + gf_boolean_t dump_inode; + gf_boolean_t dump_fd; +} gf_dump_xl_options_t; + +typedef struct gf_dump_options_ { + gf_boolean_t dump_mem; + gf_boolean_t dump_iobuf; + gf_boolean_t dump_callpool; + gf_dump_xl_options_t xl_options; //options for all xlators +} gf_dump_options_t; + static inline void _gf_proc_dump_build_key (char *key, const char *prefix, char *fmt,...) { char buf[GF_DUMP_MAX_BUF_LEN]; va_list ap; - memset(buf, 0, sizeof(buf)); - va_start(ap, fmt); - vsnprintf(buf, GF_DUMP_MAX_BUF_LEN, fmt, ap); - va_end(ap); - snprintf(key, GF_DUMP_MAX_BUF_LEN, "%s.%s", prefix, buf); + memset (buf, 0, sizeof(buf)); + va_start (ap, fmt); + vsnprintf (buf, GF_DUMP_MAX_BUF_LEN, fmt, ap); + va_end (ap); + snprintf (key, GF_DUMP_MAX_BUF_LEN, "%s.%s", prefix, buf); } #define gf_proc_dump_build_key(key, key_prefix, fmt...) \ {\ - _gf_proc_dump_build_key(key, key_prefix, ##fmt);\ + _gf_proc_dump_build_key (key, key_prefix, ##fmt);\ } + +#define GF_PROC_DUMP_SET_OPTION(opt,val) opt = val + void gf_proc_dump_init(); -void +void gf_proc_dump_fini(void); void |