diff options
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/glusterfs.h | 5 | ||||
-rw-r--r-- | libglusterfs/src/graph.c | 2 | ||||
-rw-r--r-- | libglusterfs/src/logging.c | 8 |
3 files changed, 10 insertions, 5 deletions
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 97f31961a2e..24ca5d186d4 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -297,6 +297,7 @@ struct _glusterfs_graph { void *first; void *top; /* selected by -n */ int xl_count; + int id; /* Used in logging */ uint32_t volfile_checksum; }; typedef struct _glusterfs_graph glusterfs_graph_t; @@ -322,7 +323,9 @@ struct _glusterfs_ctx { pthread_t sigwaiter; struct mem_pool *stub_mem_pool; unsigned char cleanup_started; - + int graph_id; /* Incremented per graph, value should + indicate how many times the graph has + got changed */ }; typedef struct _glusterfs_ctx glusterfs_ctx_t; diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index a2d03fa0b64..31b908bf19c 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -469,6 +469,8 @@ glusterfs_graph_prepare (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx) fill_uuid (graph->graph_uuid, 128); + graph->id = ctx->graph_id++; + /* XXX: --xlator-option additions */ gf_add_cmdline_options (graph, &ctx->cmd_args); diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 78bd1d6103f..5b9f2aee204 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -287,10 +287,10 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function, else basename = file; - ret = gf_asprintf (&str1, "[%s] %s [%s:%d:%s] %s %s: ", + ret = gf_asprintf (&str1, "[%s] %s [%s:%d:%s] %s %d-%s: ", timestr, level_strings[level], basename, line, function, callstr, - domain); + ((this->graph) ? this->graph->id:0), domain); if (-1 == ret) { goto unlock; } @@ -423,10 +423,10 @@ log: else basename = file; - ret = gf_asprintf (&str1, "[%s] %s [%s:%d:%s] %s: ", + ret = gf_asprintf (&str1, "[%s] %s [%s:%d:%s] %d-%s: ", timestr, level_strings[level], basename, line, function, - domain); + ((this->graph)?this->graph->id:0), domain); if (-1 == ret) { goto unlock; } |