From a4e11fd67e3608c828e5bb8abf7a310b4f0a3017 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Mon, 16 Jul 2012 15:50:30 -0700 Subject: glusterfs_ctx_t: un-globalize the filesystem context So far there has been a global glusterfs_ctx_t object which represents the running instance of the filesystem (client or server). It contains the various graphs, connection to the management daemon over which new graphs are obtained, calls stacks issued on this filesystem, and a bunch of such things. With the introduction of libgfapi, it is no more true that there will be only one filesystem context in a process. Applications can be written to use libgfapi and obtain serveral instances of different filesystems/volumes in the same process. This involves messy untangling of assumptions inside libglusterfs that there would only be one global glusterfs_ctx_t and offload that assumption to glusterfsd/ and cli/ (where it is true). Change-Id: Ifd7d1259428c26076140a5764a2dc7361694139c BUG: 839950 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.com/3678 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- xlators/cluster/dht/src/dht-rebalance.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/dht/src/dht-rebalance.c') diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index e33875ffc..8f2f0adb2 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -944,14 +944,13 @@ dht_start_rebalance_task (xlator_t *this, call_frame_t *frame) } int -gf_listener_stop (void) +gf_listener_stop (xlator_t *this) { glusterfs_ctx_t *ctx = NULL; cmd_args_t *cmd_args = NULL; int ret = 0; - xlator_t *this = NULL; - ctx = glusterfs_ctx_get (); + ctx = this->ctx; GF_ASSERT (ctx); cmd_args = &ctx->cmd_args; if (cmd_args->sock_file) { @@ -962,7 +961,6 @@ gf_listener_stop (void) } if (ret) { - this = THIS; gf_log (this->name, GF_LOG_ERROR, "Failed to unlink listener " "socket %s, error: %s", cmd_args->sock_file, strerror (errno)); @@ -1431,7 +1429,7 @@ gf_defrag_start_crawl (void *data) if (!this) goto out; - ctx = glusterfs_ctx_get (); + ctx = this->ctx; if (!ctx) goto out; @@ -1528,7 +1526,7 @@ out: static int gf_defrag_done (int ret, call_frame_t *sync_frame, void *data) { - gf_listener_stop(); + gf_listener_stop (sync_frame->this); STACK_DESTROY (sync_frame->root); kill (getpid(), SIGTERM); -- cgit