From ed4b76ba9c545f577287c0e70ae3cc853a0d5f3f Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 2 Aug 2012 13:14:25 +0530 Subject: 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 BUG: 764890 Reviewed-on: http://review.gluster.com/3767 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/nfs/server/src/nfs3-helpers.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'xlators/nfs/server') diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index e2c16ef0..253fe075 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); -- cgit