summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-08-02 13:14:25 +0530
committerAnand Avati <avati@redhat.com>2012-08-03 02:01:52 -0700
commited4b76ba9c545f577287c0e70ae3cc853a0d5f3f (patch)
treedeffb91a0cee620ac7fcc8c7914dbca73668574e /xlators
parent66205114267ec659b4ad8084c7e9497009529c61 (diff)
core: reduce the usage of global variables
* move all the 'logging' related global variables into ctx * make gf_fop_list a 'const' global array, hence no init(), no edits. * make sure ctx is allocated without any dependancy on memory-accounting infrastructure, so it can be the first one to get allocated * globals_init() should happen with ctx as argument not yet fixed below in this patchset: * anything with 'THIS' related globals * anything related to compat_errno related globals as its one time init'd and not changed later on. * statedump related globals Change-Id: Iab8fc30d4bfdbded6741d66ff1ed670fdc7b7ad2 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 764890 Reviewed-on: http://review.gluster.com/3767 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/debug/trace/src/trace.c3
-rw-r--r--xlators/nfs/server/src/nfs3-helpers.c34
-rw-r--r--xlators/performance/write-behind/src/write-behind.c2
-rw-r--r--xlators/protocol/server/src/server-helpers.c10
4 files changed, 22 insertions, 27 deletions
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index 97f61ca59cb..d9d95c973ec 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -2267,7 +2267,8 @@ init (xlator_t *this)
int i;
for (i = 0; i < GF_FOP_MAXVALUE; i++) {
trace_fop_names[i].name = (gf_fop_list[i] ?
- gf_fop_list[i] : ":O");
+ (char *)gf_fop_list[i] :
+ ":O");
trace_fop_names[i].enabled = 1;
}
}
diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c
index e2c16ef0e95..253fe075410 100644
--- a/xlators/nfs/server/src/nfs3-helpers.c
+++ b/xlators/nfs/server/src/nfs3-helpers.c
@@ -1619,7 +1619,7 @@ nfs3_log_common_call (uint32_t xid, char *op, struct nfs3_fh *fh)
{
char fhstr[1024];
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (fh, fhstr);
@@ -1634,7 +1634,7 @@ nfs3_log_fh_entry_call (uint32_t xid, char *op, struct nfs3_fh *fh,
{
char fhstr[1024];
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (fh, fhstr);
gf_log (GF_NFS3, GF_LOG_DEBUG, "XID: %x, %s: args: %s, name: %s", xid,
@@ -1649,7 +1649,7 @@ nfs3_log_rename_call (uint32_t xid, struct nfs3_fh *src, char *sname,
char sfhstr[1024];
char dfhstr[1024];
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (src, sfhstr);
nfs3_fh_to_str (dst, dfhstr);
@@ -1670,7 +1670,7 @@ nfs3_log_create_call (uint32_t xid, struct nfs3_fh *fh, char *name,
char unchkd[] = "UNCHECKED";
char guarded[] = "GUARDED";
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (fh, fhstr);
if (mode == EXCLUSIVE)
@@ -1695,7 +1695,7 @@ nfs3_log_mknod_call (uint32_t xid, struct nfs3_fh *fh, char *name, int type)
char sock[] = "SOCK";
char fifo[] = "FIFO";
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (fh, fhstr);
if (type == NF3CHR)
@@ -1718,7 +1718,7 @@ nfs3_log_symlink_call (uint32_t xid, struct nfs3_fh *fh, char *name, char *tgt)
{
char fhstr[1024];
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (fh, fhstr);
gf_log (GF_NFS3, GF_LOG_DEBUG, "XID: %x, SYMLINK: args: %s, name: %s,"
@@ -1733,7 +1733,7 @@ nfs3_log_link_call (uint32_t xid, struct nfs3_fh *fh, char *name,
char dfhstr[1024];
char tfhstr[1024];
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (fh, dfhstr);
nfs3_fh_to_str (tgt, tfhstr);
@@ -1748,7 +1748,7 @@ nfs3_log_rw_call (uint32_t xid, char *op, struct nfs3_fh *fh, offset3 offt,
{
char fhstr[1024];
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (fh, fhstr);
if (stablewrite == -1)
@@ -3383,7 +3383,7 @@ nfs3_log_common_res (uint32_t xid, int op, nfsstat3 stat, int pstat)
char errstr[1024];
int ll = nfs3_loglevel (op, stat);
- if (gf_log_loglevel < ll)
+ if (THIS->ctx->log.loglevel < ll)
return;
nfs3_stat_to_errstr (xid, nfs3op_strings[op].str, stat, pstat, errstr);
gf_log (GF_NFS3, ll, "%s", errstr);
@@ -3395,7 +3395,7 @@ nfs3_log_readlink_res (uint32_t xid, nfsstat3 stat, int pstat, char *linkpath)
char errstr[1024];
int ll = nfs3_loglevel (NFS3_READLINK, stat);
- if (gf_log_loglevel < ll)
+ if (THIS->ctx->log.loglevel < ll)
return;
nfs3_stat_to_errstr (xid, "READLINK", stat, pstat, errstr);
@@ -3412,7 +3412,7 @@ nfs3_log_read_res (uint32_t xid, nfsstat3 stat, int pstat, count3 count,
int ll = GF_LOG_DEBUG;
ll = nfs3_loglevel (NFS3_READ, stat);
- if (gf_log_loglevel < ll)
+ if (THIS->ctx->log.loglevel < ll)
return;
nfs3_stat_to_errstr (xid, "READ", stat, pstat, errstr);
if (vec)
@@ -3432,7 +3432,7 @@ nfs3_log_write_res (uint32_t xid, nfsstat3 stat, int pstat, count3 count,
char errstr[1024];
int ll = nfs3_loglevel (NFS3_WRITE, stat);
- if (gf_log_loglevel < ll)
+ if (THIS->ctx->log.loglevel < ll)
return;
nfs3_stat_to_errstr (xid, "WRITE", stat, pstat, errstr);
@@ -3450,7 +3450,7 @@ nfs3_log_newfh_res (uint32_t xid, int op, nfsstat3 stat, int pstat,
char fhstr[1024];
int ll = nfs3_loglevel (op, stat);
- if (gf_log_loglevel < ll)
+ if (THIS->ctx->log.loglevel < ll)
return;
nfs3_stat_to_errstr (xid, nfs3op_strings[op].str, stat, pstat, errstr);
nfs3_fh_to_str (newfh, fhstr);
@@ -3466,7 +3466,7 @@ nfs3_log_readdir_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf,
char errstr[1024];
int ll = nfs3_loglevel (NFS3_READDIR, stat);
- if (gf_log_loglevel < ll)
+ if (THIS->ctx->log.loglevel < ll)
return;
nfs3_stat_to_errstr (xid, "READDIR", stat, pstat, errstr);
gf_log (GF_NFS3, ll, "%s, count: %"PRIu32", cverf: %"PRIu64
@@ -3481,7 +3481,7 @@ nfs3_log_readdirp_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t cverf,
char errstr[1024];
int ll = nfs3_loglevel (NFS3_READDIRP, stat);
- if (gf_log_loglevel < ll)
+ if (THIS->ctx->log.loglevel < ll)
return;
nfs3_stat_to_errstr (xid, "READDIRPLUS", stat, pstat, errstr);
gf_log (GF_NFS3, ll, "%s, dircount: %"PRIu32", maxcount: %"
@@ -3496,7 +3496,7 @@ nfs3_log_commit_res (uint32_t xid, nfsstat3 stat, int pstat, uint64_t wverf)
char errstr[1024];
int ll = nfs3_loglevel (NFS3_COMMIT, stat);
- if (gf_log_loglevel < ll)
+ if (THIS->ctx->log.loglevel < ll)
return;
nfs3_stat_to_errstr (xid, "COMMIT", stat, pstat, errstr);
gf_log (GF_NFS3, ll, "%s, wverf: %"PRIu64, errstr, wverf);
@@ -3509,7 +3509,7 @@ nfs3_log_readdir_call (uint32_t xid, struct nfs3_fh *fh, count3 dircount,
{
char fhstr[1024];
- if (gf_log_loglevel < GF_LOG_DEBUG)
+ if (THIS->ctx->log.loglevel < GF_LOG_DEBUG)
return;
nfs3_fh_to_str (fh, fhstr);
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 2cec7132431..afbee6ce7b4 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -2970,7 +2970,7 @@ __wb_dump_requests (struct list_head *head, char *prefix, char passive)
gf_proc_dump_build_key (key, prefix, passive ? "passive-request"
: "active-request");
gf_proc_dump_build_key (key_prefix, key,
- gf_fop_list[request->fop]);
+ (char *)gf_fop_list[request->fop]);
gf_proc_dump_add_section(key_prefix);
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 3a7bb4aeae2..eec1684ca69 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -1136,10 +1136,7 @@ server_print_reply (call_frame_t *frame, int op_ret, int op_errno)
switch (frame->root->type) {
case GF_OP_TYPE_FOP:
- op = gf_fop_list[frame->root->op];
- break;
- case GF_OP_TYPE_MGMT:
- op = gf_mgmt_list[frame->root->op];
+ op = (char *)gf_fop_list[frame->root->op];
break;
default:
op = "";
@@ -1205,10 +1202,7 @@ server_print_request (call_frame_t *frame)
switch (frame->root->type) {
case GF_OP_TYPE_FOP:
- op = gf_fop_list[frame->root->op];
- break;
- case GF_OP_TYPE_MGMT:
- op = gf_mgmt_list[frame->root->op];
+ op = (char *)gf_fop_list[frame->root->op];
break;
default:
op = "";