summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c21
-rw-r--r--libglusterfs/src/glusterfs.h4
-rw-r--r--libglusterfs/src/xlator.h5
-rw-r--r--rpc/rpc-lib/src/protocol-common.h5
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c8
5 files changed, 36 insertions, 7 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 6122a76a36e..9984b42bb19 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -47,6 +47,7 @@
#include "cli1-xdr.h"
#include "statedump.h"
#include "syncop.h"
+#include "xlator.h"
static char is_mgmt_rpc_reconnect;
@@ -1937,6 +1938,24 @@ glusterfs_listener_stop (glusterfs_ctx_t *ctx)
}
int
+glusterfs_mgmt_notify (int32_t op, void *data, ...)
+{
+ int ret = 0;
+ switch (op)
+ {
+ case GF_EN_DEFRAG_STATUS:
+ ret = glusterfs_rebalance_event_notify ((dict_t*) data);
+ break;
+
+ default:
+ gf_log ("", GF_LOG_ERROR, "Invalid op");
+ break;
+ }
+
+ return ret;
+}
+
+int
glusterfs_mgmt_init (glusterfs_ctx_t *ctx)
{
cmd_args_t *cmd_args = NULL;
@@ -1981,6 +2000,8 @@ glusterfs_mgmt_init (glusterfs_ctx_t *ctx)
goto out;
}
+ ctx->notify = glusterfs_mgmt_notify;
+
/* This value should be set before doing the 'rpc_clnt_start()' as
the notify function uses this variable */
ctx->mgmt = rpc;
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 5acefe5613b..780353d29a8 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -328,6 +328,8 @@ struct _glusterfs_graph {
typedef struct _glusterfs_graph glusterfs_graph_t;
+typedef int32_t (*glusterfsd_mgmt_event_notify_fn_t) (int32_t event, void *data,
+ ...);
struct _glusterfs_ctx {
cmd_args_t cmd_args;
char *process_uuid;
@@ -367,6 +369,8 @@ struct _glusterfs_ctx {
int mem_accounting; /* if value is other than 0, it
will be set */
+ glusterfsd_mgmt_event_notify_fn_t notify; /* Used for xlators to make
+ call to fsd-mgmt */
};
typedef struct _glusterfs_ctx glusterfs_ctx_t;
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index b7b59fac956..2fce7dc474a 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -873,5 +873,8 @@ int is_gf_log_command (xlator_t *trans, const char *name, char *value);
int glusterd_check_log_level (const char *value);
int xlator_volopt_dynload (char *xlator_type, void **dl_handle,
volume_opt_list_t *vol_opt_handle);
-int32_t glusterfs_rebalance_event_notify (dict_t *dict);
+enum gf_hdsk_event_notify_op {
+ GF_EN_DEFRAG_STATUS,
+ GF_EN_MAX,
+};
#endif /* _XLATOR_H */
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index e2815d8c129..dc93f07dc2d 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -194,11 +194,6 @@ typedef enum {
GF_AFR_OP_SPLIT_BRAIN_FILES
} gf_xl_afr_op_t ;
-enum gf_hdsk_event_notify_op {
- GF_EN_DEFRAG_STATUS,
- GF_EN_MAX,
-};
-
#define GLUSTER_HNDSK_PROGRAM 14398633 /* Completely random */
#define GLUSTER_HNDSK_VERSION 2 /* 0.0.1 */
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 88c84dd37ec..d2a59cc4312 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -1427,11 +1427,16 @@ gf_defrag_start_crawl (void *data)
dict_t *fix_layout = NULL;
dict_t *migrate_data = NULL;
dict_t *status = NULL;
+ glusterfs_ctx_t *ctx = NULL;
this = data;
if (!this)
goto out;
+ ctx = glusterfs_ctx_get ();
+ if (!ctx)
+ goto out;
+
conf = this->private;
if (!conf)
goto out;
@@ -1505,7 +1510,8 @@ out:
{
status = dict_new ();
gf_defrag_status_get (defrag, status);
- glusterfs_rebalance_event_notify (status);
+ if (ctx->notify)
+ ctx->notify (GF_EN_DEFRAG_STATUS, status);
if (status)
dict_unref (status);
defrag->is_exiting = 1;