diff options
| author | Amar Tumballi <amar@gluster.com> | 2011-03-16 09:38:35 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-17 11:57:27 -0700 | 
| commit | 75bda6e41d9b244ab9d040a035582ea6bd4c8120 (patch) | |
| tree | 1678cdbef24d4902ff8c7622d3f969c3d73eaf67 /libglusterfs/src/statedump.c | |
| parent | 858944850adf7ec04898a15db90e231655ac4965 (diff) | |
libglusterfs/src/*.c: whitespace cleanup
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 2346 (Log message enhancements in GlusterFS - phase 1)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
Diffstat (limited to 'libglusterfs/src/statedump.c')
| -rw-r--r-- | libglusterfs/src/statedump.c | 142 | 
1 files changed, 70 insertions, 72 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index d3e1272c565..4a49353ef40 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -29,10 +29,10 @@  #endif /* MALLOC_H */ -#define GF_PROC_DUMP_IS_OPTION_ENABLED(opt) \ +#define GF_PROC_DUMP_IS_OPTION_ENABLED(opt)     \          (dump_options.dump_##opt == _gf_true) -#define GF_PROC_DUMP_IS_XL_OPTION_ENABLED(opt)\ +#define GF_PROC_DUMP_IS_XL_OPTION_ENABLED(opt)                  \          (dump_options.xl_options.dump_##opt == _gf_true)  extern xlator_t global_xlator; @@ -45,14 +45,14 @@ gf_dump_options_t dump_options;  static void  gf_proc_dump_lock (void)  { -	pthread_mutex_lock (&gf_proc_dump_mutex); +        pthread_mutex_lock (&gf_proc_dump_mutex);  }  static void  gf_proc_dump_unlock (void)  { -	pthread_mutex_unlock (&gf_proc_dump_mutex); +        pthread_mutex_unlock (&gf_proc_dump_mutex);  } @@ -66,10 +66,10 @@ gf_proc_dump_open (void)          snprintf (path, sizeof (path), "%s.%d", GF_DUMP_LOGFILE_ROOT, getpid ());          dump_fd = open (path, O_CREAT|O_RDWR|O_TRUNC|O_APPEND, 0600); -        if (dump_fd < 0)  +        if (dump_fd < 0)                  return -1; -	gf_dump_fd = dump_fd; +        gf_dump_fd = dump_fd;          return 0;  } @@ -90,7 +90,7 @@ gf_proc_dump_add_section (char *key, ...)          va_list ap;          int     ret; -	GF_ASSERT(key); +        GF_ASSERT(key);          memset (buf, 0, sizeof(buf));          snprintf (buf, GF_DUMP_MAX_BUF_LEN, "\n["); @@ -110,10 +110,10 @@ gf_proc_dump_write (char *key, char *value,...)          char         buf[GF_DUMP_MAX_BUF_LEN];          int          offset = 0; -	va_list      ap; +        va_list      ap;          int          ret; -	GF_ASSERT (key); +        GF_ASSERT (key);          offset = strlen (key); @@ -148,15 +148,15 @@ gf_proc_dump_xlator_mem_info (xlator_t *xl)          gf_proc_dump_write ("num_types", "%d", xl->mem_acct.num_types);          for (i = 0; i < xl->mem_acct.num_types; i++) { -                if (!(memcmp (&xl->mem_acct.rec[i], &rec,  -                                          sizeof (struct mem_acct)))) -                                continue; +                if (!(memcmp (&xl->mem_acct.rec[i], &rec, +                              sizeof (struct mem_acct)))) +                        continue; -                gf_proc_dump_add_section ("%s.%s - usage-type %d", xl->type,  -                                         xl->name,i); +                gf_proc_dump_add_section ("%s.%s - usage-type %d", xl->type, +                                          xl->name,i);                  gf_proc_dump_build_key (prefix, "memusage", "%s.%s.type.%d",                                          xl->type, xl->name, i); -                gf_proc_dump_build_key (key, prefix, "size");  +                gf_proc_dump_build_key (key, prefix, "size");                  gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].size);                  gf_proc_dump_build_key (key, prefix, "num_allocs");                  gf_proc_dump_write (key, "%u", xl->mem_acct.rec[i].num_allocs); @@ -202,53 +202,53 @@ void gf_proc_dump_latency_info (xlator_t *xl);  void  gf_proc_dump_xlator_info (xlator_t *this_xl)  { -	glusterfs_ctx_t   *ctx = NULL; -	xlator_t *fuse_xlator, *this_xlator; -	 +        glusterfs_ctx_t   *ctx = NULL; +        xlator_t *fuse_xlator, *this_xlator; +          if (!this_xl)                  return; -	 -	ctx = glusterfs_ctx_get (); -	if (!ctx) -		return; -	if (ctx->master){ +        ctx = glusterfs_ctx_get (); +        if (!ctx) +                return; + +        if (ctx->master){ -		fuse_xlator = (xlator_t *) ctx->master; +                fuse_xlator = (xlator_t *) ctx->master; -		if (!fuse_xlator->dumpops) -			return; +                if (!fuse_xlator->dumpops) +                        return; -		if (fuse_xlator->dumpops->priv && +                if (fuse_xlator->dumpops->priv &&                      GF_PROC_DUMP_IS_XL_OPTION_ENABLED (priv)) -                         fuse_xlator->dumpops->priv (fuse_xlator); +                        fuse_xlator->dumpops->priv (fuse_xlator);                  if (fuse_xlator->dumpops->inode &&                      GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode)) { -			 -			if (!ctx->active) -				return; -			this_xlator = (xlator_t *) ctx->active->top; - -			if (this_xlator && this_xlator->itable) -				inode_table_dump (this_xlator->itable, -						  "xlator.mount.fuse.itable"); -			else -				return; -		} + +                        if (!ctx->active) +                                return; +                        this_xlator = (xlator_t *) ctx->active->top; + +                        if (this_xlator && this_xlator->itable) +                                inode_table_dump (this_xlator->itable, +                                                  "xlator.mount.fuse.itable"); +                        else +                                return; +                }                  if (fuse_xlator->dumpops->fd &&                      GF_PROC_DUMP_IS_XL_OPTION_ENABLED (fd))                          fuse_xlator->dumpops->fd (fuse_xlator); -	} -			 +        } +          while (this_xl) { -		 -		if (ctx->measure_latency) -			gf_proc_dump_latency_info (this_xl); -		gf_proc_dump_xlator_mem_info(this_xl); +                if (ctx->measure_latency) +                        gf_proc_dump_latency_info (this_xl); + +                gf_proc_dump_xlator_mem_info(this_xl);                  if (!this_xl->dumpops) {                          this_xl = this_xl->next; @@ -257,17 +257,17 @@ gf_proc_dump_xlator_info (xlator_t *this_xl)                  if (this_xl->dumpops->priv &&                      GF_PROC_DUMP_IS_XL_OPTION_ENABLED (priv)) -                         this_xl->dumpops->priv (this_xl); +                        this_xl->dumpops->priv (this_xl);                  if (this_xl->dumpops->inode &&                      GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode))                          this_xl->dumpops->inode (this_xl); -			 -		 + +                  if (this_xl->dumpops->fd &&                      GF_PROC_DUMP_IS_XL_OPTION_ENABLED (fd))                          this_xl->dumpops->fd (this_xl); -	 +                  this_xl = this_xl->next;          } @@ -278,7 +278,7 @@ gf_proc_dump_parse_set_option (char *key, char *value)  {          gf_boolean_t    *opt_key = NULL;          gf_boolean_t    opt_value = _gf_false; -	char buf[GF_DUMP_MAX_BUF_LEN]; +        char buf[GF_DUMP_MAX_BUF_LEN];          if (!strncasecmp (key, "mem", 3)) {                  opt_key = &dump_options.dump_mem; @@ -300,15 +300,15 @@ gf_proc_dump_parse_set_option (char *key, char *value)          if (!opt_key) {                  //None of dump options match the key, return back -		snprintf (buf, sizeof (buf), "[Warning]:None of the options " -			  "matched key : %s\n", key); -		write (gf_dump_fd, buf, strlen (buf)); +                snprintf (buf, sizeof (buf), "[Warning]:None of the options " +                          "matched key : %s\n", key); +                write (gf_dump_fd, buf, strlen (buf));                  return -1;          }          opt_value = (strncasecmp (value, "yes", 3) ? -                                  _gf_false: _gf_true); +                     _gf_false: _gf_true);          GF_PROC_DUMP_SET_OPTION (*opt_key, opt_value); @@ -342,7 +342,7 @@ gf_proc_dump_disable_all_options ()          GF_PROC_DUMP_SET_OPTION (dump_options.dump_callpool, _gf_false);          GF_PROC_DUMP_SET_OPTION (dump_options.xl_options.dump_priv, _gf_false);          GF_PROC_DUMP_SET_OPTION (dump_options.xl_options.dump_inode, -                                                                _gf_false); +                                 _gf_false);          GF_PROC_DUMP_SET_OPTION (dump_options.xl_options.dump_fd, _gf_false);          GF_PROC_DUMP_SET_OPTION (dump_options.xl_options.dump_inodectx,                                   _gf_false); @@ -357,11 +357,11 @@ gf_proc_dump_options_init ()          int     ret = -1;          FILE    *fp = NULL;          char    buf[256]; -	char	dumpbuf[GF_DUMP_MAX_BUF_LEN]; +        char    dumpbuf[GF_DUMP_MAX_BUF_LEN];          char    *key = NULL, *value = NULL;          char    *saveptr = NULL; -	 -	 + +          fp = fopen (GF_DUMP_OPTIONFILE, "r");          if (!fp) { @@ -389,8 +389,8 @@ gf_proc_dump_options_init ()                          continue;                  } -		snprintf (dumpbuf, sizeof (dumpbuf), "[Debug]:key=%s, value=%s\n",key,value); -		write (gf_dump_fd, dumpbuf, strlen (dumpbuf)); +                snprintf (dumpbuf, sizeof (dumpbuf), "[Debug]:key=%s, value=%s\n",key,value); +                write (gf_dump_fd, dumpbuf, strlen (dumpbuf));                  gf_proc_dump_parse_set_option (key, value); @@ -405,14 +405,14 @@ gf_proc_dump_info (int signum)          int               ret = -1;          glusterfs_ctx_t   *ctx = NULL; -	 +          gf_proc_dump_lock ();          ret = gf_proc_dump_open ();          if (ret < 0)                  goto out;          ret = gf_proc_dump_options_init (); -	 +          if (ret < 0)                  goto out; @@ -420,13 +420,13 @@ gf_proc_dump_info (int signum)                  gf_proc_dump_mem_info ();          ctx = glusterfs_ctx_get (); -         +          if (ctx) { -		if (GF_PROC_DUMP_IS_OPTION_ENABLED (iobuf)) -			iobuf_stats_dump (ctx->iobuf_pool); +                if (GF_PROC_DUMP_IS_OPTION_ENABLED (iobuf)) +                        iobuf_stats_dump (ctx->iobuf_pool);                  if (GF_PROC_DUMP_IS_OPTION_ENABLED (callpool))                          gf_proc_dump_pending_frames (ctx->pool); -                gf_proc_dump_xlator_info (ctx->active->top);  +                gf_proc_dump_xlator_info (ctx->active->top);          } @@ -441,23 +441,21 @@ out:  void  gf_proc_dump_fini (void)  { -	pthread_mutex_destroy (&gf_proc_dump_mutex); +        pthread_mutex_destroy (&gf_proc_dump_mutex);  }  void  gf_proc_dump_init ()  { -	pthread_mutex_init (&gf_proc_dump_mutex, NULL); +        pthread_mutex_init (&gf_proc_dump_mutex, NULL); -	return; +        return;  }  void  gf_proc_dump_cleanup (void)  { -	pthread_mutex_destroy (&gf_proc_dump_mutex); +        pthread_mutex_destroy (&gf_proc_dump_mutex);  } - -  | 
